7 Programming with Q Parameters
7.3
Trigonometric Functions
Sine, cosine and tangent are the terms for the ratios of the sides of right
triangles. Trigonometric functions simplify many calculations.
For a right triangle,
Sine: sin a = a / c
Cosine: cos a = b I c
Tangent: tan a = a I b = sin a I cos
a
Where
l
c is the side opposite the right angle
l
a is the side opposite the angle
a
l
b is the third side
The angle can be derived from the tangent:
a = arctan
a
= arctan (a / b) = arctan (sin
a / cos a)
Example: a = 10 mm
b = IOmm
a
= arctan (a / b) = arctan 1 = 45”
Furthermore: a2 + b2 = c2 (a2 = a a)
c=l-xF-
Function
;;
saft key
FN6: SINE
e.g. FN6: Q20 = SIN -Q5
Calculate the sine of an angle in degrees (“1
and assign it to a parameter
FN7: COSINE
e.g. FN7: 021 = COS -Q5
Calculate the cosine of an angle in degrees (“1
and assign it to a parameter
FN8: ROOT SUM OF SQUARES
e.g. FN8: QIO = +5 LEN +4
Take the square root of the sum of two squares
and assign it to a parameter
FN13: ANGLE
e.g. FN13: 020 = +I0 ANG -Ql
Calculate the angle from the arc tangent of two
sides or from the sine and cosine of the angle
(0 - angle - 360”) and assign it to a parameter
b
1
Fig. 7.3:
Sides and angles on a right triangle _,
-
0
-
-
J
4
4
-/
7-8
TNC 370