diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/math')
7 files changed, 48 insertions, 46 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary16.java b/src/jogl/classes/com/jogamp/opengl/math/Binary16.java index 33add46c2..8e4aa9176 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Binary16.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Binary16.java @@ -151,7 +151,7 @@ public final class Binary16 * the interval of double precision values is far larger than that of the * <code>binary16</code> type. * </p> - * + * * @see #unpackDouble(char) */ @@ -224,7 +224,7 @@ public final class Binary16 * the interval of single precision values is far larger than that of the * <code>binary16</code> type. * </p> - * + * * @see #unpackFloat(char) */ @@ -280,7 +280,7 @@ public final class Binary16 * range <code>[-15, 16]</code> - values outside of this range will be * truncated. * </p> - * + * * @see #unpackGetExponentUnbiased(char) */ @@ -298,7 +298,7 @@ public final class Binary16 * Encode the significand <code>s</code>. Values should be in the range * <code>[0, 1023]</code>. Values outside of this range will be truncated. * </p> - * + * * @see #unpackGetSignificand(char) */ @@ -315,7 +315,7 @@ public final class Binary16 * <code>[0, 1]</code>, with <code>0</code> ironically denoting a positive * value. Values outside of this range will be truncated. * </p> - * + * * @see #unpackGetSign(char) */ @@ -369,7 +369,7 @@ public final class Binary16 * <code>k</code>, and the decoded significand <code>s</code> of * <code>k</code>.</li> * </ul> - * + * * @see #packDouble(double) */ @@ -405,7 +405,7 @@ public final class Binary16 /** * 1. Bias the exponent. - * + * * 2. Shift the result left to the position at which it will appear in the * resulting value. */ @@ -443,7 +443,7 @@ public final class Binary16 * <code>k</code>, and the decoded significand <code>s</code> of * <code>k</code>.</li> * </ul> - * + * * @see #packFloat(float) */ @@ -479,7 +479,7 @@ public final class Binary16 /** * 1. Bias the exponent. - * + * * 2. Shift the result left to the position at which it will appear in the * resulting value. */ @@ -522,7 +522,7 @@ public final class Binary16 * <code>16</code> iff the input is {@link #POSITIVE_INFINITY}, * {@link #NEGATIVE_INFINITY}, or <code>NaN</code>.</li> * </ul> - * + * * @see #packSetExponentUnbiasedUnchecked(int) */ @@ -537,7 +537,7 @@ public final class Binary16 /** * Retrieve the sign bit of the given packed <code>binary16</code> value, as * an integer in the range <code>[0, 1]</code>. - * + * * @see Binary16#packSetSignUnchecked(int) */ @@ -552,7 +552,7 @@ public final class Binary16 * Return the significand of the given packed <code>binary16</code> value as * an integer in the range <code>[0, 1023]</code>. * </p> - * + * * @see Binary16#packSetSignificandUnchecked(int) */ diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary32.java b/src/jogl/classes/com/jogamp/opengl/math/Binary32.java index d98815d9f..599b1ff68 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Binary32.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Binary32.java @@ -75,7 +75,7 @@ public final class Binary32 * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY}, or * <code>NaN</code>.</li> * </ul> - * + * * @see #packSetExponentUnbiasedUnchecked(int) */ diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary64.java b/src/jogl/classes/com/jogamp/opengl/math/Binary64.java index 5efad433a..d4ec636a5 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Binary64.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Binary64.java @@ -75,7 +75,7 @@ public final class Binary64 * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY}, or * <code>NaN</code>.</li> * </ul> - * + * * @see #packSetExponentUnbiasedUnchecked(int) */ @@ -93,7 +93,7 @@ public final class Binary64 * Return the significand of the given double value. * </p> */ - + public static long unpackGetSignificand( final double d) { @@ -106,7 +106,7 @@ public final class Binary64 * Return the sign of the given double value. * </p> */ - + public static long unpackGetSign( final double d) { diff --git a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java index b7dbf183f..31408b079 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java +++ b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java @@ -46,15 +46,15 @@ public class FixedPoint { return (int)(value * 65536.0f); } - public static final float toFloat(int value) { - return (float)value/65536.0f; + public static final float toFloat(final int value) { + return value/65536.0f; } - public static final int mult(int x1, int x2) { + public static final int mult(final int x1, final int x2) { return (int) ( ((long)x1*(long)x2)/65536 ); } - public static final int div(int x1, int x2) { + public static final int div(final int x1, final int x2) { return (int) ( (((long)x1)<<16)/x2 ); } } diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java index 243ab2a33..5e0784022 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java @@ -438,7 +438,7 @@ public class Quaternion { * @see #rotateByAngleX(float) * @see #setFromEuler(float, float, float) */ - public final Quaternion rotateByEuler(final float bankX, final float headingY, float attitudeZ) { + public final Quaternion rotateByEuler(final float bankX, final float headingY, final float attitudeZ) { if ( VectorUtil.isZero(bankX, headingY, attitudeZ, FloatUtil.EPSILON) ) { return this; } else { @@ -859,7 +859,7 @@ public class Quaternion { * @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm">euclideanspace.com-eulerToQuaternion</a> * @see #toEuler(float[]) */ - public final Quaternion setFromEuler(final float bankX, final float headingY, float attitudeZ) { + public final Quaternion setFromEuler(final float bankX, final float headingY, final float attitudeZ) { if ( VectorUtil.isZero(bankX, headingY, attitudeZ, FloatUtil.EPSILON) ) { return setIdentity(); } else { @@ -1154,7 +1154,7 @@ public class Quaternion { * @param m 3x3 column matrix * @return true if representing a rotational matrix, false otherwise */ - public final boolean isRotationMatrix3f(float[] m) { + public final boolean isRotationMatrix3f(final float[] m) { final float epsilon = 0.01f; // margin to allow for rounding errors if (FloatUtil.abs(m[0] * m[3] + m[3] * m[4] + m[6] * m[7]) > epsilon) return false; @@ -1171,7 +1171,7 @@ public class Quaternion { return (FloatUtil.abs(determinant3f(m) - 1) < epsilon); } - private final float determinant3f(float[] m) { + private final float determinant3f(final float[] m) { return m[0] * m[4] * m[8] + m[3] * m[7] * m[2] + m[6] * m[1] * m[5] - m[0] * m[7] * m[5] - m[3] * m[1] * m[8] - m[6] * m[4] * m[2]; } diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java index d87bbb6f9..e454c036a 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java +++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java @@ -68,7 +68,7 @@ public class AABBox { * Create an AABBox copying all values from the given one * @param src the box value to be used for the new instance */ - public AABBox(AABBox src) { + public AABBox(final AABBox src) { copy(src); } @@ -147,7 +147,7 @@ public class AABBox { * @param src source AABBox * @return this AABBox for chaining */ - public final AABBox copy(AABBox src) { + public final AABBox copy(final AABBox src) { System.arraycopy(src.low, 0, low, 0, 3); System.arraycopy(src.high, 0, high, 0, 3); System.arraycopy(src.center, 0, center, 0, 3); @@ -196,8 +196,8 @@ public class AABBox { * @return this AABBox for chaining */ public final AABBox resize(final AABBox newBox) { - float[] newLow = newBox.getLow(); - float[] newHigh = newBox.getHigh(); + final float[] newLow = newBox.getLow(); + final float[] newHigh = newBox.getHigh(); /** test low */ if (newLow[0] < low[0]) @@ -662,7 +662,7 @@ public class AABBox { } @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if( obj == this ) { return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java index 87d31becb..f6d3c0dfa 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java +++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java @@ -27,6 +27,8 @@ */ package com.jogamp.opengl.math.geom; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.os.Platform; /** @@ -113,12 +115,12 @@ public class Frustum { * Negative halfspace is the <i>other side</i> of the plane, i.e. *-1 * </p> **/ - public final float distanceTo(float x, float y, float z) { + public final float distanceTo(final float x, final float y, final float z) { return n[0] * x + n[1] * y + n[2] * z + d; } /** Return distance of plane to given point, see {@link #distanceTo(float, float, float)}. */ - public final float distanceTo(float[] p) { + public final float distanceTo(final float[] p) { return n[0] * p[0] + n[1] * p[1] + n[2] * p[2] + d; } @@ -164,7 +166,7 @@ public class Frustum { * Copy the given <code>src</code> planes into this this instance's planes. * @param src the 6 source planes */ - public final void updateByPlanes(Plane[] src) { + public final void updateByPlanes(final Plane[] src) { for (int i = 0; i < 6; ++i) { final Plane p0 = planes[i]; final float[] p0_n = p0.n; @@ -185,7 +187,7 @@ public class Frustum { * as required by this class. * </p> */ - public void updateByPMV(float[] pmv, int pmv_off) { + public void updateByPMV(final float[] pmv, final int pmv_off) { // Left: a = m41 + m11, b = m42 + m12, c = m43 + m13, d = m44 + m14 - [1..4] column-major // Left: a = m30 + m00, b = m31 + m01, c = m32 + m02, d = m33 + m03 - [0..3] column-major { @@ -265,7 +267,7 @@ public class Frustum { } } - private static final boolean isOutsideImpl(Plane p, AABBox box) { + private static final boolean isOutsideImpl(final Plane p, final AABBox box) { final float[] low = box.getLow(); final float[] high = box.getHigh(); @@ -288,7 +290,7 @@ public class Frustum { * Note: If method returns false, the box may only be partially inside. * </p> */ - public final boolean isAABBoxOutside(AABBox box) { + public final boolean isAABBoxOutside(final AABBox box) { for (int i = 0; i < 6; ++i) { if ( isOutsideImpl(planes[i], box) ) { // fully outside @@ -308,7 +310,7 @@ public class Frustum { * @param p the point * @return {@link Location} of point related to frustum planes */ - public final Location classifyPoint(float[] p) { + public final Location classifyPoint(final float[] p) { Location res = Location.INSIDE; for (int i = 0; i < 6; ++i) { @@ -328,7 +330,7 @@ public class Frustum { * @param p the point * @return true if outside of the frustum, otherwise inside or on a plane */ - public final boolean isPointOutside(float[] p) { + public final boolean isPointOutside(final float[] p) { return Location.OUTSIDE == classifyPoint(p); } @@ -339,7 +341,7 @@ public class Frustum { * @param radius radius of the sphere * @return {@link Location} of point related to frustum planes */ - public final Location classifySphere(float[] p, float radius) { + public final Location classifySphere(final float[] p, final float radius) { Location res = Location.INSIDE; // fully inside for (int i = 0; i < 6; ++i) { @@ -362,7 +364,7 @@ public class Frustum { * @param radius radius of the sphere * @return true if outside of the frustum, otherwise inside or intersecting */ - public final boolean isSphereOutside(float[] p, float radius) { + public final boolean isSphereOutside(final float[] p, final float radius) { return Location.OUTSIDE == classifySphere(p, radius); } @@ -370,13 +372,13 @@ public class Frustum { if( null == sb ) { sb = new StringBuilder(); } - sb.append("Frustum[ Planes[ ").append(Platform.NEWLINE) - .append(" L: ").append(planes[0]).append(", ").append(Platform.NEWLINE) - .append(" R: ").append(planes[1]).append(", ").append(Platform.NEWLINE) - .append(" B: ").append(planes[2]).append(", ").append(Platform.NEWLINE) - .append(" T: ").append(planes[3]).append(", ").append(Platform.NEWLINE) - .append(" N: ").append(planes[4]).append(", ").append(Platform.NEWLINE) - .append(" F: ").append(planes[5]).append("], ").append(Platform.NEWLINE) + sb.append("Frustum[ Planes[ ").append(PlatformPropsImpl.NEWLINE) + .append(" L: ").append(planes[0]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" R: ").append(planes[1]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" B: ").append(planes[2]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" T: ").append(planes[3]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" N: ").append(planes[4]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" F: ").append(planes[5]).append("], ").append(PlatformPropsImpl.NEWLINE) .append("]"); return sb; } |