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 );
};
Tags: Graphics, Objective-C, Trigonometry

