如何计算三角形(指定为三(X,Y)对)和圆(X,Y,R)之间的交叉区域?我做了一些搜索无济于事.这是为了工作,而不是学校.:)
它在C#中看起来像这样:
struct { PointF vert[3]; } Triangle;
struct { PointF center; float radius; } Circle;
// returns the area of intersection, e.g.:
// if the circle contains the triangle, return area of triangle
// if the triangle contains the circle, return area of circle
// if partial intersection, figure that out
// if no intersection, return 0
double AreaOfIntersection(Triangle t, Circle c)
{
...
}
Run Code Online (Sandbox Code Playgroud)