문제

I have a shape defined by a set of quadratic bezier curves (point0 (x,y),controlPoint(x,y),point1(x,y)). This shape is always closed but can be composed of concave and convex areas (ex: shape can be a oval or it can be a winding snake . Is there an algorithm that can determine if a coordinate (x,y) is inside the closed shape formed by the given set of quadratic bezier curves?

Thanks for your time

도움이 되었습니까?

해결책

The basic approach is a simple https://en.wikipedia.org/wiki/Point_in_polygon test. Flatten the curves, and treat it as a (finite) series of lines, then test. To improve performance, you can also treat your shape as a number of distinct regions, each bounded by a bezier curve, with (possibly overlapping) hulls. If the point is inside the hull, only flatten that curve and then do the real test.

Variations on the scheme are varied.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top