Skip to main content

arc_ring_area

Function arc_ring_area 

Source
pub fn arc_ring_area(ring: &ArcRing) -> f64
Expand description

Signed area enclosed by an arc ring.

Positive is counter-clockwise. The value is the polygon area over the vertices plus, for each arc edge, the signed area of its circular segment:

theta = 4 * atan(bulge)                 signed included angle
R     = chord * (1 + bulge^2) / (4 |bulge|)
extra = R^2 * (theta - sin theta) / 2   signed by theta

Keeping theta signed is what makes a reversed ring negate exactly: a clockwise circle must return -pi r^2, not +pi r^2. An unsigned segment term gets the disc right and the reversed disc wrong.

The polygon area is summed as triangles fanned from the first vertex, so its rounding scales with the ring’s extent, not with its distance from the origin (#274).