Wednesday, June 25, 2008
There are various polygon filling algorithms. Some are effective but slow. This one is about a faster but probably not effective algorithm to fill up a polygon. There are 2 types of basic polygons as per the "center" of it is concerned.
1. Convex - where the center is inside the polygon itself.
eg: circle, semicircle, square, rect. etc.
2. Concave - where it lies outside.
eg: moon shaped, hollow polygon, ring, etc.
The basic concept here is to take the co-ordinated of the convex one and keep on reducing it by a single unit, i.e. towards the center of the polygon. And then again draw out the shrunk polygon again. This way we will by default fillup the polygon just by shrinking the size of it and redrawing it inside.
For concave since the center lies outside, we need to break up it into smaller concave ones, and apply the above procedure on each of them.
Subscribe to:
Comments (Atom)