aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/math
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-10-17 22:27:27 -0700
committerHarvey Harrison <[email protected]>2013-10-17 22:27:27 -0700
commit5e9c02bce7b241a0bf95c8abca9a91cd25e51ed3 (patch)
tree78e913afc74a64e519d69dfb9aa886dd41ec16ed /src/jogl/classes/com/jogamp/opengl/math
parent2ebf1bf35928e35ded6e38df64dee7aa578ae3c7 (diff)
jogl: remove all trailing whitespace
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/math')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java88
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Quaternion.java38
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java46
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java84
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java82
7 files changed, 177 insertions, 177 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java
index e0acfec28..b7dbf183f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package com.jogamp.opengl.math;
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index f3f44f15a..191a83241 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -40,7 +40,7 @@ import com.jogamp.common.os.Platform;
* <p>
* Derived from ProjectFloat.java - Created 11-jan-2004
* </p>
- *
+ *
* @author Erik Duijs
* @author Kenneth Russell
* @author Sven Gothel
@@ -95,7 +95,7 @@ public class FloatUtil {
m.put(ZERO_MATRIX);
m.position(oldPos);
}
-
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
@@ -111,7 +111,7 @@ public class FloatUtil {
d[d_off+i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ;
}
}
-
+
/**
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
@@ -127,7 +127,7 @@ public class FloatUtil {
a[a_off_i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ;
}
}
-
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
@@ -151,7 +151,7 @@ public class FloatUtil {
* @param d result a*b in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off, FloatBuffer d) {
- final int aP = a.position();
+ final int aP = a.position();
final int dP = d.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
@@ -162,13 +162,13 @@ public class FloatUtil {
d.put(dP+i+3*4 , ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] );
}
}
-
+
/**
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off) {
- final int aP = a.position();
+ final int aP = a.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
final int aP_i = aP+i;
@@ -186,7 +186,7 @@ public class FloatUtil {
* @param d result a*b in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b, FloatBuffer d) {
- final int aP = a.position();
+ final int aP = a.position();
final int bP = b.position();
final int dP = d.position();
for (int i = 0; i < 4; i++) {
@@ -198,13 +198,13 @@ public class FloatUtil {
d.put(dP+i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) );
}
}
-
+
/**
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b) {
- final int aP = a.position();
+ final int aP = a.position();
final int bP = b.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
@@ -216,14 +216,14 @@ public class FloatUtil {
a.put(aP_i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) );
}
}
-
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
* @param d result a*b in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b, float[] d, int d_off) {
- final int aP = a.position();
+ final int aP = a.position();
final int bP = b.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
@@ -234,7 +234,7 @@ public class FloatUtil {
d[d_off+i+3*4] = ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) ;
}
}
-
+
/**
* Normalize vector
*
@@ -242,7 +242,7 @@ public class FloatUtil {
*/
public static final void normalize(float[] v) {
float r = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
-
+
if ( r == 0.0 || r == 1.0) {
return;
}
@@ -265,7 +265,7 @@ public class FloatUtil {
float r = (float) Math.sqrt(v.get(0+vPos) * v.get(0+vPos) +
v.get(1+vPos) * v.get(1+vPos) +
v.get(2+vPos) * v.get(2+vPos));
-
+
if ( r == 0.0 || r == 1.0) {
return;
}
@@ -341,7 +341,7 @@ public class FloatUtil {
v_in[3] * m_in[3*4+i];
}
}
-
+
/**
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
@@ -355,10 +355,10 @@ public class FloatUtil {
v_in[0+v_in_off] * m_in.get(0*4+i+matrixPos) +
v_in[1+v_in_off] * m_in.get(1*4+i+matrixPos) +
v_in[2+v_in_off] * m_in.get(2*4+i+matrixPos) +
- v_in[3+v_in_off] * m_in.get(3*4+i+matrixPos);
+ v_in[3+v_in_off] * m_in.get(3*4+i+matrixPos);
}
}
-
+
/**
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
@@ -372,10 +372,10 @@ public class FloatUtil {
v_in[0] * m_in.get(0*4+i+matrixPos) +
v_in[1] * m_in.get(1*4+i+matrixPos) +
v_in[2] * m_in.get(2*4+i+matrixPos) +
- v_in[3] * m_in.get(3*4+i+matrixPos);
+ v_in[3] * m_in.get(3*4+i+matrixPos);
}
}
-
+
/**
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
@@ -395,7 +395,7 @@ public class FloatUtil {
}
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
@@ -403,7 +403,7 @@ public class FloatUtil {
* @param rows
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
- * @param row row number to print
+ * @param row row number to print
* @return matrix row string representation
*/
public static StringBuilder matrixRowToString(StringBuilder sb, String f, FloatBuffer a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row) {
@@ -413,17 +413,17 @@ public class FloatUtil {
final int a0 = aOffset + a.position();
if(rowMajorOrder) {
for(int c=0; c<columns; c++) {
- sb.append( String.format( f+" ", a.get( a0 + row*columns + c ) ) );
+ sb.append( String.format( f+" ", a.get( a0 + row*columns + c ) ) );
}
} else {
for(int r=0; r<columns; r++) {
- sb.append( String.format( f+" ", a.get( a0 + row + r*rows ) ) );
+ sb.append( String.format( f+" ", a.get( a0 + row + r*rows ) ) );
}
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
@@ -431,7 +431,7 @@ public class FloatUtil {
* @param rows
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
- * @param row row number to print
+ * @param row row number to print
* @return matrix row string representation
*/
public static StringBuilder matrixRowToString(StringBuilder sb, String f, float[] a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row) {
@@ -440,19 +440,19 @@ public class FloatUtil {
}
if(rowMajorOrder) {
for(int c=0; c<columns; c++) {
- sb.append( String.format( f+" ", a[ aOffset + row*columns + c ] ) );
+ sb.append( String.format( f+" ", a[ aOffset + row*columns + c ] ) );
}
} else {
for(int r=0; r<columns; r++) {
- sb.append( String.format( f+" ", a[ aOffset + row + r*rows ] ) );
+ sb.append( String.format( f+" ", a[ aOffset + row + r*rows ] ) );
}
}
return sb;
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
* @param aOffset offset to <code>a</code>'s current position
@@ -469,14 +469,14 @@ public class FloatUtil {
for(int i=0; i<rows; i++) {
sb.append(prefix).append("[ ");
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
* @param aOffset offset to <code>a</code>'s current position
@@ -493,14 +493,14 @@ public class FloatUtil {
for(int i=0; i<rows; i++) {
sb.append(prefix).append("[ ");
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @param aOffset offset to <code>a</code>'s current position
@@ -521,14 +521,14 @@ public class FloatUtil {
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
sb.append("=?= ");
matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @param aOffset offset to <code>a</code>'s current position
@@ -549,11 +549,11 @@ public class FloatUtil {
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
sb.append("=?= ");
matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
-
+
public static final float E = 2.7182818284590452354f;
public static final float PI = 3.14159265358979323846f;
@@ -569,5 +569,5 @@ public class FloatUtil {
public static float acos(float a) { return (float) java.lang.Math.acos(a); }
public static float sqrt(float a) { return (float) java.lang.Math.sqrt(a); }
-
+
} \ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
index c6bf44f6d..78cbb18cf 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
@@ -33,7 +33,7 @@ public class Quaternion {
public Quaternion() {
setIdentity();
}
-
+
public Quaternion(Quaternion q) {
x = q.x;
y = q.y;
@@ -50,7 +50,7 @@ public class Quaternion {
/**
* Constructor to create a rotation based quaternion from two vectors
- *
+ *
* @param vector1
* @param vector2
*/
@@ -59,7 +59,7 @@ public class Quaternion {
final float[] cross = VectorUtil.cross(vector1, vector2);
fromAxis(cross, theta);
}
-
+
/***
* Constructor to create a rotation based quaternion from axis vector and angle
* @param vector axis vector
@@ -69,10 +69,10 @@ public class Quaternion {
public Quaternion(float[] vector, float angle) {
fromAxis(vector, angle);
}
-
+
/***
* Initialize this quaternion with given axis vector and rotation angle
- *
+ *
* @param vector axis vector
* @param angle rotation angle (rads)
*/
@@ -88,7 +88,7 @@ public class Quaternion {
/**
* Transform the rotational quaternion to axis based rotation angles
- *
+ *
* @return new float[4] with ,theta,Rx,Ry,Rz
*/
public float[] toAxis() {
@@ -135,7 +135,7 @@ public class Quaternion {
/**
* Add a quaternion
- *
+ *
* @param q quaternion
*/
public void add(Quaternion q) {
@@ -146,7 +146,7 @@ public class Quaternion {
/**
* Subtract a quaternion
- *
+ *
* @param q quaternion
*/
public void subtract(Quaternion q) {
@@ -157,7 +157,7 @@ public class Quaternion {
/**
* Divide a quaternion by a constant
- *
+ *
* @param n a float to divide by
*/
public void divide(float n) {
@@ -168,7 +168,7 @@ public class Quaternion {
/**
* Multiply this quaternion by the param quaternion
- *
+ *
* @param q a quaternion to multiply with
*/
public void mult(Quaternion q) {
@@ -186,7 +186,7 @@ public class Quaternion {
/**
* Multiply a quaternion by a constant
- *
+ *
* @param n a float constant
*/
public void mult(float n) {
@@ -194,10 +194,10 @@ public class Quaternion {
y *= n;
z *= n;
}
-
+
/***
* Rotate given vector by this quaternion
- *
+ *
* @param vector input vector
* @return rotated vector
*/
@@ -250,7 +250,7 @@ public class Quaternion {
/**
* Transform this quaternion to a 4x4 column matrix representing the
* rotation
- *
+ *
* @return new float[16] column matrix 4x4
*/
public float[] toMatrix() {
@@ -287,7 +287,7 @@ public class Quaternion {
* See http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/
* quaternions/slerp/
* </p>
- *
+ *
* @param a initial quaternion
* @param b target quaternion
* @param t float between 0 and 1 representing interp.
@@ -332,13 +332,13 @@ public class Quaternion {
/**
* Check if this quaternion represents an identity matrix for rotation,
* , ie (0,0,0,1).
- *
+ *
* @return true if it is an identity rep., false otherwise
*/
public boolean isIdentity() {
return w == 1 && x == 0 && y == 0 && z == 0;
}
-
+
/***
* Set this quaternion to identity (x=0,y=0,z=0,w=1)
*/
@@ -349,7 +349,7 @@ public class Quaternion {
/**
* compute the quaternion from a 3x3 column matrix
- *
+ *
* @param m 3x3 column matrix
*/
public void setFromMatrix(float[] m) {
@@ -386,7 +386,7 @@ public class Quaternion {
/**
* Check if the the 3x3 matrix (param) is in fact an affine rotational
* matrix
- *
+ *
* @param m 3x3 column matrix
* @return true if representing a rotational matrix, false otherwise
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index 0033afeaa..508f1aafd 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -39,7 +39,7 @@ public class VectorUtil {
Winding(int dir) {
this.dir = dir;
}
- }
+ }
public static final int COLLINEAR = 0;
@@ -119,15 +119,15 @@ public class VectorUtil {
/** Column Matrix Vector multiplication
* @param colMatrix column matrix (4x4)
* @param vec vector(x,y,z)
- * @return result new float[3]
+ * @return result new float[3]
*/
public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)
{
final float[] out = new float[3];
- out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
- out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
- out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
+ out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
+ out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
+ out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
return out;
}
@@ -135,15 +135,15 @@ public class VectorUtil {
/** Matrix Vector multiplication
* @param rawMatrix column matrix (4x4)
* @param vec vector(x,y,z)
- * @return result new float[3]
+ * @return result new float[3]
*/
public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)
{
final float[] out = new float[3];
- out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
- out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
- out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
+ out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
+ out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
+ out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
return out;
}
@@ -157,7 +157,7 @@ public class VectorUtil {
{
return (p1+p2)/2.0f;
}
-
+
/** Calculate the midpoint of two points
* @param p1 first point
* @param p2 second point
@@ -172,7 +172,7 @@ public class VectorUtil {
return midPoint;
}
-
+
/** Compute the norm of a vector
* @param vec vector
* @return vorm
@@ -181,7 +181,7 @@ public class VectorUtil {
{
return FloatUtil.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
}
-
+
/** Compute distance between 2 points
* @param p0 a ref point on the line
* @param vec vector representing the direction of the line
@@ -216,7 +216,7 @@ public class VectorUtil {
*/
public static boolean checkEqualityVec2(float[] v1, float[] v2)
{
- return Float.compare(v1[0], v2[0]) == 0 &&
+ return Float.compare(v1[0], v2[0]) == 0 &&
Float.compare(v1[1], v2[1]) == 0 ;
}
@@ -261,7 +261,7 @@ public class VectorUtil {
* @param b triangle vertex 2
* @param c triangle vertex 3
* @param d vertex in question
- * @return true if the vertex d is inside the circle defined by the
+ * @return true if the vertex d is inside the circle defined by the
* vertices a, b, c. from paper by Guibas and Stolfi (1985).
*/
public static boolean inCircle(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d){
@@ -282,8 +282,8 @@ public class VectorUtil {
return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
}
- /** Check if a vertex is in triangle using
- * barycentric coordinates computation.
+ /** Check if a vertex is in triangle using
+ * barycentric coordinates computation.
* @param a first triangle vertex
* @param b second triangle vertex
* @param c third triangle vertex
@@ -291,7 +291,7 @@ public class VectorUtil {
* @return true if p is in triangle (a, b, c), false otherwise.
*/
public static boolean vertexInTriangle(float[] a, float[] b, float[] c, float[] p){
- // Compute vectors
+ // Compute vectors
final float[] ac = computeVector(a, c); //v0
final float[] ab = computeVector(a, b); //v1
final float[] ap = computeVector(a, p); //v2
@@ -362,13 +362,13 @@ public class VectorUtil {
* @param b vertex 2 of first segment
* @param c vertex 1 of second segment
* @param d vertex 2 of second segment
- * @return the intersection coordinates if the segments intersect, otherwise
- * returns null
+ * @return the intersection coordinates if the segments intersect, otherwise
+ * returns null
*/
public static float[] seg2SegIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) {
final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX());
- if (determinant == 0)
+ if (determinant == 0)
return null;
final float alpha = (a.getX()*b.getY()-a.getY()*b.getX());
@@ -389,13 +389,13 @@ public class VectorUtil {
* @param b vertex 2 of first line
* @param c vertex 1 of second line
* @param d vertex 2 of second line
- * @return the intersection coordinates if the lines intersect, otherwise
- * returns null
+ * @return the intersection coordinates if the lines intersect, otherwise
+ * returns null
*/
public static float[] line2lineIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) {
final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX());
- if (determinant == 0)
+ if (determinant == 0)
return null;
final float alpha = (a.getX()*b.getY()-a.getY()*b.getX());
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
index 13349884c..ec90b401f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
@@ -33,7 +33,7 @@ public interface Vert2fImmutable {
float getY();
int getCoordCount();
-
+
float[] getCoord();
-
+
}
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 b6e8ede2e..f1880a61b 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -32,23 +32,23 @@ import com.jogamp.opengl.math.VectorUtil;
/**
* Axis Aligned Bounding Box. Defined by two 3D coordinates (low and high)
- * The low being the the lower left corner of the box, and the high being the upper
+ * The low being the the lower left corner of the box, and the high being the upper
* right corner of the box.
- *
+ *
*/
public class AABBox implements Cloneable {
private float[] low = new float[3];
private float[] high = new float[3];
private float[] center = new float[3];
- /** Create a Axis Aligned bounding box (AABBox)
+ /** Create a Axis Aligned bounding box (AABBox)
* where the low and and high MAX float Values.
*/
public AABBox() {
reset();
}
- /** Create an AABBox specifying the coordinates
+ /** Create an AABBox specifying the coordinates
* of the low and high
* @param lx min x-coordinate
* @param ly min y-coordnate
@@ -61,7 +61,7 @@ public class AABBox implements Cloneable {
float hx, float hy, float hz) {
setSize(lx, ly, lz, hx, hy, hz);
}
-
+
/** Create a AABBox defining the low and high
* @param low min xyz-coordinates
* @param high max xyz-coordinates
@@ -78,27 +78,27 @@ public class AABBox implements Cloneable {
center[1] = 0f;
center[2] = 0f;
}
-
+
/** Get the max xyz-coordinates
* @return a float array containing the max xyz coordinates
*/
public final float[] getHigh() {
return high;
}
-
+
private final void setHigh(float hx, float hy, float hz) {
this.high[0] = hx;
this.high[1] = hy;
this.high[2] = hz;
}
-
+
/** Get the min xyz-coordinates
* @return a float array containing the min xyz coordinates
*/
public final float[] getLow() {
return low;
}
-
+
private final void setLow(float lx, float ly, float lz) {
this.low[0] = lx;
this.low[1] = ly;
@@ -111,10 +111,10 @@ public class AABBox implements Cloneable {
center[2] = (high[2] + low[2])/2;
}
- /**
- * Set size of the AABBox specifying the coordinates
+ /**
+ * Set size of the AABBox specifying the coordinates
* of the low and high.
- *
+ *
* @param lx min x-coordinate
* @param ly min y-coordnate
* @param lz min z-coordinate
@@ -123,7 +123,7 @@ public class AABBox implements Cloneable {
* @param hz max z-coordinate
*/
public final void setSize(float lx, float ly, float lz,
- float hx, float hy, float hz) {
+ float hx, float hy, float hz) {
this.low[0] = lx;
this.low[1] = ly;
this.low[2] = lz;
@@ -132,7 +132,7 @@ public class AABBox implements Cloneable {
this.high[2] = hz;
computeCenter();
}
-
+
/** Resize the AABBox to encapsulate another AABox
* @param newBox AABBox to be encapsulated in
*/
@@ -160,12 +160,12 @@ public class AABBox implements Cloneable {
}
/** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
+ * xyz-coordinates.
* @param x x-axis coordinate value
* @param y y-axis coordinate value
* @param z z-axis coordinate value
*/
- public final void resize(float x, float y, float z) {
+ public final void resize(float x, float y, float z) {
/** test low */
if (x < low[0])
low[0] = x;
@@ -181,12 +181,12 @@ public class AABBox implements Cloneable {
high[1] = y;
if (z > high[2])
high[2] = z;
-
+
computeCenter();
}
/** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
+ * xyz-coordinates.
* @param xyz xyz-axis coordinate values
* @param offset of the array
*/
@@ -210,7 +210,7 @@ public class AABBox implements Cloneable {
}
return true;
}
-
+
/** Check if the xyz coordinates are bounded/contained
* by this AABBox.
* @param x x-axis coordinate value
@@ -231,7 +231,7 @@ public class AABBox implements Cloneable {
}
return true;
}
-
+
/** Check if there is a common region between this AABBox and the passed
* 2D region irrespective of z range
* @param x lower left x-coord
@@ -244,13 +244,13 @@ public class AABBox implements Cloneable {
if (w <= 0 || h <= 0) {
return false;
}
-
+
final float _w = getWidth();
- final float _h = getHeight();
+ final float _h = getHeight();
if (_w <= 0 || _h <= 0) {
return false;
}
-
+
final float x0 = getMinX();
final float y0 = getMinY();
return (x + w > x0 &&
@@ -259,8 +259,8 @@ public class AABBox implements Cloneable {
y < y0 + _h);
}
-
- /** Get the size of the Box where the size is represented by the
+
+ /** Get the size of the Box where the size is represented by the
* length of the vector between low and high.
* @return a float representing the size of the AABBox
*/
@@ -283,16 +283,16 @@ public class AABBox implements Cloneable {
diffH[0] = high[0] - center[0];
diffH[1] = high[1] - center[1];
diffH[2] = high[2] - center[2];
-
+
diffH = VectorUtil.scale(diffH, size);
-
+
float[] diffL = new float[3];
diffL[0] = low[0] - center[0];
diffL[1] = low[1] - center[1];
diffL[2] = low[2] - center[2];
-
+
diffL = VectorUtil.scale(diffL, size);
-
+
high = VectorUtil.vectorAdd(center, diffH);
low = VectorUtil.vectorAdd(center, diffL);
}
@@ -300,43 +300,43 @@ public class AABBox implements Cloneable {
public final float getMinX() {
return low[0];
}
-
+
public final float getMinY() {
return low[1];
}
-
+
public final float getMinZ() {
return low[2];
}
-
+
public final float getMaxX() {
return high[0];
}
-
+
public final float getMaxY() {
return high[1];
}
-
+
public final float getMaxZ() {
return high[2];
}
-
+
public final float getWidth(){
return high[0] - low[0];
}
-
+
public final float getHeight() {
return high[1] - low[1];
}
-
+
public final float getDepth() {
return high[2] - low[2];
}
-
+
public final AABBox clone() {
return new AABBox(this.low, this.high);
}
-
+
public final boolean equals(Object obj) {
if( obj == this ) {
return true;
@@ -344,11 +344,11 @@ public class AABBox implements Cloneable {
if( null == obj || !(obj instanceof AABBox) ) {
return false;
}
- final AABBox other = (AABBox) obj;
- return VectorUtil.checkEquality(low, other.low) &&
+ final AABBox other = (AABBox) obj;
+ return VectorUtil.checkEquality(low, other.low) &&
VectorUtil.checkEquality(high, other.high) ;
}
-
+
public final String toString() {
return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
center[0]+"/"+center[1]+"/"+center[1]+" ]";
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 93e68a1d6..fb311083f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
@@ -30,11 +30,11 @@ package com.jogamp.opengl.math.geom;
import com.jogamp.common.os.Platform;
/**
- * Providing frustum {@link #getPlanes() planes} derived by different inputs
+ * Providing frustum {@link #getPlanes() planes} derived by different inputs
* ({@link #updateByPMV(float[], int) P*MV}, ..)
- * used to {@link #classifySphere(float[], float) classify objects} and to test
+ * used to {@link #classifySphere(float[], float) classify objects} and to test
* whether they are {@link #isOutside(AABBox) outside}.
- *
+ *
* <p>
* Extracting the world-frustum planes from the P*Mv:
* <pre>
@@ -54,7 +54,7 @@ import com.jogamp.common.os.Platform;
* Lighthouse3d.com
* http://www.lighthouse3d.com/tutorials/view-frustum-culling/
* </pre>
- *
+ *
* Fundamentals about Planes, Half-Spaces and Frustum-Culling:<br/>
* <pre>
* Planes and Half-Spaces, Max Wagner <[email protected]>
@@ -69,7 +69,7 @@ import com.jogamp.common.os.Platform;
public class Frustum {
/** Normalized planes[l, r, b, t, n, f] */
protected Plane[] planes = new Plane[6];
-
+
/**
* Creates an undefined instance w/o calculating the frustum.
* <p>
@@ -83,35 +83,35 @@ public class Frustum {
planes[i] = new Plane();
}
}
-
- /**
+
+ /**
* Plane equation := dot(n, x - p) = 0 -> ax + bc + cx + d == 0
* <p>
* In order to work w/ {@link Frustum#isOutside(AABBox) isOutside(..)} methods,
* the normals have to point to the inside of the frustum.
- * </p>
+ * </p>
*/
public static class Plane {
/** Normal of the plane */
public final float[] n = new float[3];
-
+
/** Distance to origin */
public float d;
- /**
+ /**
* Return signed distance of plane to given point.
* <ul>
* <li>If dist &lt; 0 , then the point p lies in the negative halfspace.</li>
* <li>If dist = 0 , then the point p lies in the plane.</li>
* <li>If dist &gt; 0 , then the point p lies in the positive halfspace.</li>
- * </ul>
+ * </ul>
* A plane cuts 3D space into 2 half spaces.
* <p>
* Positive halfspace is where the plane’s normals vector points into.
- * </p>
+ * </p>
* <p>
* Negative halfspace is the <i>other side</i> of the plane, i.e. *-1
- * </p>
+ * </p>
**/
public final float distanceTo(float x, float y, float z) {
return n[0] * x + n[1] * y + n[2] * z + d;
@@ -121,13 +121,13 @@ public class Frustum {
public final float distanceTo(float[] p) {
return n[0] * p[0] + n[1] * p[1] + n[2] * p[2] + d;
}
-
+
@Override
public String toString() {
return "Plane[ [ " + n[0] + ", " + n[1] + ", " + n[2] + " ], " + d + "]";
}
}
-
+
/** Index for left plane: {@value} */
public static final int LEFT = 0;
/** Index for right plane: {@value} */
@@ -140,7 +140,7 @@ public class Frustum {
public static final int NEAR = 4;
/** Index for far plane: {@value} */
public static final int FAR = 5;
-
+
/**
* {@link Plane}s are ordered in the returned array as follows:
* <ul>
@@ -154,17 +154,17 @@ public class Frustum {
* <p>
* {@link Plane}'s normals are pointing to the inside of the frustum
* in order to work w/ {@link #isOutside(AABBox) isOutside(..)} methods.
- * </p>
- *
- * @return array of normalized {@link Plane}s, order see above.
+ * </p>
+ *
+ * @return array of normalized {@link Plane}s, order see above.
*/
public final Plane[] getPlanes() { return planes; }
-
+
/**
* 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(Plane[] src) {
for (int i = 0; i < 6; ++i) {
final Plane p0 = planes[i];
final float[] p0_n = p0.n;
@@ -176,7 +176,7 @@ public class Frustum {
p0.d = p1.d;
}
}
-
+
/**
* Calculate the frustum planes in world coordinates
* using the passed float[16] as premultiplied P*MV (column major order).
@@ -185,7 +185,7 @@ public class Frustum {
* as required by this class.
* </p>
*/
- public void updateByPMV(float[] pmv, int pmv_off) {
+ public void updateByPMV(float[] pmv, int pmv_off) {
// Left: a = m41 + m11, b = m42 + m12, c = m43 + m13, d = m44 + m14 - [1..4] row-major
// Left: a = m30 + m00, b = m31 + m01, c = m32 + m02, d = m33 + m03 - [0..3] row-major
{
@@ -264,11 +264,11 @@ public class Frustum {
p.d /= invl;
}
}
-
+
private static final boolean isOutsideImpl(Plane p, AABBox box) {
final float[] low = box.getLow();
final float[] high = box.getHigh();
-
+
if ( p.distanceTo(low[0], low[1], low[2]) > 0.0f ||
p.distanceTo(high[0], low[1], low[2]) > 0.0f ||
p.distanceTo(low[0], high[1], low[2]) > 0.0f ||
@@ -298,19 +298,19 @@ public class Frustum {
// We make no attempt to determine whether it's fully inside or not.
return false;
}
-
-
+
+
public static enum Location { OUTSIDE, INSIDE, INTERSECT };
-
+
/**
* Check to see if a point is outside, inside or on a plane of the frustum.
- *
+ *
* @param p the point
* @return {@link Location} of point related to frustum planes
*/
public final Location classifyPoint(float[] p) {
Location res = Location.INSIDE;
-
+
for (int i = 0; i < 6; ++i) {
final float d = planes[i].distanceTo(p);
if ( d < 0.0f ) {
@@ -321,43 +321,43 @@ public class Frustum {
}
return res;
}
-
+
/**
* Check to see if a point is outside of the frustum.
- *
+ *
* @param p the point
* @return true if outside of the frustum, otherwise inside or on a plane
*/
public final boolean isPointOutside(float[] p) {
return Location.OUTSIDE == classifyPoint(p);
}
-
+
/**
* Check to see if a sphere is outside, intersecting or inside of the frustum.
- *
+ *
* @param p center of the sphere
* @param radius radius of the sphere
* @return {@link Location} of point related to frustum planes
*/
public final Location classifySphere(float[] p, float radius) {
Location res = Location.INSIDE; // fully inside
-
+
for (int i = 0; i < 6; ++i) {
final float d = planes[i].distanceTo(p);
- if ( d < -radius ) {
+ if ( d < -radius ) {
// fully outside
return Location.OUTSIDE;
} else if (d < radius ) {
// intersecting
res = Location.INTERSECT;
}
- }
+ }
return res;
}
-
+
/**
* Check to see if a sphere is outside of the frustum.
- *
+ *
* @param p center of the sphere
* @param radius radius of the sphere
* @return true if outside of the frustum, otherwise inside or intersecting
@@ -365,7 +365,7 @@ public class Frustum {
public final boolean isSphereOutside(float[] p, float radius) {
return Location.OUTSIDE == classifySphere(p, radius);
}
-
+
public StringBuilder toString(StringBuilder sb) {
if( null == sb ) {
sb = new StringBuilder();
@@ -380,7 +380,7 @@ public class Frustum {
.append("]");
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();