From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:21:36 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- .../com/jogamp/opengl/math/geom/Frustum.java | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java') 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 other side of the plane, i.e. *-1 *

**/ - 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 src 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. *

*/ - 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. *

*/ - 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; } -- cgit v1.2.3