Re: Select a NSBezierPath
Re: Select a NSBezierPath
- Subject: Re: Select a NSBezierPath
- From: Robert Clair <email@hidden>
- Date: Tue, 21 Sep 2004 20:03:36 -0400
Handling wide lines is not that much harder. When you tessellate the
curve you end up approximating the curve near the hit point with line
segments. A simple calculation of the distance from the mouse point
to that line segment (note if just do a point-to-line calculation you
can get it wrong) will tell you if you are within the distance needed
to hit the stroke of the curve.
Filled shapes is pretty much the same idea. When you tessellate the
curve you end up with a polygon and point-in-polygon tests are pretty
easy. Similar techniques can be used for hit testing things like end
caps, mitre joins, etc... FreeHand (and I would presume Illustrator)
used these kinds of techniques for hit testing all the time. With some
professional vector illustrations, even on relatively modern hardware,
documents can become complex enough for the "draw it to see what you
hit" method to be effective.
I *know* how to do it. (Those were rhetorical questions. :-) ) I just
think that doing it and accounting
for line ends and joins, etc is way too much trouble. Especially
considering that, if you have designed
you objects carefully, you can do the other using a lot of the same
code that you use to render to the screen.
Anyway, a moot point for me. A lot of my objects aren't susceptible to
the analytic method.
.....Bob Clair
_______________________________________________
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