Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top