Re: how to perform boolean operation on NSBezierPath
Re: how to perform boolean operation on NSBezierPath
- Subject: Re: how to perform boolean operation on NSBezierPath
- From: Greg Titus <email@hidden>
- Date: Wed, 27 Jun 2007 09:28:01 -0700
On Jun 27, 2007, at 7:20 AM, Alastair Houghton wrote:
I don't think that's what Aby meant.
I think the following may be more relevant:
http://www.cocoadev.com/index.pl?NSBezierPathcombinatorics
The problem of performing Boolean operations on arbitrary paths is
actually quite a difficult one to solve, and the algorithms
required for this type of operation are typically complicated and
expensive to run. If you can avoid it somehow (for instance by
using compositing to achieve the same effect) then you should
probably do so.
Absolutely. If you can think of another way to achieve what you want
to do, do it the other way. It's freaking hard to get right. Most
especially, if you deal with only lines and not curves, it's really
really easy. So if you can limit yourself to lines, definitely do that.
I wrote the initial algorithms for OmniGraffle, and then that needed
a thorough going over and significant rewrites by another really
smart programmer (hi Wim!), primarily for numerical issues. Beware
floating point imprecision on intersection points. Beware multiple
crossovers at the same location. Beware overlapping segments between
the paths that have to be treated specially, because when treated
naively they mean infinite intersections. Beware self-crossing paths
that lead to interior open bubbles using the even-odd fill rule.
Watch for excess move-to path components that move to the already
current position - some of NSBezierPath's operations tend to add
them, and you'll need to strip them out or ignore them when computing
combinations.
- Greg
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden