The hypotenuse is the side opposite the 90-degree angle in a right triangle. It provides the reference length for sine and cosine: sine compares the opposite side with the hypotenuse, while cosine compares the adjacent side with it. section 9.1.1 section 1.4.8
Use the hypotenuse as the denominator when identifying these right-triangle ratios:
- sin(θ) = opposite ÷ hypotenuse. section 9.1.1
- cos(θ) = adjacent ÷ hypotenuse. section 9.1.1
- tan(θ) does not use the hypotenuse; it compares opposite with adjacent. section 1.4.8
Positioning a radial-menu item
When JavaScript places menu items around a circle, cosine calculates the horizontal component and sine calculates the vertical component. With a center at (100, 100), a radius of 70px, and angle 0, the item position becomes x = 150 and y = 80 after centering a 40px item. section 1.4.8
Figure 9.1 A right triangle and its sides relative to the angle theta (θ)
Use the right-triangle diagram to identify the hypotenuse relative to angle θ and distinguish it from the opposite and adjacent sides. section 9.1.1
