Re: Remove overlap on NSBezierPath
Re: Remove overlap on NSBezierPath
- Subject: Re: Remove overlap on NSBezierPath
- From: Jens Alfke <email@hidden>
- Date: Mon, 14 Jul 2008 08:06:40 -0700
On 14 Jul '08, at 5:26 AM, Robert Clair wrote:
The basic algorithm is conceptually simple:
1.) find all the intersections
2.) break into pieces at the intersections
3.) decide which pieces you need on the basis of some in/out tests
and which set operation you are doing.
4.) assemble the final result
The hitch is that #3 is a bunch of yes/no decisions that you must
make on the basis of imprecise floating point operations in #1. And
all the results of #3 have to be consistent or #4 won't work
properly. This is trivial in the easy cases (curves intersecting at
reasonable angles, no tiny pieces) but *VERY* hard to get right for
the arbitrary case
That was my experience exactly :) Task #3 is one of those things that
seems obvious to a human, but is surprisingly complex to describe to a
computer. Unfortunately I don't remember the name of the algorithm I
used, but it took a good-sized academic article to describe. It was
very prone to problems with edge [sic] cases, like two intersections
at almost but not quite the same point, or intersections of almost-
parallel lines. (An earlier algorithm I tried was simpler but turned
out to fail on vertical lines!)
I don't mean to suggest this is impossible, but everyone's development
resources are limited, and there are other features you [the OP] could
implement instead that would give you more bang for the buck.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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