Calculate Distance Between Two Points in Objective-C

How to calculate the distance between two points.

CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
{
CGFloat dx = point2.x - point1.x;
CGFloat dy = point2.y - point1.y;
return sqrt(dx*dx + dy*dy );
};

This entry was posted in Objective-C and tagged , , . Bookmark the permalink.

One Response to Calculate Distance Between Two Points in Objective-C

  1. Pingback: Recent URLs tagged Objectivec - Urlrecorder

Leave a Reply