Arcade
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
GameAPI.Mathf Class Reference

Provides constants and static methods for floating point mathematics. More...

Static Public Member Functions

static float Sqrt (float val)
 Returns the square root of a specified number. More...
 
static float Cos (float radians)
 Returns the cosine of the specified angle. More...
 
static float Sin (float radians)
 Returns the sine of the specified angle. More...
 
static float Tan (float radians)
 Returns the tangent of the specified angle. More...
 
static float Atan2 (float y, float x)
 Returns the angle whose tangent is the quotient of two specified numbers. More...
 
static float Floor (float val)
 Returns the largest integer less than or equal to the specified single-precision floating-point number. More...
 
static int FloorToInt (float val)
 Returns the largest integer less than or equal to the specified single-precision floating-point number. More...
 
static float Round (float val)
 Rounds a single-precision floating-point value to the nearest integral value. More...
 
static int RoundToInt (float val)
 Rounds a single-precision floating-point value to the nearest integral value. More...
 
static float Ceiling (float val)
 Returns the smallest integer greater than or equal to the specified single-precision floating-point number. More...
 
static int CeilingToInt (float val)
 Returns the smallest integer greater than or equal to the specified single-precision floating-point number. More...
 
static float Pow (float val, float pow)
 Returns a specified number raised to the specified power. More...
 
static float Clamp (float val, float min, float max)
 Returns val if it is between min and max , otherwise it returns whichever of those two bounds it is closest to. More...
 
static int Clamp (int val, int min, int max)
 Returns val if it is between min and max , otherwise it returns whichever of those two bounds it is closest to. More...
 
static float Log (float val)
 Returns the natural (base e) logarithm of a specified number. More...
 
static float Log (float val, float newBase)
 Returns the logarithm of a specified number in a specified base. More...
 
static float Random ()
 Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0. More...
 
static int Random (int max)
 Returns a non-negative random integer that is less than the specified maximum. More...
 
static int Random (int min, int max)
 Returns a random integer that is within a specified range. More...
 
static float Random (float max)
 Returns a random floating-point number that is greater than or equal to 0.0, and less than max . More...
 
static float Random (float min, float max)
 Returns a random floating-point number that is greater than or equal to min , and less than max . More...
 
static Vector2F RandomUnitVector ()
 Returns a normalized floating-point vector pointing in a uniformly random direction. More...
 
static Vector2F RandomVector ()
 Returns a random floating-point vector with X and Y components in the range [0-1]. More...
 
static bool LinesIntersect (Vector2F a0, Vector2F a1, Vector2F b0, Vector2F b1)
 Returns true if and only if the two given line segments intersect. More...
 
static bool LinesIntersect (Vector2F a0, Vector2F a1, Vector2F b0, Vector2F b1, out Vector2F pos)
 Returns true if and only if the two given line segments intersect. If an intersection is found the pos parameter will be set to the intersection position, otherwise it is set to the position where the lines would intersect if they were infinitely long. For parallel lines, pos is set to the zero vector. More...
 

Public Attributes

const float PI = (float) Math.PI
 Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π. More...
 

Detailed Description

Provides constants and static methods for floating point mathematics.

Member Function Documentation

static float GameAPI.Mathf.Atan2 ( float  y,
float  x 
)
inlinestatic

Returns the angle whose tangent is the quotient of two specified numbers.

static float GameAPI.Mathf.Ceiling ( float  val)
inlinestatic

Returns the smallest integer greater than or equal to the specified single-precision floating-point number.

static int GameAPI.Mathf.CeilingToInt ( float  val)
inlinestatic

Returns the smallest integer greater than or equal to the specified single-precision floating-point number.

static float GameAPI.Mathf.Clamp ( float  val,
float  min,
float  max 
)
inlinestatic

Returns val if it is between min and max , otherwise it returns whichever of those two bounds it is closest to.

Parameters
valValue to clamp.
minLower bound.
maxUpper bound.
Returns
The clamped value.
static int GameAPI.Mathf.Clamp ( int  val,
int  min,
int  max 
)
inlinestatic

Returns val if it is between min and max , otherwise it returns whichever of those two bounds it is closest to.

Parameters
valValue to clamp.
minLower bound.
maxUpper bound.
Returns
The clamped value.
static float GameAPI.Mathf.Cos ( float  radians)
inlinestatic

Returns the cosine of the specified angle.

static float GameAPI.Mathf.Floor ( float  val)
inlinestatic

Returns the largest integer less than or equal to the specified single-precision floating-point number.

static int GameAPI.Mathf.FloorToInt ( float  val)
inlinestatic

Returns the largest integer less than or equal to the specified single-precision floating-point number.

static bool GameAPI.Mathf.LinesIntersect ( Vector2F  a0,
Vector2F  a1,
Vector2F  b0,
Vector2F  b1 
)
inlinestatic

Returns true if and only if the two given line segments intersect.

Parameters
a0Start of the first line.
a1End of the first line.
b0Start of the second line.
b1End of the second line.
static bool GameAPI.Mathf.LinesIntersect ( Vector2F  a0,
Vector2F  a1,
Vector2F  b0,
Vector2F  b1,
out Vector2F  pos 
)
inlinestatic

Returns true if and only if the two given line segments intersect. If an intersection is found the pos parameter will be set to the intersection position, otherwise it is set to the position where the lines would intersect if they were infinitely long. For parallel lines, pos is set to the zero vector.

Parameters
a0Start of the first line.
a1End of the first line.
b0Start of the second line.
b1End of the second line.
posSet to the intersection position if one exists.
static float GameAPI.Mathf.Log ( float  val)
inlinestatic

Returns the natural (base e) logarithm of a specified number.

static float GameAPI.Mathf.Log ( float  val,
float  newBase 
)
inlinestatic

Returns the logarithm of a specified number in a specified base.

static float GameAPI.Mathf.Pow ( float  val,
float  pow 
)
inlinestatic

Returns a specified number raised to the specified power.

static float GameAPI.Mathf.Random ( )
inlinestatic

Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.

static int GameAPI.Mathf.Random ( int  max)
inlinestatic

Returns a non-negative random integer that is less than the specified maximum.

static int GameAPI.Mathf.Random ( int  min,
int  max 
)
inlinestatic

Returns a random integer that is within a specified range.

Parameters
minThe inclusive lower bound of the random number returned.
maxThe exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.
static float GameAPI.Mathf.Random ( float  max)
inlinestatic

Returns a random floating-point number that is greater than or equal to 0.0, and less than max .

Parameters
maxThe exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.
static float GameAPI.Mathf.Random ( float  min,
float  max 
)
inlinestatic

Returns a random floating-point number that is greater than or equal to min , and less than max .

Parameters
minThe inclusive lower bound of the random number returned.
maxThe exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.
static Vector2F GameAPI.Mathf.RandomUnitVector ( )
inlinestatic

Returns a normalized floating-point vector pointing in a uniformly random direction.

static Vector2F GameAPI.Mathf.RandomVector ( )
inlinestatic

Returns a random floating-point vector with X and Y components in the range [0-1].

static float GameAPI.Mathf.Round ( float  val)
inlinestatic

Rounds a single-precision floating-point value to the nearest integral value.

static int GameAPI.Mathf.RoundToInt ( float  val)
inlinestatic

Rounds a single-precision floating-point value to the nearest integral value.

static float GameAPI.Mathf.Sin ( float  radians)
inlinestatic

Returns the sine of the specified angle.

static float GameAPI.Mathf.Sqrt ( float  val)
inlinestatic

Returns the square root of a specified number.

static float GameAPI.Mathf.Tan ( float  radians)
inlinestatic

Returns the tangent of the specified angle.

Member Data Documentation

const float GameAPI.Mathf.PI = (float) Math.PI

Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.