# MathHelper

public class MathHelper

Static functions for common math operations.

### Public Methods

 static boolean almostEqualRelativeAndAbs(float a, float b) Returns true if two floats are equal within a tolerance. static float clamp(float value, float min, float max) Clamps a value between a minimum and maximum range. static float lerp(float a, float b, float t) Linearly interpolates between a and b by a ratio.

## Public Methods

#### public static boolean almostEqualRelativeAndAbs(float a, float b)

Returns true if two floats are equal within a tolerance. Useful for comparing floating point numbers while accounting for the limitations in floating point precision.

#### public static float clamp(float value, float min, float max)

Clamps a value between a minimum and maximum range.

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

Linearly interpolates between a and b by a ratio.

##### Parameters
a the beginning value the ending value ratio between the two floats
##### Returns
• interpolated value between the two floats
[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]