C# Class Nexus.MathUtility

Show file Open project: tgjones/nexus

Public Methods

Method Description
Acos ( float radians ) : float
Asin ( float sin ) : float
Atan2 ( float y, float x ) : float
Ceiling ( float value ) : int
Clamp ( byte value, byte min, byte max ) : byte

Clamps a value to an interval.

Clamp ( float value, float min, float max ) : float

Clamps a value to an interval.

Clamp ( int value, int min, int max ) : int

Clamps a value to an interval.

Cos ( float radians ) : float
Exp ( float value ) : float
Floor ( float value ) : int
IsZero ( float value ) : bool
Lerp ( byte value1, byte value2, float amount ) : byte

Interpolates linearly between the supplied values.

Lerp ( float value1, float value2, float amount ) : float

Interpolates linearly between the supplied values.

Lerp ( float value1, float value2, float startAmount, float endAmount, float amount ) : float
Lerp ( int value1, int value2, float amount ) : int

Interpolates linearly between the supplied values.

Log2 ( float d ) : float
Mod ( double a, double b ) : double

Returns a mod b. This differs from the % operator with respect to negative numbers.

Mod ( int a, int b ) : int

Returns a mod b. This differs from the % operator with respect to negative numbers.

PerspectiveInterpolate ( float value1, float value2, float w1, float w2, float amountRangeStart, float amountRangeEnd, float amount ) : float
Pow ( float x, float y ) : float
Quadratic ( float A, float B, float C, float &t0, float &t1 ) : bool
Round ( float value ) : int
Saturate ( float value ) : float
Sin ( float radians ) : float
SmoothStep ( float a, float b, float x ) : float

A smoothed step function. A cubic function is used to smooth the step between two thresholds.

Sqrt ( float value ) : float
Swap ( float &v1, float &v2 ) : void
Tan ( float radians ) : float
ToDegrees ( float radians ) : float
ToRadians ( float degrees ) : float

Method Details

Acos() public static method

public static Acos ( float radians ) : float
radians float
return float

Asin() public static method

public static Asin ( float sin ) : float
sin float
return float

Atan2() public static method

public static Atan2 ( float y, float x ) : float
y float
x float
return float

Ceiling() public static method

public static Ceiling ( float value ) : int
value float
return int

Clamp() public static method

Clamps a value to an interval.
public static Clamp ( byte value, byte min, byte max ) : byte
value byte The input parameter.
min byte The lower clamp threshold.
max byte The upper clamp threshold.
return byte

Clamp() public static method

Clamps a value to an interval.
public static Clamp ( float value, float min, float max ) : float
value float The input parameter.
min float The lower clamp threshold.
max float The upper clamp threshold.
return float

Clamp() public static method

Clamps a value to an interval.
public static Clamp ( int value, int min, int max ) : int
value int The input parameter.
min int The lower clamp threshold.
max int The upper clamp threshold.
return int

Cos() public static method

public static Cos ( float radians ) : float
radians float
return float

Exp() public static method

public static Exp ( float value ) : float
value float
return float

Floor() public static method

public static Floor ( float value ) : int
value float
return int

IsZero() public static method

public static IsZero ( float value ) : bool
value float
return bool

Lerp() public static method

Interpolates linearly between the supplied values.
public static Lerp ( byte value1, byte value2, float amount ) : byte
value1 byte The lower interpolation bound.
value2 byte The upper interpolation bound.
amount float The interpolation parameter.
return byte

Lerp() public static method

Interpolates linearly between the supplied values.
public static Lerp ( float value1, float value2, float amount ) : float
value1 float The lower interpolation bound.
value2 float The upper interpolation bound.
amount float The interpolation parameter.
return float

Lerp() public static method

public static Lerp ( float value1, float value2, float startAmount, float endAmount, float amount ) : float
value1 float
value2 float
startAmount float
endAmount float
amount float
return float

Lerp() public static method

Interpolates linearly between the supplied values.
public static Lerp ( int value1, int value2, float amount ) : int
value1 int The lower interpolation bound.
value2 int The upper interpolation bound.
amount float The interpolation parameter.
return int

Log2() public static method

public static Log2 ( float d ) : float
d float
return float

Mod() public static method

Returns a mod b. This differs from the % operator with respect to negative numbers.
public static Mod ( double a, double b ) : double
a double The dividend.
b double The divisor.
return double

Mod() public static method

Returns a mod b. This differs from the % operator with respect to negative numbers.
public static Mod ( int a, int b ) : int
a int The dividend.
b int The divisor.
return int

PerspectiveInterpolate() public static method

public static PerspectiveInterpolate ( float value1, float value2, float w1, float w2, float amountRangeStart, float amountRangeEnd, float amount ) : float
value1 float
value2 float
w1 float
w2 float
amountRangeStart float
amountRangeEnd float
amount float
return float

Pow() public static method

public static Pow ( float x, float y ) : float
x float
y float
return float

Quadratic() public static method

public static Quadratic ( float A, float B, float C, float &t0, float &t1 ) : bool
A float
B float
C float
t0 float
t1 float
return bool

Round() public static method

public static Round ( float value ) : int
value float
return int

Saturate() public static method

public static Saturate ( float value ) : float
value float
return float

Sin() public static method

public static Sin ( float radians ) : float
radians float
return float

SmoothStep() public static method

A smoothed step function. A cubic function is used to smooth the step between two thresholds.
public static SmoothStep ( float a, float b, float x ) : float
a float The lower threshold position.
b float The upper threshold position.
x float The input parameter.
return float

Sqrt() public static method

public static Sqrt ( float value ) : float
value float
return float

Swap() public static method

public static Swap ( float &v1, float &v2 ) : void
v1 float
v2 float
return void

Tan() public static method

public static Tan ( float radians ) : float
radians float
return float

ToDegrees() public static method

public static ToDegrees ( float radians ) : float
radians float
return float

ToRadians() public static method

public static ToRadians ( float degrees ) : float
degrees float
return float