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/Vec2f.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/Vec2f.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/math/Vec2f.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java b/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java index d733aca5d..f504b960b 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Vec2f.java @@ -349,7 +349,7 @@ public final class Vec2f { } /** - * 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> @@ -361,13 +361,18 @@ public final class Vec2f { * @return true if all components differ less than {@link FloatUtil#EPSILON}, otherwise false. */ public boolean isEqual(final Vec2f o) { - return isEqual(o, FloatUtil.EPSILON); + if( this == o ) { + return true; + } else { + return FloatUtil.isEqual(x, o.x) && + FloatUtil.isEqual(y, o.y); + } } @Override public boolean equals(final Object o) { if( o instanceof Vec2f ) { - return isEqual((Vec2f)o, FloatUtil.EPSILON); + return isEqual((Vec2f)o); } else { return false; } |