Math.tan( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By 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 -figs/u03c0.gif/2 to figs/u03c0.gif/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 -figs/u03c0.gif/2, figs/u03c0.gif/2, -3figs/u03c0.gif/2, 3figs/u03c0.gif/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( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net