• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Re: Re: Tracking rectangles and bezier paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Re: Tracking rectangles and bezier paths


  • Subject: Re: Re: Re: Tracking rectangles and bezier paths
  • From: "Michael Ash" <email@hidden>
  • Date: Fri, 8 Sep 2006 20:06:50 -0400

On 9/8/06, Wagner Truppel <email@hidden> wrote:
It's not as hard a math problem as suggested, even if the curve is
not monotonic. Recall that the entire bezier path is contained within
the convex hull of the path's control points so a very simple
solution is to retrieve the control points, compute their convex hull
(which is a convex polygon, in 2 dimensions), and use that as your
tracking area. Computing convex hulls in 2 dimensions is almost
trivial - any decent book on algorithms will tell you how.

And if your goal is to track a margin around the path itself then it can be done even easier. Simply create a 1x1 NSImage, lock focus on it, apply an appropriate affine transform, then draw your path and see if the single pixel in the image was altered. For a margin, simply increase the path's width when drawing for the hit test.

Mike
_______________________________________________
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


References: 
 >Re: Re: Tracking rectangles and bezier paths (From: Wagner Truppel <email@hidden>)

  • Prev by Date: Re: Re: Re: How do I get the NSApplication of other running applications?
  • Next by Date: [Moderator] EOT Re: How do I get the NSApplication of other running applications?
  • Previous by thread: Re: Re: Tracking rectangles and bezier paths
  • Next by thread: Re: Re: Re: Tracking rectangles and bezier paths
  • Index(es):
    • Date
    • Thread