Math & algorithms

Vector

Vector2 - A 2D vector.
Members: x, y, dot, length, normalized

Vector3 - A 3D vector.
Members: x, y, z, dot, cross, length, normalized

operator+ - Returns the component-wise sum.

algorithm

max - Gives the maximum of the two elements.

min - Gives the minimum of the two elements.

swap - Swaps two items in place. Takes pointers because it mutates its arguments.

sort - Sorts a array. Uses insertion sort if the array is small enough, and quickSort otherwise.

math

abs - Returns the absolute value.

clamp - Constrains the value to the given range.

sin - Returns the sine of x.

cos - Returns the cosine of x.

tan - Returns the tangent of x.

asin - Returns the arc sine of x.

acos - Returns the arc cosine of x.

atan - Returns the arc tangent of x.

atan2 - Returns the arc tangent of y/x.

sinh - Returns the hyperbolic sine of x.

cosh - Returns the hyperbolic cosine of x.

tanh - Returns the hyperbolic tangent of x.

exp - Returns e raised to the power x.

exp2 - Returns 2 raised to the power x.

log - Returns the natural logarithm of x.

log2 - Returns the base-2 logarithm of x.

log10 - Returns the base-10 logarithm of x.

pow - Returns x raised to the power y.

sqrt - Returns the square root of x.

cbrt - Returns the cube root of x.

hypot - Returns the square root of the sum of the squares of x and y.

ceil - Rounds x up to an integer.

floor - Rounds x down to an integer.

trunc - Rounds x toward zero to an integer.

round - Rounds x to the nearest integer.

fmod - Returns the remainder of x/y.

pi - Ratio of a circle's circumference to its diameter.

e - Base of the natural logarithm.