FROM : glenn andreas
DATE : Thu Apr 28 23:19:08 2005
On Apr 28, 2005, at 4:01 PM, Linea Tessile srl wrote:
>
> Hi people!
>
> Does anybody know how calculate the intersection point between two
> lines created using an NSBezierPath?
>
> Thanks,
> Alessandra
>
Since NSBezierPath's contain curves, there is no "the intersection
point". Even if both are just a single curve (and an NSBezierPath is
more like a complex polygon since it can contain multiple "line to"s
and "curve to"s, not to mention multiple discontinuous shapes - an
entire page of text outlines could be a single NSBezierPath), there
still isn't a single interesection point (I can think of a case that
gives six points of intersection).
You're best bet is to use bezierPathByFlatteningPath to get a bezier
path composed only of straight lines and then do standard line
intersection tests between each segment of each of the bezier paths
(and yes, this can get real expensive real quick).
Glenn Andreas <email_removed>
<http://www.gandreas.com/> oh my!
quadrium | build, mutate, evolve | images, textures, backgrounds, art
DATE : Thu Apr 28 23:19:08 2005
On Apr 28, 2005, at 4:01 PM, Linea Tessile srl wrote:
>
> Hi people!
>
> Does anybody know how calculate the intersection point between two
> lines created using an NSBezierPath?
>
> Thanks,
> Alessandra
>
Since NSBezierPath's contain curves, there is no "the intersection
point". Even if both are just a single curve (and an NSBezierPath is
more like a complex polygon since it can contain multiple "line to"s
and "curve to"s, not to mention multiple discontinuous shapes - an
entire page of text outlines could be a single NSBezierPath), there
still isn't a single interesection point (I can think of a case that
gives six points of intersection).
You're best bet is to use bezierPathByFlatteningPath to get a bezier
path composed only of straight lines and then do standard line
intersection tests between each segment of each of the bezier paths
(and yes, this can get real expensive real quick).
Glenn Andreas <email_removed>
<http://www.gandreas.com/> oh my!
quadrium | build, mutate, evolve | images, textures, backgrounds, art
| Related mails | Author | Date |
|---|---|---|
| Linea Tessile srl | Apr 28, 23:01 | |
| glenn andreas | Apr 28, 23:19 | |
| Mark Dawson | Apr 29, 04:24 | |
| Nicko van Someren | Apr 29, 10:53 | |
| Kay Roepke | Apr 29, 11:17 | |
| Shelby Davis | Apr 29, 14:43 | |
| p3consulting | Apr 29, 21:04 |






Cocoa mail archive

