Skip to main content

triangle_disk_area

Function triangle_disk_area 

Source
fn triangle_disk_area(a: [f64; 2], b: [f64; 2], radius: f64) -> f64
Expand description

Signed area of the intersection between the triangle (origin, a, b) and the disk of radius radius centred on the origin.

Summed over the edges of a polygon it gives the area of that polygon clipped to the disk, the same way the shoelace formula sums signed triangles. A piece of edge running outside the disk contributes its circular sector instead of its triangle:

        b
       /                 outside -> sector of the circle
   ---+---___            inside  -> plain triangle
  /  p2       \
 |     \       |
 |      p1     |
  \      \    /
   ---    a---