Computes the angle between two points
the angle between the two points (in radians)
const a: Point = [0, 0];
const b: Point = [2, 2];
angleVec(a, b); // > returns Math.PI / 4
Determines if the values in the two arrays are approximately equal (within epsilon). It evaulates the arrays index by index.
the first array
the second array
Optional
epsilon: numberthe epsilon value to determine if the values are approximately equal (default 1e-6)
Determines if two numbers are approximately equal (within epsilon)
the first number
the second number
Optional
epsilon: numberthe epsilon value to determine if the values are approximately equal (default 1e-6)
Constrain a number between a min and max value
the lower bound of the range to constrain
the upper bound of the range to constrain
Computes the distance between two points
the first point
the second point
the distance between the two points
invlerp (inverse linear interpolation) produces the percentage of v between n1 and n2.
the left side of the range
the right side of the range
the value to find the percentage of
the percentage of v between n1 and n2
invlerp(0, 10, 5) // > returns 0.5
lerp (linear interpolation) produces a value beteween p% between n1 and n2.
the left side of the range
the right side of the range
the percentage to interpolate
the interpolated value between n1 and n2
lerp(0, 10, 0.5) // > returns 5
Find the minimum value in an array of numbers
the array of numbers to find the minimum within
the minimum value in the array
Find the minimum value in 2D array of numbers in a specific column
the 2D array of numbers to find the minimum within
the index of the column to find the minimum within
the minimum value in the column of the array
Given two arrays, find the minimum value at the same index in both arrays
the first array
the second array
the minimum value of either a[idx] or b[idx]
Converts a value from one range to another.
the left side of the original range
the right side of the original range
the left side of the target range
the right side of the target range
the value to convert
the value converted from the original range to the target range
Adds two points/vectors together