The following functions
are useful for working with angles and performing various trigonometric
calculations.
degrees
Converts angle units
from radians into degrees.
Syntax: |
degrees(Angle) |
Arguments: |
- Angle is the angle in radians that you
want to convert.
|
Examples: |
- degrees(PI) returns 180.
- degrees(PI/2) returns 90.
|
radians
Converts angle units
from degrees into radians.
Syntax: |
radians(Angle) |
Arguments: |
- Angle is the angle in degrees that you
want to convert.
|
Example: |
- radians(225) returns 3.927 (5*PI/4).
|
cos
Returns the cosine of
a given angle.
Syntax: |
cos(Angle) |
Arguments: |
- Angle is the angle in radians of which
you want the cosine.
|
Examples: |
- cos(0) returns 1.
- cos(PI / 3) returns 0.5.
- cos(frame / 10) * 100 yields the following curve:
|
sin
Returns the sine of a
given angle.
Syntax: |
sin(Angle) |
Arguments: |
- Angle is the angle in radians of which
you want the sine.
|
Examples: |
- sin(0) returns 0.
- sin(PI / 6) returns 0.5.
- sin(frame / 10) * 100 yields the following curve:
|
tan
Returns the tangent of
a given angle.
Syntax: |
tan(Angle) |
Arguments: |
- Angle is the angle in radians of which
you want the tangent.
|
Examples: |
- tan(0) returns 0.
- tan(PI / 4) returns 1.
- tan(PI / 3) returns 1.7321.
- tan(frame / 10) * 50 yields the following curve:
|
acos
Returns the arccosine—the
inverse function of the cosine—of a given number. The returned
angle is given in radians within the range 0 to PI.
Syntax: |
acos(Number) |
Arguments: |
- Number is the cosine of the angle you
want and must be between-1 and 1.
|
Examples: |
- acos(0.5) returns 1.0472 (PI/3 radians).
- degrees(acos(0.5)) returns 60.
|
asin
Returns the arcsine—the
inverse function of the sine—of a given number. The returned
angle is given in radians within the range -PI/2 to PI/2.
Syntax: |
asin(Number) |
Arguments: |
- Number is the sine of the angle you want
and must be between-1 and 1.
|
Examples: |
- asin(0.5) returns 0.5236 (PI/6 radians).
- degrees(asin(0.5)) returns 30.
|
atan
Returns the arctangent—the
inverse function of the tangent— of a given number. The
returned angle is given in radians within the range -PI/2 to PI/2.
Syntax: |
atan(Number) |
Arguments: |
- Number is the tangent of the angle you want.
|
Examples: |
- atan(1) returns 0.7854 (PI/4 radians).
- degrees(atan(1)) returns 45.
|
atan2
Returns the arctangent
of y/x, using the signs of both arguments to determine the quadrant
of the return value. The arctangent is the angle from the origin
to the vector (x,y). The returned angle is given in radians within the
range -PI to PI.
Syntax: |
atan2(x, y) |
Arguments: |
- x and y are the components of the vector
to be used in the function.
|
Examples: |
- atan2(1, 1) returns 0.7854 (PI/4 radians).
- atan2(-1, -1) returns -2.3562 (-3*PI/4 radians).
- atan2(1, 0) returns 1.5708 (PI/2 radians).
- degrees(atan2(1,1)) returns 45.
|