math.asin
Shared
Returns the arc sine of a number in radians
Syntax
local result = math.asin(
value
)Parameters
| Type | Name | Description |
|---|---|---|
number | value | Sine value in the range [-1, 1] |
Returns
| Type | Name | Description |
|---|---|---|
number | result | Arc sine in radians, in the range [-pi/2, pi/2] |
Examples
local result = math.asin(0)
engine.print("info", result) -- 0.0local result = math.asin(1)
engine.print("info", result) -- 1.5707963267949local result = math.deg(math.asin(0.5))
engine.print("info", result) -- 30.0local result = math.asin(-1)
engine.print("info", result) -- -1.5707963267949local dir_y = 0.866 -- sin(60 degrees)
local angle_deg = math.deg(math.asin(dir_y))
engine.print("info", angle_deg) -- 59.999local angle = math.pi / 6
local result = math.asin(math.sin(angle))
engine.print("info", result) -- 0.5235987755983