- Triangulate the polygon consisting of only the points (no handles).
- Fill these triangles with a simple scan line fill.
- Form a triangle (two points with one handle between them) or a quad (two points with two handles between them) for every connected pair of points.
- If it's a quad divide it into two triangles.
- For every triangle:
- Determine if it contains a concave or a convex curve.
- If it's convex then set all pixels that lie within the curve to 1.
- If it's concave then set all pixels that lie within the curve to 0.
The scan line fill is a simplified version of the technique described here: http://www.cs.fit.edu/~wds/classes/graphics/Rasterize/rasterize/rasterize.html. Because it only has to fill triangles it doesn't have to check and sort multiple scan line intersections. It simply uses Bresenham's line algorithm to determine x for the left and the right edge for every line y. These are stored in a list and used afterwards to fill the pixels.
Figuring out if a curve is concave or convex is simple since the triangulation function already requires all points to be sorted counter-clockwise. That means that if the handle point lies to the left of the line between the two points the curve is concave, else it's convex.
So, steps 1,2,3 & 4.1 are covered and implemented but steps 4.2 & 4.3 are the tricky ones. To be continued...
No comments:
Post a Comment