Package com.google.ar.sceneform.math
Class MathHelper
- java.lang.Object
-
- com.google.ar.sceneform.math.MathHelper
-
public class MathHelper extends java.lang.Object
Static functions for common math operations.
-
-
Constructor Summary
Constructors Constructor Description MathHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Method Detail
-
almostEqualRelativeAndAbs
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.
-
clamp
public static float clamp(float value, float min, float max)
Clamps a value between a minimum and maximum range.
-
lerp
public static float lerp(float a, float b, float t)
Linearly interpolates between a and b by a ratio.- Parameters:
a
- the beginning valueb
- the ending valuet
- ratio between the two floats- Returns:
- interpolated value between the two floats
-
-