MathHelper

Added in 1.0.0

public final class MathHelper


Summary

Public methods

static final float
clamp(float x, float min, float max)

Clamps a value.

static final float
lerp(float a, float b, float t)

Linearly interpolates between two values.

static final float
toDegrees(float angleInRadians)

Converts angleInRadians from radians to degrees.

static final float
toRadians(float angleInDegrees)

Converts angleInDegrees from degrees to radians.

Public methods

clamp

public static final float clamp(float x, float min, float max)

Clamps a value.

Parameters
float x

the value to clamp

float min

the minimum value

float max

the maximum value

public static final float lerp(float a, float b, float t)

Linearly interpolates between two values.

Parameters
float a

the start value

float b

the end value

float t

the ratio between the two floats

Returns
float

the interpolated value between a and b

toDegrees

public static final float toDegrees(float angleInRadians)

Converts angleInRadians from radians to degrees.

Parameters
float angleInRadians

the angle in radians

toRadians

public static final float toRadians(float angleInDegrees)

Converts angleInDegrees from degrees to radians.

Parameters
float angleInDegrees

the angle in degrees