Ctrl+K

MathUtils

Declaration

public static class tainicom.Aether.Physics2D.Common.MathUtils

Methods

Cross static

float Cross(ref Vector2 a, ref Vector2 b)

Parameters:

Name Type Description
a ref Strawberry.Math.Vector2
b ref Strawberry.Math.Vector2

Cross static

float Cross(Vector2 a, Vector2 b)

Parameters:

Name Type Description
a Strawberry.Math.Vector2
b Strawberry.Math.Vector2

Cross static

Vector3 Cross(ref Vector3 a, ref Vector3 b)

Parameters:

Name Type Description
a ref Strawberry.Math.Vector3
b ref Strawberry.Math.Vector3

Cross static

Vector2 Cross(Vector2 a, float s)

Parameters:

Name Type Description
a Strawberry.Math.Vector2
s System.Single

Rot270 static

Vector2 Rot270(ref Vector2 a)

Parameters:

Name Type Description
a ref Strawberry.Math.Vector2

Cross static

Vector2 Cross(float s, ref Vector2 a)

Parameters:

Name Type Description
s System.Single
a ref Strawberry.Math.Vector2

Rot90 static

Vector2 Rot90(ref Vector2 a)

Parameters:

Name Type Description
a ref Strawberry.Math.Vector2

Abs static

Vector2 Abs(Vector2 v)

Parameters:

Name Type Description
v Strawberry.Math.Vector2

Mul static

Vector2 Mul(ref Mat22 A, Vector2 v)

Parameters:

Name Type Description
A ref tainicom.Aether.Physics2D.Common.Mat22
v Strawberry.Math.Vector2

Mul static

Vector2 Mul(ref Mat22 A, ref Vector2 v)

Parameters:

Name Type Description
A ref tainicom.Aether.Physics2D.Common.Mat22
v ref Strawberry.Math.Vector2

MulT static

Vector2 MulT(ref Mat22 A, Vector2 v)

Parameters:

Name Type Description
A ref tainicom.Aether.Physics2D.Common.Mat22
v Strawberry.Math.Vector2

MulT static

Vector2 MulT(ref Mat22 A, ref Vector2 v)

Parameters:

Name Type Description
A ref tainicom.Aether.Physics2D.Common.Mat22
v ref Strawberry.Math.Vector2

MulT static

void MulT(ref Mat22 A, ref Mat22 B, out Mat22 C)

Parameters:

Name Type Description
A ref tainicom.Aether.Physics2D.Common.Mat22
B ref tainicom.Aether.Physics2D.Common.Mat22
C out tainicom.Aether.Physics2D.Common.Mat22

Mul static

Vector3 Mul(Mat33 A, Vector3 v)

Parameters:

Name Type Description
A tainicom.Aether.Physics2D.Common.Mat33
v Strawberry.Math.Vector3

Swap static

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

Parameters:

Name Type Description
a ref T
b ref T

Type Parameters:

  • T

Mul22 static

Vector2 Mul22(Mat33 A, Vector2 v)

Parameters:

Name Type Description
A tainicom.Aether.Physics2D.Common.Mat33
v Strawberry.Math.Vector2

Skew static

Vector2 Skew(Vector2 input)

Parameters:

Name Type Description
input Strawberry.Math.Vector2

IsValid static

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

bool IsValid(float x)

Parameters:

Name Type Description
x System.Single The x.

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

IsValid static

bool IsValid(Vector2 x)

Parameters:

Name Type Description
x Strawberry.Math.Vector2

Clamp static

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

Parameters:

Name Type Description
a System.Int32
low System.Int32
high System.Int32

Clamp static

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

Parameters:

Name Type Description
a System.Single
low System.Single
high System.Single

Clamp static

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

Parameters:

Name Type Description
a Strawberry.Math.Vector2
low Strawberry.Math.Vector2
high Strawberry.Math.Vector2

Cross static

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

Parameters:

Name Type Description
a ref Strawberry.Math.Vector2
b ref Strawberry.Math.Vector2
c out System.Single

VectorAngle static

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

double VectorAngle(ref Vector2 p1, ref Vector2 p2)

Parameters:

Name Type Description
p1 ref Strawberry.Math.Vector2
p2 ref Strawberry.Math.Vector2

Dot static

float Dot(Vector3 a, Vector3 b)

Parameters:

Name Type Description
a Strawberry.Math.Vector3
b Strawberry.Math.Vector3

Dot static

float Dot(Vector2 a, ref Vector2 b)

Parameters:

Name Type Description
a Strawberry.Math.Vector2
b ref Strawberry.Math.Vector2

VectorAngle static

double VectorAngle(Vector2 p1, Vector2 p2)

Parameters:

Name Type Description
p1 Strawberry.Math.Vector2
p2 Strawberry.Math.Vector2

Area static

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

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

Parameters:

Name Type Description
a Strawberry.Math.Vector2
b Strawberry.Math.Vector2
c Strawberry.Math.Vector2

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

Area static

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

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

Parameters:

Name Type Description
a ref Strawberry.Math.Vector2
b ref Strawberry.Math.Vector2
c ref Strawberry.Math.Vector2

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

IsCollinear static

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

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

Parameters:

Name Type Description
a ref Strawberry.Math.Vector2 First vertex
b ref Strawberry.Math.Vector2 Second vertex
c ref Strawberry.Math.Vector2 Third vertex
tolerance System.Single = 0 The tolerance

Cross static

void Cross(float s, ref Vector2 a, out Vector2 b)

Parameters:

Name Type Description
s System.Single
a ref Strawberry.Math.Vector2
b out Strawberry.Math.Vector2

FloatEquals static

bool FloatEquals(float value1, float value2)

Parameters:

Name Type Description
value1 System.Single
value2 System.Single

FloatEquals static

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

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

Parameters:

Name Type Description
value1 System.Single The first floating point Value.
value2 System.Single The second floating point Value.
delta System.Single The floating point tolerance.

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

FloatInRange static

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

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

Parameters:

Name Type Description
value System.Single The Value to check.
min System.Single The minimum Value.
max System.Single The maximum Value.

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