Cerberus X Documentation

Module cerberus.math

The math module provides math related constants and functions. More...

Declarations

Imported By
cerberus
Please note that only documented modules are listed here, there might be undocumented modules that import this one.
Constants
HALFPI : Float
PI : Float
TWOPI : Float
Functions
ACos : Float ( x:Float ) Returns the arc cosine of x, in degrees.
ACosr : Float ( x:Float ) Returns the arc cosine of x, in radians.
ASin : Float ( x:Float ) Returns the arc sine of x, in degrees.
ASinr : Float ( x:Float ) Returns the arc sine of x, in radians.
ATan : Float ( x:Float ) Returns the arc tangent of x, in degrees.
ATan2 : Float ( y:Float, x:Float ) Returns the arc tangent of x / y, in degrees ranging from -180 to +180.
ATan2r : Float ( y:Float, x:Float ) Returns the arc tangent of x / y, in radians ranging from -PI to +PI.
ATanr : Float ( x:Float ) Returns the arc tangent of x, in radians.
Abs : Float ( x:Float ) Returns the absolute value of x, that is, +x if x>=0 and -x if x<0.
Abs : Int ( x:Int ) Returns the absolute value of x, that is, +x if x>=0 and -x if x<0.
Ceil : Float ( x:Float ) Returns the smallest integral value that is not less than x.
Clamp : Float ( x:Float, min:Float, max:Float ) Clamps x to the range min through max inclusive.
Clamp : Int ( x:Int, min:Int, max:Int ) Clamps x to the range min through max inclusive.
Cos : Float ( x:Float ) Returns the cosine of x degrees.
Cosr : Float ( x:Float ) Returns the cosine of x radians.
Exp : Float ( x:Float ) Returns the base-e exponential function of x, which is the e number raised to the power x.
Floor : Float ( x:Float ) Returns the largest integral value that is not greater than x.
Log : Float ( x:Float ) Returns the natural logarithm of x.
Max : Float ( x:Float, y:Float ) Returns the maximum of x and y.
Max : Int ( x:Int, y:Int ) Returns the maximum of x and y.
Min : Float ( x:Float, y:Float ) Returns the minimum of x and y.
Min : Int ( x:Int, y:Int ) Returns the minimum of x and y.
Pow : Float ( x:Float, y:Float ) Returns x raised to the power y.
Sgn : Float ( x:Float ) Returns -1 if x is less than zero, +1 if x is greater than zero or 0 if x is equal to zero.
Sgn : Int ( x:Int ) Returns -1 if x is less than zero, +1 if x is greater than zero or 0 if x is equal to zero.
Sin : Float ( x:Float ) Returns the sine of x degrees.
Sinr : Float ( x:Float ) Returns the sine of x radians.
Sqrt : Float ( x:Float ) Returns the square root of x.
Tan : Float ( x:Float ) Returns the tangent of x degrees.
Tanr : Float ( x:Float ) Returns the tangent of x radians.

Detailed Discussion

The math module provides math related constants and functions.


Constants Documentation


Functions Documentation

Function ACos : Float ( x:Float )

Returns the arc cosine of x, in degrees.

Params:

x - floating point value in the range -1 to 1 (inclusive).

Function ACosr : Float ( x:Float )

Returns the arc cosine of x, in radians.

Params:

x - floating point value in the range -1 to 1 (inclusive).

Function ASin : Float ( x:Float )

Returns the arc sine of x, in degrees.

Params:

x - floating point value in the range -1 to 1 (inclusive).

Function ASinr : Float ( x:Float )

Returns the arc sine of x, in radians.

Params:

x - floating point value in the range -1 to 1 (inclusive).

Function ATan : Float ( x:Float )

Returns the arc tangent of x, in degrees.

Params:

x - floating point value in the range -1 to 1 (inclusive).

Function ATan2 : Float ( y:Float, x:Float )

Returns the arc tangent of x / y, in degrees ranging from -180 to +180.

The function uses the signs of x and y to compute the correct quadrant for the result.

Print Atan2(0,1) ' 0
Print Atan2(1,1) ' 45
Print Atan2(1,0) ' 90
Print Atan2(-1,0) ' -90

Params:

x, y - floating point values.

Function ATan2r : Float ( y:Float, x:Float )

Returns the arc tangent of x / y, in radians ranging from -PI to +PI.

The function uses the signs of x and y to compute the correct quadrant for the result.

Print Atan2r(0,1) ' 0
Print Atan2r(1,1) ' approx PI/4
Print Atan2r(1,0) ' approx PI/2
Print Atan2r(-1,0) ' approx -PI/2

Params:

x, y - floating point values.

Function ATanr : Float ( x:Float )

Returns the arc tangent of x, in radians.

Params:

x - floating point value in the range -1 to 1 (inclusive).

Function Abs : Float ( x:Float )

Returns the absolute value of x, that is, +x if x>=0 and -x if x<0.

Params:

x - input value.

Function Abs : Int ( x:Int )

Returns the absolute value of x, that is, +x if x>=0 and -x if x<0.

Params:

x - input value.

Function Ceil : Float ( x:Float )

Returns the smallest integral value that is not less than x.

Params:

x - floatint point value.

Function Clamp : Float ( x:Float, min:Float, max:Float )

Clamps x to the range min through max inclusive.

Params:

x - value to clamp

min - minimum returnable value

max - maximum returnable value

Function Clamp : Int ( x:Int, min:Int, max:Int )

Clamps x to the range min through max inclusive.

Params:

x - value to clamp

min - minimum returnable value

max - maximum returnable value

Function Cos : Float ( x:Float )

Returns the cosine of x degrees.

Params:

x - angle in degrees.

Function Cosr : Float ( x:Float )

Returns the cosine of x radians.

Params:

x - angle in radians.

Function Exp : Float ( x:Float )

Returns the base-e exponential function of x, which is the e number raised to the power x.

Params:

x - floating point value.

Function Floor : Float ( x:Float )

Returns the largest integral value that is not greater than x.

Params:

x - floating point value.

Function Log : Float ( x:Float )

Returns the natural logarithm of x.

Params:

2x - floating point value.

Function Max : Float ( x:Float, y:Float )

Returns the maximum of x and y.

Params:

x, y - input values.

Function Max : Int ( x:Int, y:Int )

Returns the maximum of x and y.

Params:

x, y - input values.

Function Min : Float ( x:Float, y:Float )

Returns the minimum of x and y.

Params:

x, y - input values.

Function Min : Int ( x:Int, y:Int )

Returns the minimum of x and y.

Params:

x, y - input values.

Function Pow : Float ( x:Float, y:Float )

Returns x raised to the power y.

Params:

x, y - float point values.

Function Sgn : Float ( x:Float )

Returns -1 if x is less than zero, +1 if x is greater than zero or 0 if x is equal to zero.

Params:

x - input value.

Function Sgn : Int ( x:Int )

Returns -1 if x is less than zero, +1 if x is greater than zero or 0 if x is equal to zero.

Params:

x - input value.

Function Sin : Float ( x:Float )

Returns the sine of x degrees.

Params:

x - angle in degrees.

Function Sinr : Float ( x:Float )

Returns the sine of x radians.

Params:

x - angle in radians.

Function Sqrt : Float ( x:Float )

Returns the square root of x.

Params:

x - floatint point value.

Function Tan : Float ( x:Float )

Returns the tangent of x degrees.

Params:

x - angle in degrees.

Function Tanr : Float ( x:Float )

Returns the tangent of x radians.

Params:

x - angle in radians.