diff options
author | Sven Gothel <[email protected]> | 2023-03-20 06:14:31 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-20 06:14:31 +0100 |
commit | 5b901e32c3c9dc2e40c694add6c3c2b31c8d8a95 (patch) | |
tree | e9b9d46f250fc7a0e10edc4eacca46f5c81d8d19 /src/jogl/classes/com/jogamp/opengl/math | |
parent | 94c895bcf8a98218cf5dc7832f00212ce32945ec (diff) |
Add FloatUtil.isZero(float) using FloatUtil.EPSILON
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/math')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java index af1db0c1e..8b3b9dbf1 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java @@ -2265,6 +2265,14 @@ public final class FloatUtil { return Math.abs(a) < epsilon; } + /** + * Return true if value is zero, i.e. it's absolute value < <code>epsilon</code>. + * @see #EPSILON + */ + public static boolean isZero(final float a) { + return Math.abs(a) < FloatUtil.EPSILON; + } + public static float abs(final float a) { return java.lang.Math.abs(a); } public static float pow(final float a, final float b) { return (float) java.lang.Math.pow(a, b); } |