home *** CD-ROM | disk | FTP | other *** search
- Organization: School of Computer Science, Carnegie Mellon, Pittsburgh, PA
- Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!at15+
- Newsgroups: sci.math
- Message-ID: <gf0S1Rq00iV1Q_M6IK@andrew.cmu.edu>
- Date: Wed, 11 Nov 1992 23:41:01 -0500
- From: Andrew Lewis Tepper <at15+@andrew.cmu.edu>
- Subject: Polygon Coloring
- Lines: 19
-
- I know that there must be a fast algorithm for coloring irregular
- polygons, but I can't seem to figure it out. I did come up with a slow
- algorithm (unimplemented, and unproven) which is as follows:
-
- Call the vertices in the polygon V0,V1,...,Vn where V0==Vn
- For each point P in the rectangle that encloses the polygon:
- List the angles formed by Vx \ P \ Vx+1 for 0<=x<=n. Express
- all angles in the range -PI < angle < PI. (If angle==PI, it's
- a boundary point.)
- Add the list of numbers. If they add to 0, the point is outside the
- polygon. Otherwise it's inside.
-
- Certainly there are optimizations; the easiest would be to plot the
- polygon, run the algorithm for one point, and do a seed fill for the
- rest. Is there a more elegant/faster algorithm than this? I want to do
- high speed graphics with this...
-
- Andy
-
-