diff options
author | Sven Gothel <[email protected]> | 2023-09-04 06:45:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-04 06:45:29 +0200 |
commit | e06d1d07125fb9489ea45d05fb40a562e2c4ca46 (patch) | |
tree | fc090c1dd6ae0d1e7a2dbb7be2dd7d2da458be77 /src/jogl/classes/com/jogamp/graph/geom/plane | |
parent | ba1c13b4eb4db2f15d2ee72d768748ab1f5d5639 (diff) |
FloatUtil.abs(a): Mark as deprecated, use Math.abs(a) directly. We assume it is an intrinsic + branch-less implementation
Expected implementation is
- return Float.intBitsToFloat(Float.floatToRawIntBits(a) & 0x7fffffff);
replacing old implementation
- return (a <= 0.0F) ? 0.0F - a : a;
.. also market as @IntrinsicCandidate
Hence we shall leave it to the JRE core-lib implementation...
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph/geom/plane')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/geom/plane/AffineTransform.java | 10 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/geom/plane/Crossing2F.java | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/com/jogamp/graph/geom/plane/AffineTransform.java index 434746240..66d661990 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/plane/AffineTransform.java +++ b/src/jogl/classes/com/jogamp/graph/geom/plane/AffineTransform.java @@ -276,11 +276,11 @@ public class AffineTransform implements Cloneable { public final AffineTransform setToRotation(final float angle) { float sin = FloatUtil.sin(angle); float cos = FloatUtil.cos(angle); - if (FloatUtil.abs(cos) < ZERO) { + if (Math.abs(cos) < ZERO) { cos = 0.0f; sin = sin > 0.0f ? 1.0f : -1.0f; } else - if (FloatUtil.abs(sin) < ZERO) { + if (Math.abs(sin) < ZERO) { sin = 0.0f; cos = cos > 0.0f ? 1.0f : -1.0f; } @@ -387,7 +387,7 @@ public class AffineTransform implements Cloneable { public final AffineTransform createInverse() throws NoninvertibleTransformException { final float det = getDeterminant(); - if (FloatUtil.abs(det) < ZERO) { + if (Math.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } return new AffineTransform( @@ -535,7 +535,7 @@ public class AffineTransform implements Cloneable { */ public final Vertex inverseTransform(final Vertex src, final Vertex dst) throws NoninvertibleTransformException { final float det = getDeterminant(); - if (FloatUtil.abs(det) < ZERO) { + if (Math.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } final float x = src.x() - m02; @@ -548,7 +548,7 @@ public class AffineTransform implements Cloneable { throws NoninvertibleTransformException { final float det = getDeterminant(); - if (FloatUtil.abs(det) < ZERO) { + if (Math.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } diff --git a/src/jogl/classes/com/jogamp/graph/geom/plane/Crossing2F.java b/src/jogl/classes/com/jogamp/graph/geom/plane/Crossing2F.java index 0cd4b66ff..7eb1d0bf0 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/plane/Crossing2F.java +++ b/src/jogl/classes/com/jogamp/graph/geom/plane/Crossing2F.java @@ -106,7 +106,7 @@ import com.jogamp.opengl.math.FloatUtil; res[rc++] = m * FloatUtil.cos(t - p) + n; } else { // Debug.println("R2 >= Q3 (" + R2 + "/" + Q3 + ")"); - float A = FloatUtil.pow(FloatUtil.abs(R) + FloatUtil.sqrt(R2 - Q3), 1.0f / 3.0f); + float A = FloatUtil.pow(Math.abs(R) + FloatUtil.sqrt(R2 - Q3), 1.0f / 3.0f); if (R > 0.0) { A = -A; } |