• 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
Obtaining all points on a line segment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Obtaining all points on a line segment


  • Subject: Obtaining all points on a line segment
  • From: Cody Garvin <email@hidden>
  • Date: Mon, 22 Nov 2010 08:12:58 -0800

Hi all,

I searched back through 2005 in the Cocoa Mailing List and didn't see any requests for this.

We need all the points on a line / arc / path on the screen. We need to do hit detection on stroked line, so we must know if the point is valid or not.

I thought using CGPathContainsPoint would work, but it must be done on a closed path or it returns true on all points in the test area.

I also tried NSBezierPath containsPath: and , but it returned the exact same things as the CGPath functions.

Another idea I have, though not sure if it will work, is converting the drawing to NSBitmapImageRep and using colorAtX:y to test for a specific color to test for a point.

The downside of this approach is you must test all the points in a bounding box, and could get quite large if our line segment is complicated.

I'm surprised I haven't found a convenience method to return all the points in an outline.

Any help would be greatly appreciated.

- Cody_______________________________________________

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

  • Follow-Ups:
    • Re: Obtaining all points on a line segment
      • From: Graham Cox <email@hidden>
    • Re: Obtaining all points on a line segment
      • From: Dave DeLong <email@hidden>
References: 
 >Core data fetch and multithreading (From: vincent habchi <email@hidden>)
 >Re: Core data fetch and multithreading (From: Quincey Morris <email@hidden>)
 >Re: Core data fetch and multithreading (From: vincent habchi <email@hidden>)
 >Re: Core data fetch and multithreading (From: Quincey Morris <email@hidden>)
 >Re: Core data fetch and multithreading (From: Hunter Hillegas <email@hidden>)

  • Prev by Date: Re: Help diagnosing networking/internet performance issues
  • Next by Date: Odd problem with event taps when job is killed
  • Previous by thread: Re: Core data fetch and multithreading
  • Next by thread: Re: Obtaining all points on a line segment
  • Index(es):
    • Date
    • Thread