Skip to content

editor / turningAngle

Function: turningAngle() ​

turningAngle(previous, vertex, next): number

Defined in: geometry/turning-angle.ts:20

Turning angle at a vertex, from the incoming edge to the outgoing edge.

Formula: τ = atan2(a⊥ · b, a · b), a = vertex − previous, b = next − vertex. In the SVG frame, τ > 0 is a clockwise turn on screen; τ ∈ [−π, π]. When both products are zero (a zero-length edge has no direction), τ is 0 explicitly: atan2(±0, ±0) depends on the signs of the zeros in IEEE 754 and can give π (ADR-0025).

Parameters ​

previous ​

Point

vertex before the corner

vertex ​

Point

corner vertex

next ​

Point

vertex after the corner

Returns ​

number

the signed turning angle in radians, 0 for aligned vertices or a zero-length edge

Kind ​

geometry

See ​

DERIV-turning-angle