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.
people use the mnemonic SOH CAH TOA – meaning s
ine is o
the following triangle:
simply apply the inverse trigonometric function:
code, you might write
- theta = atan(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].