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)));
Since sin is
oppositeoverhypotenuse, so alsosin * hypotenuseisopposite. Given an angle and one side (the radius) the mini-formulae are working out the other side. Similarly cos is being used to getadjacent.