How do the following trig functions work in this Objective-C code?

Can anyone who's decently versed in trig possibly explain what the math in this code is supposed to do? Why use sin instead of cos or tan? Why use cos instead of sin or tan? I understand what sin/cos/tan do in their most rudimentary forms, but as soon as they're slapped into animation type code such as below, I'm kind of lost.

 item.endPoint = CGPointMake(STARTPOINT.x + ENDRADIUS * sinf(i * M_PI_2 / (count - 1)), STARTPOINT.y - ENDRADIUS * cosf(i * M_PI_2 / (count - 1)));
 item.nearPoint = CGPointMake(STARTPOINT.x + NEARRADIUS * sinf(i * M_PI_2 / (count - 1)), STARTPOINT.y - NEARRADIUS * cosf(i * M_PI_2 / (count - 1)));
 item.farPoint = CGPointMake(STARTPOINT.x + FARRADIUS * sinf(i * M_PI_2 / (count - 1)), STARTPOINT.y - FARRADIUS * cosf(i * M_PI_2 / (count - 1)));

Answers


Since sin is opposite over hypotenuse, so also sin * hypotenuse is opposite. Given an angle and one side (the radius) the mini-formulae are working out the other side. Similarly cos is being used to get adjacent.


Need Your Help

Class is not generated from xsd using maven-jaxb2-plugin?

java web-services maven jaxb xsd

I have below xsd elements. I am using maven-jaxb2-plugin to generate sources.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.