Re: Obtaining all points on a line segment

2010-11-22 Thread Graham Cox
Hit testing of lines/paths can basically be done in two ways: a) mathematically, in that you determine whether a given point is close to a given line by calculation b) graphically, in that you draw the line into some image and test the pixel drawn. I've done quite a bit of work on this in the p

Re: Obtaining all points on a line segment

2010-11-22 Thread Dave DeLong
It seems to me that a simpler way to do this would be: - get the endpoints of the line - figure out the slope of the line - If the slope is <= 1, pull out the x coordinate of the test point. If the slope is > 1, use the y coordinate of the test point - using the algebra that you learned when you

Obtaining all points on a line segment

2010-11-22 Thread Cody Garvin
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 woul