Skip to content
All library documents

Geometric Tools for Points, Lines, Angles, and Polygons

Article TradingView scripts

Summary

This Pine library provides reusable geometry operations for chart-based scripts. It defines point, line, polygon, and circle types, plus sorting modes and scalar helpers for trigonometry, angle calculation, distance, interpolation, and integer ratios. Point methods support coordinate access and mutation, vector addition and subtraction, scalar scaling, rotation, and relationships such as midpoints and distance.

The later functions extend these primitives to chart objects and shapes, including regular polygons, circle membership checks, and sampled points for scaled circles or tilted ovals. Safe index helpers are intended to keep chart references within plottable limits. The document is a programming utility rather than a trading method: it gives no market hypothesis, strategy rules, backtest, or performance evidence. Some functions rely on assumptions about valid inputs, such as nonzero divisors or appropriate coordinate values, and the excerpt does not document every implementation detail.

Key ideas

  • The library models points, lines, polygons, and circles for use in chart scripts.
  • Point methods provide vector arithmetic, coordinate access, transformations, and geometric measurements.
  • Angle helpers and trigonometric functions support calculations involving chart geometry.
  • Shape utilities generate polygon vertices and circle or oval samples from point inputs.
  • The document offers implementation tools but no trading strategy or empirical results.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.