java.lang.Object
technology.sola.math.SolaMath
SolaMath is a collection of static math functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatclamp(float min, float max, float value) Clamps a float value between a min and max.static Vector2DClamps aVector2Dbetween a min and max.static intfastRound(float value) Rounds a positive float value to the nearest integer quickly.static floatlerp(float start, float end, float percent) Linearly interpolates a value between start and end.static floatlerp(float start, float end, float percent, EasingFunction easingFunction) Interpolates a value between start and end via desiredEasingFunction.static Vector2DLinearly interpolates aVector2Dvalue between start and end.static Vector2Dlerp(Vector2D start, Vector2D end, float percent, EasingFunction easingFunction) Interpolates aVector2Dvalue between start and end via desiredEasingFunction.
-
Method Details
-
lerp
public static float lerp(float start, float end, float percent) Linearly interpolates a value between start and end.- Parameters:
start- the minimum value to returnend- the maximum value to returnpercent- the "progress" towards the end value- Returns:
- the linearly interpolated value clamped between start and end
-
lerp
Interpolates a value between start and end via desiredEasingFunction.- Parameters:
start- the minimum value to returnend- the maximum value to returnpercent- the "progress" towards the end valueeasingFunction- theEasingFunctionused during interpolation- Returns:
- the interpolated value clamped between start and end
-
lerp
Linearly interpolates aVector2Dvalue between start and end.- Parameters:
start- the minimum value to returnend- the maximum value to returnpercent- the "progress" towards the end value- Returns:
- the linearly interpolated vector clamped between start and end
-
lerp
public static Vector2D lerp(Vector2D start, Vector2D end, float percent, EasingFunction easingFunction) Interpolates aVector2Dvalue between start and end via desiredEasingFunction.- Parameters:
start- the minimum value to returnend- the maximum value to returnpercent- the "progress" towards the end valueeasingFunction- theEasingFunctionused during interpolation- Returns:
- the interpolated vector clamped between start and end
-
clamp
public static float clamp(float min, float max, float value) Clamps a float value between a min and max.- Parameters:
min- the minimum valuemax- the maximum valuevalue- the value to clamp- Returns:
- the clamped value
-
clamp
Clamps aVector2Dbetween a min and max.- Parameters:
min- the minimum valuemax- the maximum valuevalue- the value to clamp- Returns:
- the clamped
Vector2D
-
fastRound
public static int fastRound(float value) Rounds a positive float value to the nearest integer quickly.- Parameters:
value- the float value to round- Returns:
- the rounded value
-