Class TMath
java.lang.Object
com.thecsdev.common.math.TMath
TheCSDev's mathematics-related utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic final doubleclamp01d(double value) Clamps adoublevalue to the range [0.0, 1.0].static final doubleclamp01f(float value) Clamps afloatvalue to the range [0.0f, 1.0f].static final doubleclampd(double value, double min, double max) Deprecated, for removal: This API element is subject to removal in a future version.static final floatclampf(float value, float min, float max) Deprecated, for removal: This API element is subject to removal in a future version.static final intclampi(int value, int min, int max) Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
clampi
Deprecated, for removal: This API element is subject to removal in a future version.Clamps aintvalue to the givenmin/maxrange.- Parameters:
value- the value to clampmin- The minimum value.max- The maximum value.- Returns:
minifvalue < min,maxifvalue > max, otherwisevalue.
-
clampf
Deprecated, for removal: This API element is subject to removal in a future version.Clamps afloatvalue to the givenmin/maxrange.- Parameters:
value- the value to clampmin- The minimum value.max- The maximum value.- Returns:
minifvalue < min,maxifvalue > max, otherwisevalue.
-
clampd
@Deprecated(forRemoval=true) public static final double clampd(double value, double min, double max) Deprecated, for removal: This API element is subject to removal in a future version.Clamps adoublevalue to the givenmin/maxrange.- Parameters:
value- the value to clampmin- The minimum value.max- The maximum value.- Returns:
minifvalue < min,maxifvalue > max, otherwisevalue.
-
clamp01f
public static final double clamp01f(float value) Clamps afloatvalue to the range [0.0f, 1.0f].- Parameters:
value- the value to clamp- Returns:
0.0fifvalue < 0.0f,1.0fifvalue > 1.0f, otherwisevalue.
-
clamp01d
public static final double clamp01d(double value) Clamps adoublevalue to the range [0.0, 1.0].- Parameters:
value- the value to clamp- Returns:
0.0ifvalue < 0.0,1.0ifvalue > 1.0, otherwisevalue.
-