diff options
author | Sven Gothel <[email protected]> | 2023-09-03 08:31:24 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-03 08:31:24 +0200 |
commit | 47233ea7014e34adca8a5c1d2323a57e9de1c7fa (patch) | |
tree | 8911ce16673237d6c6c568a5e4a68874c4ccb877 /src/jogl/classes/com/jogamp/opengl/math/Vec4f.java | |
parent | e6087583dc06c823f54bb6206af2acb0e2119b4c (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/Vec4f.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/math/Vec4f.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java b/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java index a5276c7f1..914450bf1 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Vec4f.java @@ -356,7 +356,7 @@ public final class Vec4f { } /** - * Equals check using {@link FloatUtil#EPSILON} value and {@link FloatUtil#isEqual(float, float, float)}. + * Equals check using {@link FloatUtil#EPSILON} in {@link FloatUtil#isEqual(float, float)}. * <p> * Implementation considers following corner cases: * <ul> @@ -368,13 +368,20 @@ public final class Vec4f { * @return true if all components differ less than {@link FloatUtil#EPSILON}, otherwise false. */ public boolean isEqual(final Vec4f o) { - return isEqual(o, FloatUtil.EPSILON); + if( this == o ) { + return true; + } else { + return FloatUtil.isEqual(x, o.x) && + FloatUtil.isEqual(y, o.y) && + FloatUtil.isEqual(z, o.z) && + FloatUtil.isEqual(w, o.w); + } } @Override public boolean equals(final Object o) { if( o instanceof Vec4f ) { - return isEqual((Vec4f)o, FloatUtil.EPSILON); + return isEqual((Vec4f)o); } else { return false; } |