Sine,
cosine, and tangent are trigonometric functions that relate to the edge lengths
of the triangle. Let the length of the
hypotenuse, adjacent, and opposite sides be HYP, ADJ, and OPP respectively.

Some
people use the mnemonic SOH CAH TOA – meaning
sine is
opposite
over
hypotenuse,
cosine
is
adjacent
over
hypotenuse,
tangent
is
opposite
over
adjacent.
Example:
Consider
the following triangle:

To
determine θ,
simply apply the inverse trigonometric function:

In
code, you might write
- theta = atan(opp / adj);
or theta
= atan2(opp,
adj);
- Note: these functions return the angle in
radians. To convert to degrees, simply multiply by (180.0f
/ M_PI). Atan returns an angle defined on a 180 degree
domain (-pi/2, pi/2], atan2 returns
an angle defined on a 360 degree domain (-pi, pi].