ActionScript for Flash MX: The Definitive Guide, Second Edition

ActionScript for Flash MX: The Definitive Guide, 2nd EditionBy Colin Moock
Chapter 18.  ActionScript Language Reference
Math.tan( ) Method Flash 5; can be used when exporting Flash 4 movies

compute the tangent of an angle

Math.tan(theta)

Arguments

theta

An angle, in radians (not degrees), normally in the range of -/2 to /2, although any angle will suffice, as tangent is a periodic function.

Returns

The tangent of theta (the result is in the range of -Infinity to Infinity).

Description

The tan( ) method returns the trigonometric tangent of an angle. In a right triangle, the tangent of an angle is the result of dividing the length of the side opposite the angle by the length of the side adjacent to the angle. This is also the same as the ratio Math.sin(theta)/Math.cos(theta), so as cos(theta) approaches zero, tan(theta) approaches Infinity. Therefore, tan(theta) is not calculable for the values -/2, /2, -3/2, 3/2, etc.

Example

trace (Math.tan(0)); // Displays: 0 trace (Math.tan(Math.PI/4)); // Displays: 1

See Also

Math.atan( ), Math.cos( ), Math.sin( )

    Категории