Graphics Reference
In-Depth Information
Function parameters specified as
angle
are assumed to be in units of
radians. In no case will any of these functions result in a divide by zero
error. If the divisor of a ratio is 0, then results will be undefined.
These functions all operate component-wise. The description shown in
Table B-1 is per component.
Table B-1
Angle and Trigonometry Functions
Syntax
Description
genType
radians
(genType
degrees
)
Converts
degrees
to radians, i.e., π/180 *
degrees.
genType
degrees
(genType
radians
)
Converts
radians
to degrees, i.e., 180/π *
radians.
genType
sin
(genType
angle
)
The standard trigonometric sine function.
Return values are in the range [-1, 1].
genType
cos
(genType
angle
)
The standard trigonometric cosine function.
Return values are in the range [-1, 1].
genType
tan
(genType
angle
)
The standard trigonometric tangent function.
genType
asin
(genType
x
)
Arc sine. Returns an angle whose sine is
x.
The range of values returned by this function
is [-π/2, π/2]. Results are undefined if |
x
|
>
1.
genType
acos
(genType
x
)
Arc cosine. Returns an angle with cosine
x.
The range of values returned by this function
is [0, π]. Results are undefined if |
x
| > 1.
genType
atan
(genType
y
,
genType
x
)
Arc tangent. Returns an angle with tangent
y/x.
The signs of
x
and
y
are used to determine
what quadrant the angle is in. The range of
values returned by this function is [-π, π].
Results are undefined if
x
and
y
are both 0.
genType
atan
(genType
y_over_x
)
Arc tangent. Returns an angle with tangent
y_over_x.
The range of values returned by this
function is [-π/2, π/2].
(continues)