Re: mathematical area of closed vector path
Re: mathematical area of closed vector path
- Subject: Re: mathematical area of closed vector path
- From: Tim Ramsey <email@hidden>
- Date: Tue, 25 Jan 2005 07:37:53 -0600
On Monday, January 24, 2005, at 08:14 PM, P. George wrote:
How would one go about figuring out the mathematical area (xxx units
squared) of a closed vector path?
Note: These paths will not be simple little boxes or circles. Think
complex paths--composed of mulitple line segments and arc segments
(both convex and concave).
Thanks.
- Philip
I saw a number of responses to this that involved complex geometry
calculations that may or may not work depending on the nature of the
path. A completely different approach is to compute an off-screen
bitmap representation of the content of the path. Color or flag each
pixel inside the area, then count the colored pixels. Scale the logical
size of the map to be big enough so that resolution gives you the
accuracy you need. You can determine if you are inside the region to
color a pixel by rasterizing and counting line crossings (if the count
is odd you are inside) or by keeping track of intersecting areas as you
erect the path. Of course, you can also skip building a special bitmap
if you have actually drawn the path on screen and the resolution is
good enough for your accuracy needs.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden