are a complementary pair of
operators which convert angles to 2-vectors and vice-versa.
They are essential to most geometric and physical applications
since they correctly and unambiguously handle this conversion
in all cases except null vectors, even when the tangent of the
angle would be infinite.
returns a Cartesian unit vector in the direction
of the given angle, measured counter-clockwise from the positive
X-axis. The order of results on the stack, namely y
, permits the 2-vector data type to be additionally viewed
and used as a ratio approximating the tangent of the angle.
Thus the phrase FSINCOS F/
equivalent to FTAN
, but is useful over only a limited
and discontinuous range of angles, whereas FSINCOS
are useful for all angles.
The argument order for FATAN2
is the same, converting a
vector in the conventional representation to a scalar angle.
Thus, for all angles, FSINCOS FATAN2
is an identity
within the accuracy of the arithmetic and the argument range of
. Note that while FSINCOS
always returns a
valid unit vector, FATAN2
will accept any non-null vector.
An ambiguous condition exists if the vector argument to
has zero magnitude.