Snipplr
http://snipplr.com/language/objective-c/tags/CGPoint
Recent snippets posted on Snipplr.comen-usSat, 27 May 2017 03:15:49 GMT(Objective C) How to find the distance between two CG points? - espinallab
http://snipplr.com/view/54359/how-to-find-the-distance-between-two-cg-points/
Distance between p1 and p2:
CGFloat xDist = (p2.x - p1.x);
CGFloat yDist = (p2.y - p1.y);
CGFloat distance = sqrt((xDist * xDist) + (yDist * yDist));
Background: Pythagorean theorem
Edit: if you only need to calculate if the distance between the points increases or decreases, you can omit the sqrt() which will make it a little faster. ]]>Wed, 25 May 2011 08:18:31 GMThttp://snipplr.com/view/54359/how-to-find-the-distance-between-two-cg-points/