polyplex.math.mathf

Members

Aliases

Mix
alias Mix = LinearInterpolation

Alias for linear interpolation, to follow the same GLSL convention

Smoothstep
alias Smoothstep = HermiteInterpolation

Alias to GLSL name for hermite interpolation

Functions

ApproxEquals
bool ApproxEquals(T a, T b, T eps)

Checks if two floating-point scalars are approximately equal to each other by some epsilon

Clamp
T Clamp(T x, T min, T max)

Clamps scalar elements

CosineInterpolation
T CosineInterpolation(T x, T y, float a)

Cosine interpolation on scalar elements. It interpolates between two scalars x and y using a cosine-weighted a (this function applies the cosine-weight). Check LinearInterpolation for more details.

CubicInterpolation
T CubicInterpolation(T x, T y, T z, T w, float a)

Cube interpolation using Catmull-Rom splines on scalar elements. Interpolates between two scalars y and z using a gradient a that takes x <-> y and z <-> w into account in order to offer better continuity between segments. Check LinearInerpolation for more details.

HermiteInterpolation
T HermiteInterpolation(T x, T y, float a)

Hermite interpolation on scalar elements as described by GLSL smoothstep. Interpolates between x and y using gradient a that allows smooth transitions as the gradient approaches 1 or 0. See LinearInterpolation for more details.

HermiteInterpolation
T HermiteInterpolation(T x, T y, T z, T w, float a, float tension, float bias)

Hermite interpolation on scalar elements. Similar to CubicInterpolation except that you have control over the tension (tightening of the curvature) and bias (twists the curve about known points).

LinearInterpolation
T LinearInterpolation(T x, T y, float a)

Linear interpolation on scalar elements. Interpolates between two scalar values x and y using a linear gradient a

Max
T Max(T scalar_a, T scalar_b)

Maximum of two scalar elements

Min
T Min(T scalar_a, T scalar_b)

Minimum of two scalar elements

Step
T Step(T edge, T a)

Steps scalar a on edge edge. Returns 0 if a < edge, otherwise 1

ToDegrees
T ToDegrees(T radians)

Converts quantity of radians to degrees

ToRadians
T ToRadians(T degrees)

Converts quantity of degrees to radians

Variables

TAU
enum real TAU;

TAU = PI*2

Meta