math.tan
Shared
Returns the tangent of an angle given in radians
Syntax
local result = math.tan(
angle
)Parameters
| Type | Name | Description |
|---|---|---|
number | angle | Angle in radians |
Returns
| Type | Name | Description |
|---|---|---|
number | result | Tangent of angle |
Examples
local result = math.tan(0)
engine.print("info", result) -- 0.0local result = math.tan(math.rad(45))
engine.print("info", result) -- 1.0local result = math.tan(math.rad(-45))
engine.print("info", result) -- -1.0local angle_deg = 30
local slope = math.tan(math.rad(angle_deg))
engine.print("info", slope) -- 0.57735local distance = 100
local elevation_deg = 30
local height = distance * math.tan(math.rad(elevation_deg))
engine.print("info", height) -- 57.735local angle = math.rad(60)
local result = math.sin(angle) / math.cos(angle)
engine.print("info", result, math.tan(angle)) -- 1.7320 1.7320