aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-03 08:31:24 +0200
committerSven Gothel <[email protected]>2023-09-03 08:31:24 +0200
commit47233ea7014e34adca8a5c1d2323a57e9de1c7fa (patch)
tree8911ce16673237d6c6c568a5e4a68874c4ccb877 /src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
parente6087583dc06c823f54bb6206af2acb0e2119b4c (diff)
FloatUtil.isEqual(..): Rename raw {isEqual->isEqualRaw}(a,b) varianr w/o EPSILON; Add isEqual(a,b) w/ default EPSILON; Use it where applicable
Also add isEqual2(a,b) w/o corner cases (NaN, Inf) used for comparison in Graph Outline, OutlineShape and later GraphUI Shape.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index d3b2c3cfd..e38501c73 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -52,6 +52,18 @@ public final class VectorUtil {
}
/**
+ * Return true if all three vector components are zero, i.e. it's their absolute value < {@link FloatUtil#EPSILON}.
+ * <p>
+ * Implementation uses {@link FloatUtil#isZero(float)}, see API doc for details.
+ * </p>
+ */
+ public static boolean isZero(final float x, final float y, final float z) {
+ return FloatUtil.isZero(x) &&
+ FloatUtil.isZero(y) &&
+ FloatUtil.isZero(z) ;
+ }
+
+ /**
* Return the squared distance between the given two points described vector v1 and v2.
* <p>
* When comparing the relative distance between two points it is usually sufficient to compare the squared