From 5b901e32c3c9dc2e40c694add6c3c2b31c8d8a95 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 20 Mar 2023 06:14:31 +0100 Subject: Add FloatUtil.isZero(float) using FloatUtil.EPSILON --- src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/jogl/classes') 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 < epsilon. + * @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); } -- cgit v1.2.3