Area of intersection between circle and rectangle

后端 未结 7 847
陌清茗
陌清茗 2020-12-13 19:35

I\'m looking for a fast way to determine the area of intersection between a rectangle and a circle (I need to do millions of these calculations).

A specific property

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 20:08

    Perhaps you can use the answer to this question, where the area of intersection between a circle and a triangle is asked. Split your rectangle into two triangles and use the algorithms described there.

    Another way is to draw a line between the two intersection points, this splits your area into a polygon (3 or 4 edges) and a circular segment, for both you should be able to find libraries easier or do the calculations yourself.

提交回复
热议问题