Category Archives: Objective-C

During our latest project, we faced a number of problems that Trigonometry solved rather nicely. I found a number of Trigonometry resources, but not any that focused on how to implement these concepts in Objective-C. We thought it would be good to post some of the more helpful functions.

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 ); };

Posted in Objective-C | Tagged , , | 1 Comment

How to Convert Degrees to Radians, Radians to Degrees in Objective-C

CGFloat DegreesToRadians(CGFloat degrees) { return degrees * M_PI / 180; }; CGFloat RadiansToDegrees(CGFloat radians) { return radians * 180 / M_PI; };

Posted in Objective-C | Tagged , , | 1 Comment

Useful Trigonometry Functions in Objective-C

During our latest project, we faced a number of problems that Trigonometry solved rather nicely. I found a number of Trigonometry resources, but not any that focused on how to implement these concepts in Objective-C. We thought it would be … Continue reading »

Posted in Objective-C | Tagged , , | Comments Off