Table of Contents

Class MathUtils

Namespace
Alis.Core.Physic.Dynamics
Assembly
Alis.dll

The math utils class

public static class MathUtils

Inheritance

Inherited Members

Properties

Epsilon

Gets or sets the value of the epsilon

public static float Epsilon { get; set; }

Property Value

float

Methods

Abs(Vector2)

Abses the v

public static Vector2 Abs(Vector2 v)

Parameters

v Vector2

The

Returns

Vector2

The vector

Area(Vector2, Vector2, Vector2)

Returns a positive number if c is to the left of the line going from a to b.

public static float Area(Vector2 a, Vector2 b, Vector2 c)

Parameters

a Vector2
b Vector2
c Vector2

Returns

float

Positive number if point is left, negative if point is right, and 0 if points are collinear.

Area(ref Vector2, ref Vector2, ref Vector2)

Returns a positive number if c is to the left of the line going from a to b.

public static float Area(ref Vector2 a, ref Vector2 b, ref Vector2 c)

Parameters

a Vector2
b Vector2
c Vector2

Returns

float

Positive number if point is left, negative if point is right, and 0 if points are collinear.

Clamp(int, int, int)

Clamps the a

public static int Clamp(int a, int low, int high)

Parameters

a int

The

low int

The low

high int

The high

Returns

int

The int

Clamp(float, float, float)

Clamps the a

public static float Clamp(float a, float low, float high)

Parameters

a float

The

low float

The low

high float

The high

Returns

float

The float

Clamp(Vector2, Vector2, Vector2)

Clamps the a

public static Vector2 Clamp(Vector2 a, Vector2 low, Vector2 high)

Parameters

a Vector2

The

low Vector2

The low

high Vector2

The high

Returns

Vector2

The

Cross(ref Vector2, ref Vector2)

Crosses the a

public static float Cross(ref Vector2 a, ref Vector2 b)

Parameters

a Vector2

The

b Vector2

The

Returns

float

The float

Cross(Vector2, Vector2)

Crosses the a

public static float Cross(Vector2 a, Vector2 b)

Parameters

a Vector2

The

b Vector2

The

Returns

float

The float

Cross(ref Vector3, ref Vector3)

public static Vector3 Cross(ref Vector3 a, ref Vector3 b)

Parameters

a Vector3
b Vector3

Returns

Vector3

Cross(Vector2, float)

Crosses the a

public static Vector2 Cross(Vector2 a, float s)

Parameters

a Vector2

The

s float

The

Returns

Vector2

The vector

Cross(float, ref Vector2)

Crosses the s

public static Vector2 Cross(float s, ref Vector2 a)

Parameters

s float

The

a Vector2

The

Returns

Vector2

The vector

Cross(ref Vector2, ref Vector2, out float)

Crosses the a

public static void Cross(ref Vector2 a, ref Vector2 b, out float c)

Parameters

a Vector2

The

b Vector2

The

c float

The

Dot(Vector3, Vector3)

public static float Dot(Vector3 a, Vector3 b)

Parameters

a Vector3
b Vector3

Returns

float

Dot(Vector2, ref Vector2)

public static float Dot(Vector2 a, ref Vector2 b)

Parameters

a Vector2
b Vector2

Returns

float

FloatEquals(float, float)

Describes whether float equals

public static bool FloatEquals(float value1, float value2)

Parameters

value1 float

The value

value2 float

The value

Returns

bool

The bool

FloatEquals(float, float, float)

Checks if a floating point Value is equal to another, within a certain tolerance.

public static bool FloatEquals(float value1, float value2, float delta)

Parameters

value1 float

The first floating point Value.

value2 float

The second floating point Value.

delta float

The floating point tolerance.

Returns

bool

True if the values are "equal", false otherwise.

FloatInRange(float, float, float)

Checks if a floating point Value is within a specified range of values (inclusive).

public static bool FloatInRange(float value, float min, float max)

Parameters

value float

The Value to check.

min float

The minimum Value.

max float

The maximum Value.

Returns

bool

True if the Value is within the range specified, false otherwise.

IsCollinear(ref Vector2, ref Vector2, ref Vector2, float)

Determines if three vertices are collinear (ie. on a straight line)

public static bool IsCollinear(ref Vector2 a, ref Vector2 b, ref Vector2 c, float tolerance = 0)

Parameters

a Vector2

First vertex

b Vector2

Second vertex

c Vector2

Third vertex

tolerance float

The tolerance

Returns

bool

IsValid(float)

This function is used to ensure that a floating point number is not a NaN or infinity.

public static bool IsValid(float x)

Parameters

x float

The x.

Returns

bool

true if the specified x is valid; otherwise, false.

IsValid(Vector2)

Describes whether is valid

public static bool IsValid(this Vector2 x)

Parameters

x Vector2

The

Returns

bool

The bool

Mul(ref Mat22, Vector2)

Muls the a

public static Vector2 Mul(ref Mat22 A, Vector2 v)

Parameters

A Mat22

The

v Vector2

The

Returns

Vector2

The vector

Mul(ref Mat22, ref Vector2)

Muls the a

public static Vector2 Mul(ref Mat22 A, ref Vector2 v)

Parameters

A Mat22

The

v Vector2

The

Returns

Vector2

The vector

Mul(Mat33, Vector3)

public static Vector3 Mul(Mat33 A, Vector3 v)

Parameters

A Mat33
v Vector3

Returns

Vector3

Mul22(Mat33, Vector2)

public static Vector2 Mul22(Mat33 A, Vector2 v)

Parameters

A Mat33
v Vector2

Returns

Vector2

MulT(ref Mat22, Vector2)

Muls the t using the specified a

public static Vector2 MulT(ref Mat22 A, Vector2 v)

Parameters

A Mat22

The

v Vector2

The

Returns

Vector2

The vector

MulT(ref Mat22, ref Vector2)

Muls the t using the specified a

public static Vector2 MulT(ref Mat22 A, ref Vector2 v)

Parameters

A Mat22

The

v Vector2

The

Returns

Vector2

The vector

Rot270(ref Vector2)

Rots the 270 using the specified a

public static Vector2 Rot270(ref Vector2 a)

Parameters

a Vector2

The

Returns

Vector2

The vector

Rot90(ref Vector2)

Rots the 90 using the specified a

public static Vector2 Rot90(ref Vector2 a)

Parameters

a Vector2

The

Returns

Vector2

The vector

Skew(Vector2)

public static Vector2 Skew(Vector2 input)

Parameters

input Vector2

Returns

Vector2

Swap<T>(ref T, ref T)

Swaps the a

public static void Swap<T>(ref T a, ref T b)

Parameters

a T

The

b T

The

Type Parameters

T

The

VectorAngle(ref Vector2, ref Vector2)

Return the angle between two vectors on a plane The angle is from vector 1 to vector 2, positive anticlockwise The result is between -pi -> pi

public static double VectorAngle(ref Vector2 p1, ref Vector2 p2)

Parameters

p1 Vector2
p2 Vector2

Returns

double

VectorAngle(Vector2, Vector2)

Vectors the angle using the specified p 1

public static double VectorAngle(Vector2 p1, Vector2 p2)

Parameters

p1 Vector2

The

p2 Vector2

The

Returns

double

The double