Table of Contents

Class AOMath

Namespace
AO
Assembly
CoreAssembly.dll

Math functions.

public static class AOMath
Inheritance
AOMath
Inherited Members

Methods

CalculateFriction(float, float, float)

public static float CalculateFriction(float friction, float time, float dt)

Parameters

friction float
time float
dt float

Returns

float

Lerp(float, float, float)

Linear interpolation between two values.

public static float Lerp(float a, float b, float t)

Parameters

a float
b float
t float

Returns

float

Mat4d(float)

public static Matrix4 Mat4d(float d)

Parameters

d float

Returns

Matrix4

MoveToward(float, float, float)

Move a value towards another value by a given amount

public static float MoveToward(float from, float to, float delta)

Parameters

from float
to float
delta float

Returns

float

MoveTowardInt(int, int, int)

Move a value towards another value by a given amount

public static int MoveTowardInt(int from, int to, int delta)

Parameters

from int
to int
delta int

Returns

int

Mul(Matrix4, Matrix4)

public static Matrix4 Mul(Matrix4 a, Matrix4 b)

Parameters

a Matrix4
b Matrix4

Returns

Matrix4

NextPowerOfTwo(int)

Returns the next power of two after or at n. E.g. NextPowerOfTwo(9) -> 16, NextPowerOfTwo(16) -> 16.

public static int NextPowerOfTwo(int n)

Parameters

n int

Returns

int

RealMod(int, int)

What we normally call the 'mod' operator, %, actually computes the remainder, not modulus. This function computes modulus.

public static int RealMod(int a, int b)

Parameters

a int
b int

Returns

int

Rotate(float, Vector3)

public static Matrix4 Rotate(float degrees, Vector3 axis)

Parameters

degrees float
axis Vector3

Returns

Matrix4

Scale(Vector3)

public static Matrix4 Scale(Vector3 scale)

Parameters

scale Vector3

Returns

Matrix4

SinXY(float, float, float)

Oscillates between x and y by sin(t).

public static float SinXY(float x, float y, float t)

Parameters

x float
y float
t float

Returns

float

ToDegrees(float)

public static float ToDegrees(float radians)

Parameters

radians float

Returns

float

ToRadians(float)

public static float ToRadians(float degrees)

Parameters

degrees float

Returns

float

TransformPoint(Matrix4, Vector2)

Transform a 2D point by given matrix.

public static Vector2 TransformPoint(Matrix4 matrix, Vector2 pos)

Parameters

matrix Matrix4
pos Vector2

Returns

Vector2

TransformPoint(Matrix4, Vector3)

Transform a 3D point by given matrix.

public static Vector2 TransformPoint(Matrix4 matrix, Vector3 pos)

Parameters

matrix Matrix4
pos Vector3

Returns

Vector2

Translate(Vector2)

public static Matrix4 Translate(Vector2 translation)

Parameters

translation Vector2

Returns

Matrix4

Transpose(Matrix4)

public static Matrix4 Transpose(Matrix4 matrix)

Parameters

matrix Matrix4

Returns

Matrix4

Unlerp(float, float, float)

Returns the percentage that value is between a and b. E.g. Unlerp(10, 20, 15) would be 0.5 because 15 is halfways between 10 and 20.

public static float Unlerp(float a, float b, float value)

Parameters

a float
b float
value float

Returns

float