Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions jme3-core/src/main/java/com/jme3/math/FastMath.java
Original file line number Diff line number Diff line change
Expand Up @@ -992,4 +992,16 @@ public static short convertFloatToHalf(float flt) {
| ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00)
| ((f >> 13) & 0x03ff));
}

/**
* Converts a range of min/max to a 0-1 range.
* @param value the value between min-max (inclusive).
* @param min the minimum of the range.
* @param max the maximum of the range.
* @return A value between 0-1 if the given value is between min/max.
*/
public static float unInterpolateLinear(float value, float min, float max) {
return (value - min) / (max - min);
}

}