diff options
author | Harvey Harrison <[email protected]> | 2011-12-31 14:50:54 -0800 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2011-12-31 14:50:54 -0800 |
commit | 5800faa58d9dfe0244d40049cca7aa2a8ee4c395 (patch) | |
tree | 1d530dacfc9ffd4e96357ad209aba84e1a93362b /src | |
parent | a51c424d5f6abc1a2450dc37e44bd7604f95d709 (diff) |
vecmath: remove trailing whitespace from all files
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
40 files changed, 2727 insertions, 2727 deletions
diff --git a/src/javax/vecmath/AxisAngle4d.java b/src/javax/vecmath/AxisAngle4d.java index 638a199..e82de9a 100644 --- a/src/javax/vecmath/AxisAngle4d.java +++ b/src/javax/vecmath/AxisAngle4d.java @@ -32,7 +32,7 @@ package javax.vecmath; /** - * A four-element axis angle represented by double-precision floating point + * A four-element axis angle represented by double-precision floating point * x,y,z,angle components. An axis angle is a rotation of angle (radians) * about the vector (x,y,z). * @@ -65,9 +65,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { // Fixed to issue 538 final static double EPS = 1.0e-12; - + /** - * Constructs and initializes an AxisAngle4d from the specified + * Constructs and initializes an AxisAngle4d from the specified * x, y, z, and angle. * @param x the x coordinate * @param y the y coordinate @@ -85,15 +85,15 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Constructs and initializes an AxisAngle4d from the components - * contained in the array. - * @param a the array of length 4 containing x,y,z,angle in order - */ - public AxisAngle4d(double[] a) - { - this.x = a[0]; - this.y = a[1]; - this.z = a[2]; - this.angle = a[3]; + * contained in the array. + * @param a the array of length 4 containing x,y,z,angle in order + */ + public AxisAngle4d(double[] a) + { + this.x = a[0]; + this.y = a[1]; + this.z = a[2]; + this.angle = a[3]; } /** * Constructs and initializes an AxisAngle4d from the specified AxisAngle4d. @@ -109,7 +109,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** - * Constructs and initializes an AxisAngle4d from the specified + * Constructs and initializes an AxisAngle4d from the specified * AxisAngle4f. * @param a1 the AxisAngle4f containing the initialization x y z angle data */ @@ -123,7 +123,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** - * Constructs and initializes an AxisAngle4d from the specified + * Constructs and initializes an AxisAngle4d from the specified * axis and angle. * @param axis the axis * @param angle the angle of rotation in radian @@ -206,7 +206,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** - * Sets the value of this AxisAngle4d to the specified + * Sets the value of this AxisAngle4d to the specified * axis and angle. * @param axis the axis * @param angle the angle of rotation in radians @@ -258,9 +258,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { mag = Math.sqrt(mag); double sin = 0.5*mag; double cos = 0.5*(m3d.m00 + m3d.m11 + m3d.m22 - 1.0); - + angle = (float)Math.atan2(sin, cos); - + double invMag = 1.0/mag; x = x*invMag; y = y*invMag; @@ -365,10 +365,10 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { if (mag > EPS ) { mag = Math.sqrt(mag); - + double sin = 0.5*mag; double cos = 0.5*(m1.m00 + m1.m11 + m1.m22 - 1.0); - + angle = (float)Math.atan2(sin, cos); double invMag = 1.0/mag; @@ -395,7 +395,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { */ public final void set(Quat4f q1) { - double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; + double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; if( mag > EPS ) { mag = Math.sqrt(mag); @@ -404,13 +404,13 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { x = q1.x*invMag; y = q1.y*invMag; z = q1.z*invMag; - angle = 2.0*Math.atan2(mag, q1.w); + angle = 2.0*Math.atan2(mag, q1.w); } else { x = 0.0f; y = 1.0f; z = 0.0f; angle = 0.0f; - } + } } @@ -423,16 +423,16 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { */ public final void set(Quat4d q1) { - double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; - + double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; + if ( mag > EPS ) { mag = Math.sqrt(mag); double invMag = 1.0/mag; - + x = q1.x*invMag; y = q1.y*invMag; z = q1.z*invMag; - angle = 2.0*Math.atan2(mag, q1.w); + angle = 2.0*Math.atan2(mag, q1.w); } else { x = 0.0f; y = 1.0f; @@ -446,7 +446,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this AxisAngle4d. * The form is (x,y,z,angle). * @return the String representation - */ + */ public String toString() { return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.angle + ")"; } @@ -457,7 +457,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this AxisAngle4d. * @param a1 the axis-angle with which the comparison is made * @return true or false - */ + */ public boolean equals(AxisAngle4d a1) { try { @@ -473,7 +473,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { * this AxisAngle4d. * @param o1 the object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object o1) { try { @@ -489,12 +489,12 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this axis-angle - * and axis-angle a1 is less than or equal to the epsilon parameter, + * and axis-angle a1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(angle1-angle2)]. - * @param a1 the axis-angle to be compared to this axis-angle - * @param epsilon the threshold value + * @param a1 the axis-angle to be compared to this axis-angle + * @param epsilon the threshold value */ public boolean epsilonEquals(AxisAngle4d a1, double epsilon) { @@ -523,7 +523,7 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + VecMathUtil.doubleToLongBits(x); @@ -555,9 +555,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Get the axis angle, in radians.<br> * An axis angle is a rotation angle about the vector (x,y,z). - * + * * @return the angle, in radians. - * + * * @since vecmath 1.5 */ public final double getAngle() { @@ -568,9 +568,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Set the axis angle, in radians.<br> * An axis angle is a rotation angle about the vector (x,y,z). - * + * * @param angle The angle to set, in radians. - * + * * @since vecmath 1.5 */ public final void setAngle(double angle) { @@ -579,10 +579,10 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** - * Get value of <i>x</i> coordinate. - * + * Get value of <i>x</i> coordinate. + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public double getX() { @@ -592,9 +592,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Set a new value for <i>x</i> coordinate. - * + * * @param x the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(double x) { @@ -604,9 +604,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Get value of <i>y</i> coordinate. - * - * @return the <i>y</i> coordinate. - * + * + * @return the <i>y</i> coordinate. + * * @since vecmath 1.5 */ public final double getY() { @@ -616,9 +616,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Set a new value for <i>y</i> coordinate. - * + * * @param y the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(double y) { @@ -628,9 +628,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Get value of <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public double getZ() { @@ -640,9 +640,9 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { /** * Set a new value for <i>z</i> coordinate. - * + * * @param z the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(double z) { diff --git a/src/javax/vecmath/AxisAngle4f.java b/src/javax/vecmath/AxisAngle4f.java index 2c4b387..d99f4c7 100644 --- a/src/javax/vecmath/AxisAngle4f.java +++ b/src/javax/vecmath/AxisAngle4f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A four-element axis angle represented by single-precision floating point + * A four-element axis angle represented by single-precision floating point * x,y,z,angle components. An axis angle is a rotation of angle (radians) * about the vector (x,y,z). * @@ -83,7 +83,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** - * Constructs and initializes an AxisAngle4f from the array of length 4. + * Constructs and initializes an AxisAngle4f from the array of length 4. * @param a the array of length 4 containing x,y,z,angle in order */ public AxisAngle4f(float[] a) @@ -96,7 +96,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** - * Constructs and initializes an AxisAngle4f from the specified + * Constructs and initializes an AxisAngle4f from the specified * AxisAngle4f. * @param a1 the AxisAngle4f containing the initialization x y z angle data */ @@ -123,7 +123,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** - * Constructs and initializes an AxisAngle4f from the specified + * Constructs and initializes an AxisAngle4f from the specified * axis and angle. * @param axis the axis * @param angle the angle of rotation in radians @@ -151,7 +151,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** - * Sets the value of this axis-angle to the specified x,y,z,angle. + * Sets the value of this axis-angle to the specified x,y,z,angle. * @param x the x coordinate * @param y the y coordinate * @param z the z coordinate @@ -207,7 +207,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** - * Sets the value of this AxisAngle4f to the specified + * Sets the value of this AxisAngle4f to the specified * axis and angle. * @param axis the axis * @param angle the angle of rotation in radians @@ -224,7 +224,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Copies the value of this axis-angle into the array a. - * @param a the array + * @param a the array */ public final void get(float[] a) { @@ -232,7 +232,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { a[1] = this.y; a[2] = this.z; a[3] = this.angle; - } + } /** @@ -244,16 +244,16 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { */ public final void set(Quat4f q1) { - double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; + double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; if ( mag > EPS ) { mag = Math.sqrt(mag); double invMag = 1.0/mag; - + x = (float)(q1.x*invMag); y = (float)(q1.y*invMag); z = (float)(q1.z*invMag); - angle = (float)(2.0*Math.atan2(mag, q1.w)); + angle = (float)(2.0*Math.atan2(mag, q1.w)); } else { x = 0.0f; y = 1.0f; @@ -272,7 +272,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { */ public final void set(Quat4d q1) { - double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; + double mag = q1.x*q1.x + q1.y*q1.y + q1.z*q1.z; if (mag > EPS) { mag = Math.sqrt(mag); @@ -281,7 +281,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { x = (float)(q1.x*invMag); y = (float)(q1.y*invMag); z = (float)(q1.z*invMag); - angle = (float)(2.0*Math.atan2(mag, q1.w)); + angle = (float)(2.0*Math.atan2(mag, q1.w)); } else { x = 0.0f; y = 1.0f; @@ -354,7 +354,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { double sin = 0.5*mag; double cos = 0.5*(m3d.m00 + m3d.m11 + m3d.m22 - 1.0); angle = (float)Math.atan2(sin, cos); - + double invMag = 1.0/mag; x = (float)(x*invMag); y = (float)(y*invMag); @@ -363,7 +363,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { x = 0.0f; y = 1.0f; z = 0.0f; - angle = 0.0f; + angle = 0.0f; } } @@ -386,9 +386,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { mag = Math.sqrt(mag); double sin = 0.5*mag; double cos = 0.5*(m1.m00 + m1.m11 + m1.m22 - 1.0); - + angle = (float)Math.atan2(sin, cos); - + double invMag = 1.0/mag; x = (float)(x*invMag); y = (float)(y*invMag); @@ -397,7 +397,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { x = 0.0f; y = 1.0f; z = 0.0f; - angle = 0.0f; + angle = 0.0f; } } @@ -422,9 +422,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { mag = Math.sqrt(mag); double sin = 0.5*mag; double cos = 0.5*(m1.m00 + m1.m11 + m1.m22 - 1.0); - + angle = (float)Math.atan2(sin, cos); - + double invMag = 1.0/mag; x = (float)(x*invMag); y = (float)(y*invMag); @@ -433,7 +433,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { x = 0.0f; y = 1.0f; z = 0.0f; - angle = 0.0f; + angle = 0.0f; } } @@ -442,7 +442,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this AxisAngle4f. * The form is (x,y,z,angle). * @return the String representation - */ + */ public String toString() { return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.angle + ")"; } @@ -453,7 +453,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this AxisAngle4f. * @param a1 the axis-angle with which the comparison is made * @return true or false - */ + */ public boolean equals(AxisAngle4f a1) { try { @@ -470,7 +470,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { * this AxisAngle4f. * @param o1 the object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object o1) { try { @@ -485,12 +485,12 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this axis-angle - * and axis-angle a1 is less than or equal to the epsilon parameter, + * and axis-angle a1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(angle1-angle2)]. - * @param a1 the axis-angle to be compared to this axis-angle - * @param epsilon the threshold value + * @param a1 the axis-angle to be compared to this axis-angle + * @param epsilon the threshold value */ public boolean epsilonEquals(AxisAngle4f a1, float epsilon) { @@ -520,7 +520,7 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + (long)VecMathUtil.floatToIntBits(x); @@ -551,10 +551,10 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Get the axis angle, in radians.<br> - * An axis angle is a rotation angle about the vector (x,y,z). - * + * An axis angle is a rotation angle about the vector (x,y,z). + * * @return Returns the angle, in radians. - * + * * @since vecmath 1.5 */ public final float getAngle() { @@ -564,10 +564,10 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Set the axis angle, in radians.<br> - * An axis angle is a rotation angle about the vector (x,y,z). - * + * An axis angle is a rotation angle about the vector (x,y,z). + * * @param angle The angle to set, in radians. - * + * * @since vecmath 1.5 */ public final void setAngle(float angle) { @@ -576,10 +576,10 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** - * Get value of <i>x</i> coordinate. - * + * Get value of <i>x</i> coordinate. + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getX() { @@ -589,9 +589,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Set a new value for <i>x</i> coordinate. - * + * * @param x the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(float x) { @@ -601,9 +601,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Get value of <i>y</i> coordinate. - * - * @return the <i>y</i> coordinate - * + * + * @return the <i>y</i> coordinate + * * @since vecmath 1.5 */ public final float getY() { @@ -613,9 +613,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Set a new value for <i>y</i> coordinate. - * + * * @param y the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(float y) { @@ -625,9 +625,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Get value of <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getZ() { @@ -637,9 +637,9 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { /** * Set a new value for <i>z</i> coordinate. - * + * * @param z the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(float z) { diff --git a/src/javax/vecmath/Color3b.java b/src/javax/vecmath/Color3b.java index eab17f9..248d462 100644 --- a/src/javax/vecmath/Color3b.java +++ b/src/javax/vecmath/Color3b.java @@ -40,7 +40,7 @@ import java.awt.Color; * respectively. * <p> * Note that Java defines a byte as a signed integer in the range - * [-128, 127]. However, colors are more typically represented by values + * [-128, 127]. However, colors are more typically represented by values * in the range [0, 255]. Java 3D recognizes this and for color * treats the bytes as if the range were [0, 255]---in other words, as * if the bytes were unsigned. diff --git a/src/javax/vecmath/Color3f.java b/src/javax/vecmath/Color3f.java index d6b3d5a..fde1848 100644 --- a/src/javax/vecmath/Color3f.java +++ b/src/javax/vecmath/Color3f.java @@ -35,9 +35,9 @@ import java.awt.Color; /** - * A three-element color value represented by single precision floating - * point x,y,z values. The x,y,z values represent the red, green, and - * blue color values, respectively. Color components should be in the + * A three-element color value represented by single precision floating + * point x,y,z values. The x,y,z values represent the red, green, and + * blue color values, respectively. Color components should be in the * range of [0.0, 1.0]. * <p> * Java 3D assumes that a linear (gamma-corrected) visual is used for diff --git a/src/javax/vecmath/Color4b.java b/src/javax/vecmath/Color4b.java index 88d0e3f..38206af 100644 --- a/src/javax/vecmath/Color4b.java +++ b/src/javax/vecmath/Color4b.java @@ -35,7 +35,7 @@ import java.awt.Color; /** - * A four-byte color value represented by byte x, y, z, and w values. + * A four-byte color value represented by byte x, y, z, and w values. * The x, y, z, and w values represent the red, green, blue, and alpha * values, respectively. * <p> diff --git a/src/javax/vecmath/Color4f.java b/src/javax/vecmath/Color4f.java index b36278c..e0066c4 100644 --- a/src/javax/vecmath/Color4f.java +++ b/src/javax/vecmath/Color4f.java @@ -35,9 +35,9 @@ import java.awt.Color; /** - * A four-element color represented by single precision floating point + * A four-element color represented by single precision floating point * x, y, z, and w values. The x, y, z, and w values represent the red, - * blue, green, and alpha color values, respectively. Color and alpha + * blue, green, and alpha color values, respectively. Color and alpha * components should be in the range [0.0, 1.0]. * <p> * Java 3D assumes that a linear (gamma-corrected) visual is used for diff --git a/src/javax/vecmath/GMatrix.java b/src/javax/vecmath/GMatrix.java index b73bb07..0e9f613 100644 --- a/src/javax/vecmath/GMatrix.java +++ b/src/javax/vecmath/GMatrix.java @@ -48,13 +48,13 @@ public class GMatrix implements java.io.Serializable, Cloneable { int nRow; int nCol; - // double dereference is slow + // double dereference is slow double[][] values; private static final double EPS = 1.0E-10; /** - * Constructs an nRow by NCol identity matrix. + * Constructs an nRow by NCol identity matrix. * Note that because row and column numbering begins with * zero, nRow and nCol will be one larger than the maximum * possible matrix index values. @@ -85,18 +85,18 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } - /** - * Constructs an nRow by nCol matrix initialized to the values + /** + * Constructs an nRow by nCol matrix initialized to the values * in the matrix array. The array values are copied in one row at - * a time in row major fashion. The array should be at least + * a time in row major fashion. The array should be at least * nRow*nCol in length. - * Note that because row and column numbering begins with + * Note that because row and column numbering begins with * zero, nRow and nCol will be one larger than the maximum * possible matrix index values. - * @param nRow number of rows in this matrix. - * @param nCol number of columns in this matrix. + * @param nRow number of rows in this matrix. + * @param nCol number of columns in this matrix. * @param matrix a 1D array that specifies a matrix in row major fashion - */ + */ public GMatrix(int nRow, int nCol, double[] matrix) { values = new double[nRow][nCol]; @@ -111,11 +111,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } - /** + /** * Constructs a new GMatrix and copies the initial values * from the parameter matrix. * @param matrix the source of the initial values of the new GMatrix - */ + */ public GMatrix(GMatrix matrix) { nRow = matrix.nRow; @@ -132,9 +132,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Sets the value of this matrix to the result of multiplying itself - * with matrix m1 (this = this * m1). + * with matrix m1 (this = this * m1). * @param m1 the other matrix - */ + */ public final void mul(GMatrix m1) { int i, j, k; @@ -149,11 +149,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { for (j = 0; j < nCol; j++) { tmp[i][j] = 0.0; for (k = 0; k < nCol; k++) { - tmp[i][j] += values[i][k]*m1.values[k][j]; + tmp[i][j] += values[i][k]*m1.values[k][j]; } } } - + values = tmp; } @@ -177,11 +177,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { for (j = 0; j < m2.nCol; j++) { tmp[i][j] = 0.0; for (k = 0; k < m1.nCol; k++) { - tmp[i][j] += m1.values[i][k]*m2.values[k][j]; + tmp[i][j] += m1.values[i][k]*m2.values[k][j]; } } } - + values = tmp; } @@ -215,16 +215,16 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Sets the value of this matrix to sum of itself and matrix m1. * @param m1 the other matrix - */ + */ public final void add(GMatrix m1) { int i, j; - if (nRow != m1.nRow) + if (nRow != m1.nRow) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix4")); - if (nCol != m1.nCol) + if (nCol != m1.nCol) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix5")); @@ -239,20 +239,20 @@ public class GMatrix implements java.io.Serializable, Cloneable { * Sets the value of this matrix to the matrix sum of matrices m1 and m2. * @param m1 the first matrix * @param m2 the second matrix - */ + */ public final void add(GMatrix m1, GMatrix m2) { int i, j; - if (m2.nRow != m1.nRow) + if (m2.nRow != m1.nRow) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix6")); - if (m2.nCol != m1.nCol) + if (m2.nCol != m1.nCol) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix7")); - if (nCol != m1.nCol || nRow != m1.nRow) + if (nCol != m1.nCol || nRow != m1.nRow) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix8")); @@ -267,46 +267,46 @@ public class GMatrix implements java.io.Serializable, Cloneable { * Sets the value of this matrix to the matrix difference of itself * and matrix m1 (this = this - m1). * @param m1 the other matrix - */ - public final void sub(GMatrix m1) - { - int i, j; - if (nRow != m1.nRow) + */ + public final void sub(GMatrix m1) + { + int i, j; + if (nRow != m1.nRow) throw new MismatchedSizeException - (VecMathI18N.getString("GMatrix9")); - - if (nCol != m1.nCol) + (VecMathI18N.getString("GMatrix9")); + + if (nCol != m1.nCol) throw new MismatchedSizeException - (VecMathI18N.getString("GMatrix28")); - - for (i = 0; i < nRow; i++) { - for (j = 0; j < nCol; j++) { + (VecMathI18N.getString("GMatrix28")); + + for (i = 0; i < nRow; i++) { + for (j = 0; j < nCol; j++) { values[i][j] = values[i][j] - m1.values[i][j]; - } - } - } + } + } + } /** * Sets the value of this matrix to the matrix difference * of matrices m1 and m2 (this = m1 - m2). * @param m1 the first matrix * @param m2 the second matrix - */ - public final void sub(GMatrix m1, GMatrix m2) + */ + public final void sub(GMatrix m1, GMatrix m2) { int i, j; - if (m2.nRow != m1.nRow) + if (m2.nRow != m1.nRow) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix10")); - if (m2.nCol != m1.nCol) + if (m2.nCol != m1.nCol) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix11")); - if (nRow != m1.nRow || nCol != m1.nCol) + if (nRow != m1.nRow || nCol != m1.nCol) throw new MismatchedSizeException (VecMathI18N.getString("GMatrix12")); - + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { values[i][j] = m1.values[i][j] - m2.values[i][j]; @@ -314,7 +314,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } - /** + /** * Negates the value of this matrix: this = -this. */ public final void negate() @@ -331,7 +331,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { * Sets the value of this matrix equal to the negation of * of the GMatrix parameter. * @param m1 The source matrix - */ + */ public final void negate(GMatrix m1) { int i, j; @@ -377,9 +377,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { int i, j; for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - values[i][j] = 0.0; + values[i][j] = 0.0; } - } + } } /** @@ -389,25 +389,25 @@ public class GMatrix implements java.io.Serializable, Cloneable { public final void identityMinus() { int i, j; - + for(i = 0; i < nRow; i++) { - for(j = 0; j < nCol; j++) { - values[i][j] = -values[i][j]; - } - } - - int l; - if( nRow < nCol) - l = nRow; - else + for(j = 0; j < nCol; j++) { + values[i][j] = -values[i][j]; + } + } + + int l; + if( nRow < nCol) + l = nRow; + else l = nCol; - - for(i = 0; i < l; i++) { - values[i][i] += 1.0; - } + + for(i = 0; i < l; i++) { + values[i][i] += 1.0; + } } - + /** * Inverts this matrix in place. */ @@ -419,8 +419,8 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Inverts matrix m1 and places the new values into this matrix. Matrix * m1 is not modified. - * @param m1 the matrix to be inverted - */ + * @param m1 the matrix to be inverted + */ public final void invert(GMatrix m1) { invertGeneral(m1); @@ -429,11 +429,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Copies a sub-matrix derived from this matrix into the target matrix. * The upper left of the sub-matrix is located at (rowSource, colSource); - * the lower right of the sub-matrix is located at + * the lower right of the sub-matrix is located at * (lastRowSource,lastColSource). The sub-matrix is copied into the * the target matrix starting at (rowDest, colDest). - * @param rowSource the top-most row of the sub-matrix - * @param colSource the left-most column of the sub-matrix + * @param rowSource the top-most row of the sub-matrix + * @param colSource the left-most column of the sub-matrix * @param numRow the number of rows in the sub-matrix * @param numCol the number of columns in the sub-matrix * @param rowDest the top-most row of the position of the copied @@ -442,9 +442,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { * sub-matrix within the target matrix * @param target the matrix into which the sub-matrix will be copied */ - public final void copySubMatrix(int rowSource, int colSource, + public final void copySubMatrix(int rowSource, int colSource, int numRow, int numCol, int rowDest, - int colDest, GMatrix target) + int colDest, GMatrix target) { int i, j; @@ -506,32 +506,32 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Sets the value of this matrix to the values found in the array parameter. - * The values are copied in one row at a time, in row major + * The values are copied in one row at a time, in row major * fashion. The array should be at least equal in length to * the number of matrix rows times the number of matrix columns * in this matrix. * @param matrix the row major source array - */ + */ public final void set(double[] matrix) { int i, j; - - for (i = 0; i < nRow; i++) { + + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { values[i][j] = matrix[nCol*i+j]; - } - } + } + } } /** * Sets the value of this matrix to that of the Matrix3f provided. * @param m1 the matrix - */ + */ public final void set(Matrix3f m1) { int i, j; - if (nCol < 3 || nRow < 3) { // expand matrix if too small + if (nCol < 3 || nRow < 3) { // expand matrix if too small nCol = 3; nRow = 3; values = new double[nRow][nCol]; @@ -549,7 +549,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { values[2][1] = m1.m21; values[2][2] = m1.m22; - for (i = 3; i < nRow; i++) { // pad rest or matrix with zeros + for (i = 3; i < nRow; i++) { // pad rest or matrix with zeros for (j = 3; j < nCol; j++) { values[i][j] = 0.0; } @@ -559,7 +559,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Sets the value of this matrix to that of the Matrix3d provided. * @param m1 the matrix - */ + */ public final void set(Matrix3d m1) { if (nRow < 3 || nCol < 3) { @@ -580,7 +580,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { values[2][1] = m1.m21; values[2][2] = m1.m22; - for (int i = 3; i < nRow; i++) { // pad rest or matrix with zeros + for (int i = 3; i < nRow; i++) { // pad rest or matrix with zeros for(int j = 3; j < nCol; j++) { values[i][j] = 0.0; } @@ -588,10 +588,10 @@ public class GMatrix implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this matrix to that of the Matrix4f provided. * @param m1 the matrix - */ + */ public final void set(Matrix4f m1) { if (nRow < 4 || nCol < 4) { @@ -620,19 +620,19 @@ public class GMatrix implements java.io.Serializable, Cloneable { values[3][2] = m1.m32; values[3][3] = m1.m33; - for (int i = 4 ; i < nRow; i++) { // pad rest or matrix with zeros + for (int i = 4 ; i < nRow; i++) { // pad rest or matrix with zeros for (int j = 4; j < nCol; j++) { values[i][j] = 0.0; } } } - /** - * Sets the value of this matrix to that of the Matrix4d provided. - * @param m1 the matrix - */ - public final void set(Matrix4d m1) - { + /** + * Sets the value of this matrix to that of the Matrix4d provided. + * @param m1 the matrix + */ + public final void set(Matrix4d m1) + { if (nRow < 4 || nCol < 4) { values = new double[4][4]; nRow = 4; @@ -659,12 +659,12 @@ public class GMatrix implements java.io.Serializable, Cloneable { values[3][2] = m1.m32; values[3][3] = m1.m33; - for (int i = 4; i < nRow; i++) { // pad rest or matrix with zeros + for (int i = 4; i < nRow; i++) { // pad rest or matrix with zeros for (int j = 4; j < nCol; j++) { values[i][j] = 0.0; } } - } + } /** * Sets the value of this matrix to the values found in matrix m1. @@ -686,7 +686,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } - for (i = m1.nRow; i < nRow; i++) { // pad rest or matrix with zeros + for (i = m1.nRow; i < nRow; i++) { // pad rest or matrix with zeros for (j = m1.nCol; j < nCol; j++) { values[i][j] = 0.0; } @@ -716,19 +716,19 @@ public class GMatrix implements java.io.Serializable, Cloneable { * @param row the row number to be retrieved (zero indexed) * @param column the column number to be retrieved (zero indexed) * @return the value at the indexed element - */ + */ public final double getElement(int row, int column) { return(values[row][column]); } - - /** + + /** * Modifies the value at the specified row and column of this matrix. - * @param row the row number to be modified (zero indexed) - * @param column the column number to be modified (zero indexed) + * @param row the row number to be modified (zero indexed) + * @param column the column number to be modified (zero indexed) * @param value the new matrix element value - */ + */ public final void setElement(int row, int column, double value) { values[row][column] = value; @@ -750,12 +750,12 @@ public class GMatrix implements java.io.Serializable, Cloneable { * Places the values of the specified row into the vector parameter. * @param row the target row number * @param vector the vector into which the row values will be placed - */ + */ public final void getRow(int row, GVector vector) { if (vector.getSize() < nCol) vector.setSize(nCol); - + for (int i = 0; i < nCol; i++) { vector.values[i] = values[row][i]; } @@ -778,52 +778,52 @@ public class GMatrix implements java.io.Serializable, Cloneable { * Places the values of the specified column into the vector parameter. * @param col the target column number * @param vector the vector into which the column values will be placed - */ + */ public final void getColumn(int col, GVector vector) { if (vector.getSize() < nRow) vector.setSize(nRow); - - for (int i = 0; i < nRow; i++) { - vector.values[i] = values[i][col]; - } + + for (int i = 0; i < nRow; i++) { + vector.values[i] = values[i][col]; + } } /** * Places the values in the upper 3x3 of this GMatrix into * the matrix m1. * @param m1 The matrix that will hold the new values - */ + */ public final void get(Matrix3d m1) { if (nRow < 3 || nCol < 3) { m1.setZero(); if (nCol > 0) { - if (nRow > 0){ + if (nRow > 0){ m1.m00 = values[0][0]; - if (nRow > 1){ + if (nRow > 1){ m1.m10 = values[1][0]; - if( nRow > 2 ){ + if( nRow > 2 ){ m1.m20= values[2][0]; } } } if (nCol > 1) { - if (nRow > 0) { + if (nRow > 0) { m1.m01 = values[0][1]; - if (nRow > 1){ + if (nRow > 1){ m1.m11 = values[1][1]; - if (nRow > 2){ + if (nRow > 2){ m1.m21 = values[2][1]; } } } if (nCol > 2) { - if (nRow > 0) { + if (nRow > 0) { m1.m02 = values[0][2]; if (nRow > 1) { m1.m12 = values[1][2]; - if (nRow > 2) { + if (nRow > 2) { m1.m22 = values[2][2]; } } @@ -847,41 +847,41 @@ public class GMatrix implements java.io.Serializable, Cloneable { } /** - * Places the values in the upper 3x3 of this GMatrix into - * the matrix m1. + * Places the values in the upper 3x3 of this GMatrix into + * the matrix m1. * @param m1 The matrix that will hold the new values - */ - public final void get(Matrix3f m1) - { + */ + public final void get(Matrix3f m1) + { if (nRow < 3 || nCol < 3) { m1.setZero(); if (nCol > 0) { - if (nRow > 0) { + if (nRow > 0) { m1.m00 = (float)values[0][0]; - if (nRow > 1) { + if (nRow > 1) { m1.m10 = (float)values[1][0]; - if (nRow > 2) { + if (nRow > 2) { m1.m20 = (float)values[2][0]; } } } if (nCol > 1) { - if (nRow > 0) { + if (nRow > 0) { m1.m01 = (float)values[0][1]; - if (nRow > 1){ + if (nRow > 1){ m1.m11 = (float)values[1][1]; - if (nRow > 2){ + if (nRow > 2){ m1.m21 = (float)values[2][1]; } } } if (nCol > 2) { - if (nRow > 0) { + if (nRow > 0) { m1.m02 = (float)values[0][2]; if (nRow > 1) { m1.m12 = (float)values[1][2]; - if (nRow > 2) { + if (nRow > 2) { m1.m22 = (float)values[2][2]; } } @@ -902,64 +902,64 @@ public class GMatrix implements java.io.Serializable, Cloneable { m1.m21 = (float)values[2][1]; m1.m22 = (float)values[2][2]; } - } + } /** - * Places the values in the upper 4x4 of this GMatrix into - * the matrix m1. + * Places the values in the upper 4x4 of this GMatrix into + * the matrix m1. * @param m1 The matrix that will hold the new values - */ - public final void get(Matrix4d m1) - { + */ + public final void get(Matrix4d m1) + { if (nRow < 4 || nCol < 4) { m1.setZero(); if (nCol > 0) { - if (nRow > 0) { + if (nRow > 0) { m1.m00 = values[0][0]; - if (nRow > 1) { + if (nRow > 1) { m1.m10 = values[1][0]; - if (nRow > 2) { + if (nRow > 2) { m1.m20 = values[2][0]; - if (nRow > 3) { + if (nRow > 3) { m1.m30 = values[3][0]; } } } } if (nCol > 1) { - if (nRow > 0) { + if (nRow > 0) { m1.m01 = values[0][1]; - if (nRow > 1) { + if (nRow > 1) { m1.m11 = values[1][1]; - if (nRow > 2) { + if (nRow > 2) { m1.m21 = values[2][1]; - if (nRow > 3) { + if (nRow > 3) { m1.m31 = values[3][1]; } } } } if (nCol > 2) { - if (nRow > 0) { + if (nRow > 0) { m1.m02 = values[0][2]; if (nRow > 1) { m1.m12 = values[1][2]; - if (nRow > 2) { + if (nRow > 2) { m1.m22 = values[2][2]; - if (nRow > 3) { + if (nRow > 3) { m1.m32 = values[3][2]; } } } } if (nCol > 3) { - if (nRow > 0) { + if (nRow > 0) { m1.m03 = values[0][3]; if (nRow > 1) { m1.m13 = values[1][3]; - if (nRow > 2) { + if (nRow > 2) { m1.m23 = values[2][3]; - if (nRow > 3) { + if (nRow > 3) { m1.m33 = values[3][3]; } } @@ -991,15 +991,15 @@ public class GMatrix implements java.io.Serializable, Cloneable { m1.m33 = values[3][3]; } - } + } /** - * Places the values in the upper 4x4 of this GMatrix into - * the matrix m1. + * Places the values in the upper 4x4 of this GMatrix into + * the matrix m1. * @param m1 The matrix that will hold the new values - */ - public final void get(Matrix4f m1) - { + */ + public final void get(Matrix4f m1) + { if (nRow < 4 || nCol < 4) { m1.setZero(); @@ -1012,10 +1012,10 @@ public class GMatrix implements java.io.Serializable, Cloneable { m1.m20 = (float)values[2][0]; if (nRow > 3) { m1.m30 = (float)values[3][0]; - } + } } } - } + } if (nCol > 1) { if (nRow > 0) { m1.m01 = (float)values[0][1]; @@ -1026,8 +1026,8 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (nRow > 3) { m1.m31 = (float)values[3][1]; } - } - } + } + } } if (nCol > 2) { if (nRow > 0) { @@ -1039,9 +1039,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (nRow > 3) { m1.m32 = (float)values[3][2]; } - } - } - } + } + } + } if (nCol > 3) { if (nRow > 0) { m1.m03 = (float)values[0][3]; @@ -1052,13 +1052,13 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (nRow > 3) { m1.m33 = (float)values[3][3]; } - } - } - } - } - } - } - } + } + } + } + } + } + } + } } else { m1.m00 = (float)values[0][0]; m1.m01 = (float)values[0][1]; @@ -1080,15 +1080,15 @@ public class GMatrix implements java.io.Serializable, Cloneable { m1.m32 = (float)values[3][2]; m1.m33 = (float)values[3][3]; } - } + } /** * Places the values in the this GMatrix into the matrix m1; * m1 should be at least as large as this GMatrix. * @param m1 The matrix that will hold the new values - */ - public final void get(GMatrix m1) - { + */ + public final void get(GMatrix m1) + { int i, j, nc, nr; if (nCol < m1.nCol) @@ -1116,12 +1116,12 @@ public class GMatrix implements java.io.Serializable, Cloneable { m1.values[i][j] = 0.0; } } - } + } /** * Copy the values from the array into the specified row of this - * matrix. - * @param row the row of this matrix into which the array values + * matrix. + * @param row the row of this matrix into which the array values * will be copied. * @param array the source array */ @@ -1138,7 +1138,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { * @param row the row of this matrix into which the array values * will be copied * @param vector the source vector - */ + */ public final void setRow(int row, GVector vector) { for(int i = 0; i < nCol; i++) { @@ -1148,11 +1148,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Copy the values from the array into the specified column of this - * matrix. - * @param col the column of this matrix into which the array values + * matrix. + * @param col the column of this matrix into which the array values * will be copied * @param array the source array - */ + */ public final void setColumn(int col, double[] array) { for(int i = 0; i < nRow; i++) { @@ -1166,7 +1166,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { * @param col the column of this matrix into which the array values * will be copied * @param vector the source vector - */ + */ public final void setColumn(int col, GVector vector) { for(int i = 0; i < nRow; i++) { @@ -1180,9 +1180,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { * m2, and places the result into this. * @param m1 The matrix on the left hand side of the multiplication * @param m2 The matrix on the right hand side of the multiplication - */ + */ public final void mulTransposeBoth(GMatrix m1, GMatrix m2) - { + { int i, j, k; if (m1.nRow != m2.nCol || nRow != m1.nCol || nCol != m2.nRow) @@ -1191,35 +1191,35 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (m1 == this || m2 == this) { double[][] tmp = new double[nRow][nCol]; - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - tmp[i][j] = 0.0; + tmp[i][j] = 0.0; for (k = 0; k < m1.nRow; k++) { - tmp[i][j] += m1.values[k][i]*m2.values[j][k]; + tmp[i][j] += m1.values[k][i]*m2.values[j][k]; } - } + } } values = tmp; } else { - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - values[i][j] = 0.0; + values[i][j] = 0.0; for (k = 0; k < m1.nRow; k++) { - values[i][j] += m1.values[k][i]*m2.values[j][k]; + values[i][j] += m1.values[k][i]*m2.values[j][k]; } - } - } + } + } } - } + } - /** + /** * Multiplies matrix m1 times the transpose of matrix m2, and * places the result into this. * @param m1 The matrix on the left hand side of the multiplication * @param m2 The matrix on the right hand side of the multiplication - */ + */ public final void mulTransposeRight(GMatrix m1, GMatrix m2) - { + { int i, j, k; if (m1.nCol != m2.nCol || nCol != m2.nRow || nRow != m1.nRow) @@ -1228,35 +1228,35 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (m1 == this || m2 == this) { double[][] tmp = new double[nRow][nCol]; - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - tmp[i][j] = 0.0; + tmp[i][j] = 0.0; for (k = 0; k < m1.nCol; k++) { - tmp[i][j] += m1.values[i][k]*m2.values[j][k]; + tmp[i][j] += m1.values[i][k]*m2.values[j][k]; } - } + } } values = tmp; } else { - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0;j < nCol; j++) { - values[i][j] = 0.0; + values[i][j] = 0.0; for (k = 0; k < m1.nCol; k++) { - values[i][j] += m1.values[i][k]*m2.values[j][k]; + values[i][j] += m1.values[i][k]*m2.values[j][k]; } - } - } + } + } } - } - + } + - /** + /** * Multiplies the transpose of matrix m1 times matrix m2, and * places the result into this. * @param m1 The matrix on the left hand side of the multiplication * @param m2 The matrix on the right hand side of the multiplication - */ + */ public final void mulTransposeLeft(GMatrix m1, GMatrix m2) { int i, j, k; @@ -1267,27 +1267,27 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (m1 == this || m2 == this) { double[][] tmp = new double[nRow][nCol]; - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - tmp[i][j] = 0.0; + tmp[i][j] = 0.0; for (k = 0; k < m1.nRow; k++) { - tmp[i][j] += m1.values[k][i]*m2.values[k][j]; + tmp[i][j] += m1.values[k][i]*m2.values[k][j]; } - } + } } values = tmp; } else { - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - values[i][j] = 0.0; + values[i][j] = 0.0; for (k = 0; k < m1.nRow; k++) { - values[i][j] += m1.values[k][i]*m2.values[k][j]; + values[i][j] += m1.values[k][i]*m2.values[k][j]; } - } - } + } + } } } - + /** * Transposes this matrix in place. @@ -1302,21 +1302,21 @@ public class GMatrix implements java.io.Serializable, Cloneable { nRow = nCol; nCol = i; tmp = new double[nRow][nCol]; - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { - tmp[i][j] = values[j][i]; - } - } + tmp[i][j] = values[j][i]; + } + } values = tmp; } else { double swap; - for (i = 0; i < nRow; i++) { + for (i = 0; i < nRow; i++) { for (j = 0; j < i; j++) { swap = values[i][j]; values[i][j] = values[j][i]; values[j][i] = swap; - } - } + } + } } } @@ -1346,8 +1346,8 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * Returns a string that contains the values of this GMatrix. * @return the String representation - */ - public String toString() + */ + public String toString() { StringBuffer buffer = new StringBuffer(nRow*nCol*8); @@ -1363,7 +1363,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { return buffer.toString(); } - private static void checkMatrix( GMatrix m) + private static void checkMatrix( GMatrix m) { int i, j; @@ -1402,7 +1402,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { } return (int) (bits ^ (bits >> 32)); - } + } /** @@ -1410,10 +1410,10 @@ public class GMatrix implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this GMatrix. * @param m1 The matrix with which the comparison is made. * @return true or false - */ + */ public boolean equals(GMatrix m1) { - try { + try { int i, j; if (nRow != m1.nRow || nCol != m1.nCol) @@ -1426,7 +1426,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } return true; - } + } catch (NullPointerException e2) { return false; } @@ -1438,10 +1438,10 @@ public class GMatrix implements java.io.Serializable, Cloneable { * this GMatrix. * @param o1 The object with which the comparison is made. * @return true or false - */ + */ public boolean equals(Object o1) { - try { + try { GMatrix m2 = (GMatrix) o1; int i, j; if (nRow != m2.nRow || nCol != m2.nCol) @@ -1478,7 +1478,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { * MAX[i=0,1,2, . . .n ; j=0,1,2, . . .n ; abs(this.m(i,j) - m1.m(i,j)] * @param m1 The matrix to be compared to this matrix * @param epsilon the threshold value - */ + */ public boolean epsilonEquals(GMatrix m1, double epsilon) { int i, j; @@ -1505,9 +1505,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { int i, l; double t; - if (nRow < nCol) + if (nRow < nCol) l = nRow; - else + else l = nCol; t = 0.0; @@ -1518,15 +1518,15 @@ public class GMatrix implements java.io.Serializable, Cloneable { } /** - * Finds the singular value decomposition (SVD) of this matrix + * Finds the singular value decomposition (SVD) of this matrix * such that this = U*W*transpose(V); and returns the rank of - * this matrix; the values of U,W,V are all overwritten. Note + * this matrix; the values of U,W,V are all overwritten. Note * that the matrix V is output as V, and - * not transpose(V). If this matrix is mxn, then U is mxm, W + * not transpose(V). If this matrix is mxn, then U is mxm, W * is a diagonal matrix that is mxn, and V is nxn. Using the * notation W = diag(w), then the inverse of this matrix is: * inverse(this) = V*diag(1/w)*tranpose(U), where diag(1/w) - * is the same matrix as W except that the reciprocal of each + * is the same matrix as W except that the reciprocal of each * of the diagonal components is used. * @param U The computed U matrix in the equation this = U*W*transpose(V) * @param W The computed W matrix in the equation this = U*W*transpose(V) @@ -1535,7 +1535,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { */ public final int SVD(GMatrix U, GMatrix W, GMatrix V) { - // check for consistancy in dimensions + // check for consistancy in dimensions if (nCol != V.nCol || nCol != V.nRow) { throw new MismatchedSizeException (VecMathI18N.getString("GMatrix18")); @@ -1595,10 +1595,10 @@ public class GMatrix implements java.io.Serializable, Cloneable { /** * LU Decomposition: this matrix must be a square matrix and the - * LU GMatrix parameter must be the same size as this matrix. - * The matrix LU will be overwritten as the combination of a + * LU GMatrix parameter must be the same size as this matrix. + * The matrix LU will be overwritten as the combination of a * lower diagonal and upper diagonal matrix decompostion of this - * matrix; the diagonal + * matrix; the diagonal * elements of L (unity) are not stored. The GVector parameter * records the row permutation effected by the partial pivoting, * and is used as a parameter to the GVector method LUDBackSolve @@ -1646,9 +1646,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } - // Calculate LU decomposition: Is the matrix singular? + // Calculate LU decomposition: Is the matrix singular? if (!luDecomposition(LU.nRow, temp, row_perm, even_row_exchange)) { - // Matrix has no inverse + // Matrix has no inverse throw new SingularMatrixException (VecMathI18N.getString("GMatrix21")); } @@ -1666,18 +1666,18 @@ public class GMatrix implements java.io.Serializable, Cloneable { return even_row_exchange[0]; } - /** - * Sets this matrix to a uniform scale matrix; all of the - * values are reset. - * @param scale The new scale value - */ - public final void setScale(double scale) - { + /** + * Sets this matrix to a uniform scale matrix; all of the + * values are reset. + * @param scale The new scale value + */ + public final void setScale(double scale) + { int i, j, l; - if (nRow < nCol) + if (nRow < nCol) l = nRow; - else + else l = nCol; for (i = 0; i < nRow; i++) { @@ -1689,7 +1689,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { for (i = 0; i < l; i++) { values[i][i] = scale; } - } + } /** * General invert routine. Inverts m1 and places the result in "this". @@ -1710,26 +1710,26 @@ public class GMatrix implements java.io.Serializable, Cloneable { // Use LU decomposition and backsubstitution code specifically // for floating-point nxn matrices. if (m1.nRow != m1.nCol) { - // Matrix is either under or over determined + // Matrix is either under or over determined throw new MismatchedSizeException (VecMathI18N.getString("GMatrix22")); } - // Copy source matrix to temp + // Copy source matrix to temp for (i = 0; i < nRow; i++) { for (j = 0; j < nCol; j++) { temp[i*nCol+j] = m1.values[i][j]; } } - // Calculate LU decomposition: Is the matrix singular? + // Calculate LU decomposition: Is the matrix singular? if (!luDecomposition(m1.nRow, temp, row_perm, even_row_exchange)) { - // Matrix has no inverse + // Matrix has no inverse throw new SingularMatrixException (VecMathI18N.getString("GMatrix21")); } - // Perform back substitution on the identity matrix + // Perform back substitution on the identity matrix for (i = 0; i < size; i++) result[i] = 0.0; @@ -1746,20 +1746,20 @@ public class GMatrix implements java.io.Serializable, Cloneable { } /** - * Given a nxn array "matrix0", this function replaces it with the - * LU decomposition of a row-wise permutation of itself. The input - * parameters are "matrix0" and "dim". The array "matrix0" is also - * an output parameter. The vector "row_perm[]" is an output - * parameter that contains the row permutations resulting from partial - * pivoting. The output parameter "even_row_xchg" is 1 when the - * number of row exchanges is even, or -1 otherwise. Assumes data + * Given a nxn array "matrix0", this function replaces it with the + * LU decomposition of a row-wise permutation of itself. The input + * parameters are "matrix0" and "dim". The array "matrix0" is also + * an output parameter. The vector "row_perm[]" is an output + * parameter that contains the row permutations resulting from partial + * pivoting. The output parameter "even_row_xchg" is 1 when the + * number of row exchanges is even, or -1 otherwise. Assumes data * type is always double. * * @return true if the matrix is nonsingular, or false otherwise. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 40-45. // static boolean luDecomposition(int dim, double[] matrix0, @@ -1767,7 +1767,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { double row_scale[] = new double[dim]; - // Determine implicit scaling information by looping over rows + // Determine implicit scaling information by looping over rows int i, j; int ptr, rs, mtx; double big, temp; @@ -1776,12 +1776,12 @@ public class GMatrix implements java.io.Serializable, Cloneable { rs = 0; even_row_xchg[0] = 1; - // For each row ... + // For each row ... i = dim; while (i-- != 0) { big = 0.0; - // For each column, find the largest element in the row + // For each column, find the largest element in the row j = dim; while (j-- != 0) { temp = matrix0[ptr++]; @@ -1791,21 +1791,21 @@ public class GMatrix implements java.io.Serializable, Cloneable { } } - // Is the matrix singular? + // Is the matrix singular? if (big == 0.0) { return false; } row_scale[rs++] = 1.0 / big; } - // For all columns, execute Crout's method + // For all columns, execute Crout's method mtx = 0; for (j = 0; j < dim; j++) { int imax, k; int target, p1, p2; double sum; - // Determine elements of upper diagonal matrix U + // Determine elements of upper diagonal matrix U for (i = 0; i < j; i++) { target = mtx + (dim*i) + j; sum = matrix0[target]; @@ -1837,7 +1837,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { } matrix0[target] = sum; - // Is this the best pivot so far? + // Is this the best pivot so far? if ((temp = row_scale[i] * Math.abs(sum)) >= big) { big = temp; imax = i; @@ -1848,9 +1848,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { throw new RuntimeException(VecMathI18N.getString("GMatrix24")); } - // Is a row exchange necessary? + // Is a row exchange necessary? if (j != imax) { - // Yes: exchange rows + // Yes: exchange rows k = dim; p1 = mtx + (dim*imax); p2 = mtx + (dim*j); @@ -1860,20 +1860,20 @@ public class GMatrix implements java.io.Serializable, Cloneable { matrix0[p2++] = temp; } - // Record change in scale factor + // Record change in scale factor row_scale[imax] = row_scale[j]; even_row_xchg[0] = -even_row_xchg[0]; // change exchange parity } - // Record row permutation + // Record row permutation row_perm[j] = imax; - // Is the matrix singular + // Is the matrix singular if (matrix0[(mtx + (dim*j) + j)] == 0.0) { return false; } - // Divide elements of lower diagonal matrix L by pivot + // Divide elements of lower diagonal matrix L by pivot if (j != (dim-1)) { temp = 1.0 / (matrix0[(mtx + (dim*j) + j)]); target = mtx + (dim*(j+1)) + j; @@ -1903,8 +1903,8 @@ public class GMatrix implements java.io.Serializable, Cloneable { * derived. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 44-45. // static void luBacksubstitution(int dim, double[] matrix1, @@ -1915,17 +1915,17 @@ public class GMatrix implements java.io.Serializable, Cloneable { int rp; int cv, rv, ri; double tt; - + // rp = row_perm; rp = 0; - // For each column vector of matrix2 ... + // For each column vector of matrix2 ... for (k = 0; k < dim; k++) { // cv = &(matrix2[0][k]); cv = k; ii = -1; - // Forward substitution + // Forward substitution for (i = 0; i < dim; i++) { double sum; @@ -1945,13 +1945,13 @@ public class GMatrix implements java.io.Serializable, Cloneable { matrix2[cv+dim*i] = sum; } - // Backsubstitution + // Backsubstitution for (i = 0; i < dim; i++) { ri = (dim-1-i); rv = dim*(ri); tt = 0.0; for(j=1;j<=i;j++) { - tt += matrix1[rv+dim-j] * matrix2[cv+dim*(dim-j)]; + tt += matrix1[rv+dim-j] * matrix2[cv+dim*(dim-j)]; } matrix2[cv+dim*ri]= (matrix2[cv+dim*ri] - tt) / matrix1[rv+ri]; } @@ -1980,7 +1980,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { eLength = m.nRow; } - if (m.nRow > m.nCol) + if (m.nRow > m.nCol) vecLength = m.nRow; else vecLength = m.nCol; @@ -2001,7 +2001,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { nr = m.nRow; nc = m.nCol; - // householder reduction + // householder reduction for (si = 0; si < sLength; si++) { // for each singular value @@ -2085,7 +2085,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { // update U matrix for (j = si; j < m.nRow; j++) { for (k = 0; k < m.nCol; k++) { - tmp.values[j][k] = 0.0; + tmp.values[j][k] = 0.0; for (i = si; i < m.nCol; i++) { tmp.values[j][k] += u.values[j][i] * U.values[i][k]; } @@ -2188,7 +2188,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { // update V matrix for (j = 0; j < m.nRow; j++) { for (k = si + 1; k < m.nCol; k++) { - tmp.values[j][k] = 0.0; + tmp.values[j][k] = 0.0; for (i = si + 1; i < m.nCol; i++) { tmp.values[j][k] += v.values[i][k] * V.values[j][i]; } @@ -2247,11 +2247,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { } // compute_qr causes ArrayIndexOutOfBounds for 2x2 matrices - compute_qr (0, e.length-1, single_values, e, U, V); + compute_qr (0, e.length-1, single_values, e, U, V); // compute rank = number of non zero singular values rank = single_values.length; - + // sort by order of size of single values // and check for zero's return rank; @@ -2268,7 +2268,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { double[] sinl = new double[1]; double[] sinr = new double[1]; GMatrix m = new GMatrix(u.nCol, v.nRow); - + final int MAX_INTERATIONS = 2; final double CONVERGE_TOL = 4.89E-15; @@ -2303,12 +2303,12 @@ public class GMatrix implements java.io.Serializable, Cloneable { f = 0.0; g = 0.0; - + for (k = 0; k < MAX_INTERATIONS && !converged;k++) { for (i = start; i <= end; i++) { - // if at start of iterfaction compute shift - if (i == start) { + // if at start of iterfaction compute shift + if (i == start) { if (e.length == s.length) sl = end; else @@ -2319,7 +2319,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { f = (Math.abs(s[i]) - shift) * (d_sign(c_b48, s[i]) + shift/s[i]); g = e[i]; - } + } r = compute_rot(f, g, sinr, cosr); if (i != start) @@ -2362,7 +2362,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { update_v(i, v, cosr, sinr); if (debug) print_m(m,u,v); - } + } if (debug) { System.out.println @@ -2371,8 +2371,8 @@ public class GMatrix implements java.io.Serializable, Cloneable { print_svd(s, e, u, v); } - // check for convergence on off diagonals and reduce - while ((end-start > 1) && (Math.abs(e[end]) < CONVERGE_TOL)) { + // check for convergence on off diagonals and reduce + while ((end-start > 1) && (Math.abs(e[end]) < CONVERGE_TOL)) { end--; } @@ -2382,9 +2382,9 @@ public class GMatrix implements java.io.Serializable, Cloneable { compute_qr(n + 1, end, s, e, u, v); // do lower matrix end = n - 1; // do upper matrix - // check for convergence on off diagonals and reduce + // check for convergence on off diagonals and reduce while ((end - start > 1) && - (Math.abs(e[end]) < CONVERGE_TOL)) { + (Math.abs(e[end]) < CONVERGE_TOL)) { end--; } } @@ -2477,7 +2477,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { s[i+1] = compute_rot(f, g, sinr, cosr); update_v_split(i, k+1, v, cosr, sinr, t, m); } - + private static void chase_across(double[] s, double[] e, int k, GMatrix u) { double f, g, r; double[] cosl = new double[1]; @@ -2599,10 +2599,10 @@ public class GMatrix implements java.io.Serializable, Cloneable { mtmp.mul(u, mtmp); mtmp.mul(mtmp, v); System.out.println("\n m = \n" + mtmp.toString(mtmp)); - + } - private static String toString(GMatrix m) + private static String toString(GMatrix m) { StringBuffer buffer = new StringBuffer(m.nRow * m.nCol * 8); int i, j; @@ -2627,12 +2627,12 @@ public class GMatrix implements java.io.Serializable, Cloneable { System.out.println(" \ns = "); for (i = 0; i < s.length; i++) { - System.out.println(" " + s[i]); + System.out.println(" " + s[i]); } System.out.println(" \ne = "); for (i = 0; i < e.length; i++) { - System.out.println(" " + e[i]); + System.out.println(" " + e[i]); } System.out.println(" \nu = \n" + u.toString()); @@ -2655,14 +2655,14 @@ public class GMatrix implements java.io.Serializable, Cloneable { } static double max(double a, double b) { - if (a > b) + if (a > b) return a; else return b; } static double min(double a, double b) { - if (a < b) + if (a < b) return a; else return b; @@ -2672,7 +2672,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { double d__1, d__2; double fhmn, fhmx, c, fa, ga, ha, as, at, au; double ssmin; - + fa = Math.abs(f); ga = Math.abs(g); ha = Math.abs(h); @@ -2708,7 +2708,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { ssmin += ssmin; } } - } + } return ssmin; } @@ -2719,7 +2719,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { double c_b3 = 2.0; double c_b4 = 1.0; - + double d__1; int pmax; double temp; @@ -2729,7 +2729,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { boolean gasmal; double tt, clt, crt, slt, srt; double ssmin,ssmax; - + ssmax = single_values[0]; ssmin = single_values[1]; clt = 0.0; @@ -2742,11 +2742,11 @@ public class GMatrix implements java.io.Serializable, Cloneable { fa = Math.abs(ft); ht = h; ha = Math.abs(h); - + pmax = 1; - if (ha > fa) + if (ha > fa) swap = true; - else + else swap = false; if (swap) { @@ -2757,7 +2757,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { temp = fa; fa = ha; ha = temp; - + } gt = g; @@ -2791,24 +2791,24 @@ public class GMatrix implements java.io.Serializable, Cloneable { if (gasmal) { d = fa - ha; if (d == fa) { - + l = 1.0; } else { l = d / fa; } - + m = gt / ft; t = 2.0 - l; mm = m * m; tt = t * t; s = Math.sqrt(tt + mm); - + if (l == 0.0) { r = Math.abs(m); } else { r = Math.sqrt(l * l + mm); } - + a = (s + r) * 0.5; if (ga > fa) { pmax = 2; @@ -2833,20 +2833,20 @@ public class GMatrix implements java.io.Serializable, Cloneable { } else { l = d / fa; } - + m = gt / ft; t = 2.0 - l; - + mm = m * m; tt = t * t; s = Math.sqrt(tt + mm); - + if (l == 0.) { r = Math.abs(m); } else { r = Math.sqrt(l * l + mm); } - + a = (s + r) * 0.5; ssmin = ha / a; ssmax = fa * a; @@ -2879,7 +2879,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { csr[0] = crt; snr[0] = srt; } - + if (pmax == 1) { tsign = d_sign(c_b4, csr[0]) * d_sign(c_b4, csl[0]) * d_sign(c_b4, f); @@ -2896,7 +2896,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { single_values[index] = d_sign(ssmax, tsign); d__1 = tsign * d_sign(c_b4, f) * d_sign(c_b4, h); single_values[index+1] = d_sign(ssmin, d__1); - } + } return 0; } @@ -2912,7 +2912,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { double r; final double safmn2 = 2.002083095183101E-146; final double safmx2 = 4.994797680505588E+145; - + if (g == 0.0) { cs = 1.0; sn = 0.0; @@ -2965,7 +2965,7 @@ public class GMatrix implements java.io.Serializable, Cloneable { sn = -sn; r = -r; } - } + } sin[0] = sn; cos[0] = cs; return r; diff --git a/src/javax/vecmath/GVector.java b/src/javax/vecmath/GVector.java index 6eaa9b7..f6979ae 100644 --- a/src/javax/vecmath/GVector.java +++ b/src/javax/vecmath/GVector.java @@ -54,12 +54,12 @@ public class GVector implements java.io.Serializable, Cloneable { public GVector(int length) { int i; - - this.length = length; + + this.length = length; values = new double[length]; for(i = 0; i < length; i++) values[i] = 0.0; } - + /** * Constructs a new GVector from the specified array elements. * The length of this GVector is set to the length of the @@ -70,12 +70,12 @@ public class GVector implements java.io.Serializable, Cloneable { public GVector(double[] vector) { int i; - - length = vector.length; + + length = vector.length; values = new double[vector.length]; for(i = 0; i < length; i++) values[i] = vector[i]; } - + /** * Constructs a new GVector from the specified vector. * The vector elements are copied into this new GVector. @@ -84,7 +84,7 @@ public class GVector implements java.io.Serializable, Cloneable { public GVector(GVector vector) { int i; - + values = new double[vector.length]; length = vector.length; for(i = 0; i < length; i++) values[i] = vector.values[i]; @@ -103,11 +103,11 @@ public class GVector implements java.io.Serializable, Cloneable { length = 2; } - /** + /** * Constructs a new GVector and copies the initial values * from the specified tuple. * @param tuple the source for the new GVector's initial values - */ + */ public GVector(Tuple3f tuple) { values = new double[3]; @@ -117,11 +117,11 @@ public class GVector implements java.io.Serializable, Cloneable { length = 3; } - /** + /** * Constructs a new GVector and copies the initial values * from the specified tuple. * @param tuple the source for the new GVector's initial values - */ + */ public GVector(Tuple3d tuple) { values = new double[3]; @@ -131,11 +131,11 @@ public class GVector implements java.io.Serializable, Cloneable { length = 3; } - /** + /** * Constructs a new GVector and copies the initial values * from the specified tuple. * @param tuple the source for the new GVector's initial values - */ + */ public GVector(Tuple4f tuple) { values = new double[4]; @@ -146,11 +146,11 @@ public class GVector implements java.io.Serializable, Cloneable { length = 4; } - /** + /** * Constructs a new GVector and copies the initial values * from the specified tuple. * @param tuple the source for the new GVector's initial values - */ + */ public GVector(Tuple4d tuple) { values = new double[4]; @@ -185,8 +185,8 @@ public class GVector implements java.io.Serializable, Cloneable { * Returns the square root of the sum of the squares of this * vector (its length in n-dimensional space). * @return length of this vector - */ - + */ + public final double norm() { double sq = 0.0; @@ -194,25 +194,25 @@ public class GVector implements java.io.Serializable, Cloneable { for(i=0;i<length;i++) { sq += values[i]*values[i]; - } + } return(Math.sqrt(sq)); } - /** - * Returns the sum of the squares of this - * vector (its length squared in n-dimensional space). - * @return length squared of this vector + /** + * Returns the sum of the squares of this + * vector (its length squared in n-dimensional space). + * @return length squared of this vector */ - public final double normSquared() - { + public final double normSquared() + { double sq = 0.0; int i; for(i=0;i<length;i++) { sq += values[i]*values[i]; - } + } return(sq); } @@ -220,7 +220,7 @@ public class GVector implements java.io.Serializable, Cloneable { /** * Sets the value of this vector to the normalization of vector v1. * @param v1 the un-normalized vector - */ + */ public final void normalize(GVector v1) { double sq = 0.0; @@ -231,7 +231,7 @@ public class GVector implements java.io.Serializable, Cloneable { for(i=0;i<length;i++) { sq += v1.values[i]*v1.values[i]; - } + } double invMag; invMag = 1.0/Math.sqrt(sq); @@ -241,18 +241,18 @@ public class GVector implements java.io.Serializable, Cloneable { } } - + /** - * Normalizes this vector in place. - */ - public final void normalize() - { + * Normalizes this vector in place. + */ + public final void normalize() + { double sq = 0.0; int i; for(i=0;i<length;i++) { sq += values[i]*values[i]; - } + } double invMag; invMag = 1.0/Math.sqrt(sq); @@ -261,14 +261,14 @@ public class GVector implements java.io.Serializable, Cloneable { values[i] = values[i]*invMag; } - } + } /** * Sets the value of this vector to the scalar multiplication * of the scale factor with the vector v1. * @param s the scalar value - * @param v1 the source vector - */ + * @param v1 the source vector + */ public final void scale(double s, GVector v1) { int i; @@ -280,18 +280,18 @@ public class GVector implements java.io.Serializable, Cloneable { } } - /** - * Scales this vector by the scale factor s. - * @param s the scalar value - */ - public final void scale(double s) - { + /** + * Scales this vector by the scale factor s. + * @param s the scalar value + */ + public final void scale(double s) + { int i; for(i=0;i<length;i++) { values[i] = values[i]*s; } - } + } /** * Sets the value of this vector to the scalar multiplication by s @@ -305,7 +305,7 @@ public class GVector implements java.io.Serializable, Cloneable { int i; - if( v2.length != v1.length ) + if( v2.length != v1.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector2")); if( length != v1.length ) @@ -320,11 +320,11 @@ public class GVector implements java.io.Serializable, Cloneable { * Sets the value of this vector to sum of itself and the specified * vector * @param vector the second vector - */ + */ public final void add(GVector vector) { int i; - + if( length != vector.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector4")); @@ -338,17 +338,17 @@ public class GVector implements java.io.Serializable, Cloneable { * and vector2. * @param vector1 the first vector * @param vector2 the second vector - */ + */ public final void add(GVector vector1, GVector vector2) { int i; - if( vector1.length != vector2.length ) + if( vector1.length != vector2.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector5")); if( length != vector1.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector6")); - + for(i = 0; i < length; i++) this.values[i] = vector1.values[i] + vector2.values[i]; } @@ -357,31 +357,31 @@ public class GVector implements java.io.Serializable, Cloneable { * Sets the value of this vector to the vector difference of itself * and vector (this = this - vector). * @param vector the other vector - */ - public final void sub(GVector vector) - { + */ + public final void sub(GVector vector) + { int i; - + if( length != vector.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector7")); for(i = 0; i < length; i++) { this.values[i] -= vector.values[i]; } - } + } /** * Sets the value of this vector to the vector difference * of vectors vector1 and vector2 (this = vector1 - vector2). * @param vector1 the first vector * @param vector2 the second vector - */ - public final void sub(GVector vector1, GVector vector2) + */ + public final void sub(GVector vector1, GVector vector2) { int i,l; - - if( vector1.length != vector2.length ) + + if( vector1.length != vector2.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector8")); if( length != vector1.length ) @@ -393,12 +393,12 @@ public class GVector implements java.io.Serializable, Cloneable { /** * Multiplies matrix m1 times Vector v1 and places the result - * into this vector (this = m1*v1). + * into this vector (this = m1*v1). * @param m1 The matrix in the multiplication * @param v1 The vector that is multiplied */ public final void mul(GMatrix m1, GVector v1) { - if (m1.getNumCol() != v1.length) + if (m1.getNumCol() != v1.length) throw new MismatchedSizeException(VecMathI18N.getString("GVector10")); if (length != m1.getNumRow()) @@ -419,18 +419,18 @@ public class GVector implements java.io.Serializable, Cloneable { } } - /** + /** * Multiplies the transpose of vector v1 (ie, v1 becomes a row - * vector with respect to the multiplication) times matrix m1 - * and places the result into this vector - * (this = transpose(v1)*m1). The result is technically a + * vector with respect to the multiplication) times matrix m1 + * and places the result into this vector + * (this = transpose(v1)*m1). The result is technically a * row vector, but the GVector class only knows about column * vectors, and so the result is stored as a column vector. * @param m1 The matrix in the multiplication * @param v1 The vector that is temporarily transposed - */ - public final void mul(GVector v1, GMatrix m1) { - if (m1.getNumRow() != v1.length) + */ + public final void mul(GVector v1, GMatrix m1) { + if (m1.getNumRow() != v1.length) throw new MismatchedSizeException(VecMathI18N.getString("GVector12")); if (length != m1.getNumCol()) @@ -449,9 +449,9 @@ public class GVector implements java.io.Serializable, Cloneable { values[j] += m1.values[i][j] * v[i]; } } - } + } - /** + /** * Negates the value of this vector: this = -this. */ public final void negate() { @@ -494,13 +494,13 @@ public class GVector implements java.io.Serializable, Cloneable { } /** - * Sets the value of this vector to the values found in the array + * Sets the value of this vector to the values found in the array * parameter. The array should be at least equal in length to * the number of elements in the vector. * @param vector the source array - */ + */ public final void set(double[] vector) { - for(int i = length-1; i >=0; i--) + for(int i = length-1; i >=0; i--) values[i] = vector[i]; } @@ -510,11 +510,11 @@ public class GVector implements java.io.Serializable, Cloneable { */ public final void set(GVector vector) { int i; - + if (length < vector.length) { length = vector.length; values = new double[length]; - for(i = 0; i < length; i++) + for(i = 0; i < length; i++) values[i] = vector.values[i]; }else { for(i = 0; i < vector.length; i++) @@ -527,7 +527,7 @@ public class GVector implements java.io.Serializable, Cloneable { /** * Sets the value of this vector to the values in tuple * @param tuple the source for the new GVector's new values - */ + */ public final void set(Tuple2f tuple) { if (length < 2) { @@ -540,10 +540,10 @@ public class GVector implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this vector to the values in tuple * @param tuple the source for the new GVector's new values - */ + */ public final void set(Tuple3f tuple) { if (length < 3) { @@ -556,10 +556,10 @@ public class GVector implements java.io.Serializable, Cloneable { for(int i = 3; i < length; i++) values[i] = 0.0; } - /** + /** * Sets the value of this vector to the values in tuple * @param tuple the source for the new GVector's new values - */ + */ public final void set(Tuple3d tuple) { if (length < 3) { @@ -572,10 +572,10 @@ public class GVector implements java.io.Serializable, Cloneable { for(int i = 3; i < length; i++) values[i] = 0.0; } - /** + /** * Sets the value of this vector to the values in tuple * @param tuple the source for the new GVector's new values - */ + */ public final void set(Tuple4f tuple) { if (length < 4) { @@ -589,10 +589,10 @@ public class GVector implements java.io.Serializable, Cloneable { for(int i = 4; i < length; i++) values[i] = 0.0; } - /** + /** * Sets the value of this vector to the values in tuple * @param tuple the source for the new GVector's new values - */ + */ public final void set(Tuple4d tuple) { if (length < 4) { @@ -619,18 +619,18 @@ public class GVector implements java.io.Serializable, Cloneable { * Retrieves the value at the specified index value of this vector. * @param index the index of the element to retrieve (zero indexed) * @return the value at the indexed element - */ + */ public final double getElement(int index) { return values[index]; } - - /** + + /** * Modifies the value at the specified index of this vector. - * @param index the index if the element to modify (zero indexed) + * @param index the index if the element to modify (zero indexed) * @param value the new vector element value - */ + */ public final void setElement(int index, double value) { values[index] = value; @@ -639,7 +639,7 @@ public class GVector implements java.io.Serializable, Cloneable { /** * Returns a string that contains the values of this GVector. * @return the String representation - */ + */ public String toString() { StringBuffer buffer = new StringBuffer(length*8); @@ -671,7 +671,7 @@ public class GVector implements java.io.Serializable, Cloneable { } return (int) (bits ^ (bits >> 32)); - } + } /** @@ -679,10 +679,10 @@ public class GVector implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this GVector. * @param vector1 The vector with which the comparison is made. * @return true or false - */ + */ public boolean equals(GVector vector1) { - try { + try { if( length != vector1.length) return false; for(int i = 0;i<length;i++) { @@ -700,10 +700,10 @@ public class GVector implements java.io.Serializable, Cloneable { * this GMatrix. * @param o1 The object with which the comparison is made. * @return true or false - */ + */ public boolean equals(Object o1) { - try { + try { GVector v2 = (GVector) o1; if( length != v2.length) return false; @@ -720,12 +720,12 @@ public class GVector implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this vector - * and vector v1 is less than or equal to the epsilon parameter, + * and vector v1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[abs(x1-x2), abs(y1-y2), . . . ]. * @param v1 The vector to be compared to this vector - * @param epsilon the threshold value + * @param epsilon the threshold value */ public boolean epsilonEquals(GVector v1, double epsilon) { @@ -747,7 +747,7 @@ public class GVector implements java.io.Serializable, Cloneable { */ public final double dot(GVector v1) { - if( length != v1.length) + if( length != v1.length) throw new MismatchedSizeException(VecMathI18N.getString("GVector14")); double result = 0.0; @@ -756,13 +756,13 @@ public class GVector implements java.io.Serializable, Cloneable { } return result; } - - + + /** * Solves for x in Ax = b, where x is this vector (nx1), A is mxn, * b is mx1, and A = U*W*transpose(V); U,W,V must - * be precomputed and can be found by taking the singular value - * decomposition (SVD) of A using the method SVD found in the + * be precomputed and can be found by taking the singular value + * decomposition (SVD) of A using the method SVD found in the * GMatrix class. * @param U The U matrix produced by the GMatrix method SVD * @param W The W matrix produced by the GMatrix method SVD @@ -795,21 +795,21 @@ public class GVector implements java.io.Serializable, Cloneable { * LU Decomposition Back Solve; this method takes the LU matrix * and the permutation vector produced by the GMatrix method LUD * and solves the equation (LU)*x = b by placing the solution vector - * x into this vector. This vector should be the same length or - * longer than b. + * x into this vector. This vector should be the same length or + * longer than b. * @param LU The matrix into which the lower and upper decompostions * have been placed * @param b The b vector in the equation (LU)*x = b - * @param permutation The row permuations that were necessary to + * @param permutation The row permuations that were necessary to * produce the LU matrix parameter - */ + */ public final void LUDBackSolve(GMatrix LU, GVector b, GVector permutation) { int size = LU.nRow*LU.nCol; double[] temp = new double[size]; double[] result = new double[size]; - int[] row_perm = new int[b.getSize()]; + int[] row_perm = new int[b.getSize()]; int i,j; if( LU.nRow != b.getSize() ) { @@ -830,13 +830,13 @@ public class GVector implements java.io.Serializable, Cloneable { } } - for(i=0;i<size;i++) result[i] = 0.0; - for(i=0;i<LU.nRow;i++) result[i*LU.nCol] = b.values[i]; - for(i=0;i<LU.nCol;i++) row_perm[i] = (int)permutation.values[i]; + for(i=0;i<size;i++) result[i] = 0.0; + for(i=0;i<LU.nRow;i++) result[i*LU.nCol] = b.values[i]; + for(i=0;i<LU.nCol;i++) row_perm[i] = (int)permutation.values[i]; GMatrix.luBacksubstitution(LU.nRow, temp, row_perm, result); - for(i=0;i<LU.nRow;i++) this.values[i] = result[i*LU.nCol]; + for(i=0;i<LU.nRow;i++) this.values[i] = result[i*LU.nCol]; } /** @@ -873,11 +873,11 @@ public class GVector implements java.io.Serializable, Cloneable { * result into this tuple: this = (1-alpha)*v1 + alpha*v2. * @param v1 the first vector * @param v2 the second vector - * @param alpha the alpha interpolation parameter - */ + * @param alpha the alpha interpolation parameter + */ public final void interpolate(GVector v1, GVector v2, double alpha) { - if( v2.length != v1.length ) + if( v2.length != v1.length ) throw new MismatchedSizeException(VecMathI18N.getString("GVector20")); if( length != v1.length ) @@ -888,11 +888,11 @@ public class GVector implements java.io.Serializable, Cloneable { } } - /** - * Linearly interpolates between this vector and vector v1 and + /** + * Linearly interpolates between this vector and vector v1 and * places the result into this tuple: this = (1-alpha)*this + alpha*v1. - * @param v1 the first vector - * @param alpha the alpha interpolation parameter + * @param v1 the first vector + * @param alpha the alpha interpolation parameter */ public final void interpolate(GVector v1, double alpha) { @@ -903,7 +903,7 @@ public class GVector implements java.io.Serializable, Cloneable { values[i] = (1-alpha)*values[i] + alpha*v1.values[i]; } } - + /** * Creates a new object of the same class as this object. * diff --git a/src/javax/vecmath/Matrix3d.java b/src/javax/vecmath/Matrix3d.java index 5fedfcb..8dd9d22 100644 --- a/src/javax/vecmath/Matrix3d.java +++ b/src/javax/vecmath/Matrix3d.java @@ -3133,9 +3133,9 @@ static double max3( double[] values) { /** * Set the first matrix element in the first row. - * + * * @param m00 The m00 to set. - * + * * @since vecmath 1.5 */ public final void setM00(double m00) { @@ -3144,9 +3144,9 @@ static double max3( double[] values) { /** * Get the second matrix element in the first row. - * + * * @return Returns the m01. - * + * * @since vecmath 1.5 */ public final double getM01() { @@ -3155,9 +3155,9 @@ static double max3( double[] values) { /** * Set the second matrix element in the first row. - * + * * @param m01 The m01 to set. - * + * * @since vecmath 1.5 */ public final void setM01(double m01) { @@ -3166,9 +3166,9 @@ static double max3( double[] values) { /** * Get the third matrix element in the first row. - * + * * @return Returns the m02. - * + * * @since vecmath 1.5 */ public final double getM02() { @@ -3177,9 +3177,9 @@ static double max3( double[] values) { /** * Set the third matrix element in the first row. - * + * * @param m02 The m02 to set. - * + * * @since vecmath 1.5 */ public final void setM02(double m02) { @@ -3188,9 +3188,9 @@ static double max3( double[] values) { /** * Get first matrix element in the second row. - * + * * @return Returns the m10. - * + * * @since vecmath 1.5 */ public final double getM10() { @@ -3199,9 +3199,9 @@ static double max3( double[] values) { /** * Set first matrix element in the second row. - * + * * @param m10 The m10 to set. - * + * * @since vecmath 1.5 */ public final void setM10(double m10) { @@ -3210,9 +3210,9 @@ static double max3( double[] values) { /** * Get second matrix element in the second row. - * + * * @return Returns the m11. - * + * * @since vecmath 1.5 */ public final double getM11() { @@ -3221,9 +3221,9 @@ static double max3( double[] values) { /** * Set the second matrix element in the second row. - * + * * @param m11 The m11 to set. - * + * * @since vecmath 1.5 */ public final void setM11(double m11) { @@ -3232,9 +3232,9 @@ static double max3( double[] values) { /** * Get the third matrix element in the second row. - * + * * @return Returns the m12. - * + * * @since vecmath 1.5 */ public final double getM12() { @@ -3243,9 +3243,9 @@ static double max3( double[] values) { /** * Set the third matrix element in the second row. - * + * * @param m12 The m12 to set. - * + * * @since vecmath 1.5 */ public final void setM12(double m12) { @@ -3254,9 +3254,9 @@ static double max3( double[] values) { /** * Get the first matrix element in the third row. - * + * * @return Returns the m20. - * + * * @since vecmath 1.5 */ public final double getM20() { @@ -3265,9 +3265,9 @@ static double max3( double[] values) { /** * Set the first matrix element in the third row. - * + * * @param m20 The m20 to set. - * + * * @since vecmath 1.5 */ public final void setM20(double m20) { @@ -3276,9 +3276,9 @@ static double max3( double[] values) { /** * Get the second matrix element in the third row. - * + * * @return Returns the m21. - * + * * @since vecmath 1.5 */ public final double getM21() { @@ -3287,9 +3287,9 @@ static double max3( double[] values) { /** * Set the second matrix element in the third row. - * + * * @param m21 The m21 to set. - * + * * @since vecmath 1.5 */ public final void setM21(double m21) { @@ -3298,9 +3298,9 @@ static double max3( double[] values) { /** * Get the third matrix element in the third row . - * + * * @return Returns the m22. - * + * * @since vecmath 1.5 */ public final double getM22() { @@ -3309,9 +3309,9 @@ static double max3( double[] values) { /** * Set the third matrix element in the third row. - * + * * @param m22 The m22 to set. - * + * * @since vecmath 1.5 */ public final void setM22(double m22) { diff --git a/src/javax/vecmath/Matrix3f.java b/src/javax/vecmath/Matrix3f.java index 76f65d3..8079b4c 100644 --- a/src/javax/vecmath/Matrix3f.java +++ b/src/javax/vecmath/Matrix3f.java @@ -43,47 +43,47 @@ public class Matrix3f implements java.io.Serializable, Cloneable { // Compatible with 1.1 static final long serialVersionUID = 329697160112089834L; - /** + /** * The first matrix element in the first row. */ public float m00; - /** + /** * The second matrix element in the first row. */ public float m01; - /** + /** * The third matrix element in the first row. */ public float m02; - /** + /** * The first matrix element in the second row. */ public float m10; - /** + /** * The second matrix element in the second row. */ public float m11; - /** + /** * The third matrix element in the second row. */ public float m12; - /** + /** * The first matrix element in the third row. */ public float m20; - /** + /** * The second matrix element in the third row. */ public float m21; - /** + /** * The third matrix element in the third row. */ public float m22; @@ -94,7 +94,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { */ private static final double EPS = 1.0E-8; - + /** * Constructs and initializes a Matrix3f from the specified nine values. @@ -127,7 +127,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Constructs and initializes a Matrix3f from the specified + * Constructs and initializes a Matrix3f from the specified * nine-element array. this.m00 =v[0], this.m01=v[1], etc. * @param v the array of length 9 containing in order */ @@ -147,49 +147,49 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } - /** - * Constructs a new matrix with the same values as the + /** + * Constructs a new matrix with the same values as the * Matrix3d parameter. * @param m1 the source matrix - */ - public Matrix3f(Matrix3d m1) - { + */ + public Matrix3f(Matrix3d m1) + { this.m00 = (float)m1.m00; this.m01 = (float)m1.m01; this.m02 = (float)m1.m02; - + this.m10 = (float)m1.m10; this.m11 = (float)m1.m11; this.m12 = (float)m1.m12; - + this.m20 = (float)m1.m20; this.m21 = (float)m1.m21; this.m22 = (float)m1.m22; - } - - + } + + /** * Constructs a new matrix with the same values as the * Matrix3f parameter. * @param m1 the source matrix - */ + */ public Matrix3f(Matrix3f m1) { this.m00 = m1.m00; this.m01 = m1.m01; this.m02 = m1.m02; - + this.m10 = m1.m10; this.m11 = m1.m11; this.m12 = m1.m12; - + this.m20 = m1.m20; this.m21 = m1.m21; this.m22 = m1.m22; } - + /** * Constructs and initializes a Matrix3f to all zeros. @@ -241,7 +241,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Sets the scale component of the current matrix by factoring - * out the current scale (by doing an SVD) and multiplying by + * out the current scale (by doing an SVD) and multiplying by * the new scale. * @param scale the new scale amount */ @@ -249,17 +249,17 @@ public class Matrix3f implements java.io.Serializable, Cloneable { { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); - + this.m00 = (float)(tmp_rot[0] * scale); this.m01 = (float)(tmp_rot[1] * scale); this.m02 = (float)(tmp_rot[2] * scale); - + this.m10 = (float)(tmp_rot[3] * scale); this.m11 = (float)(tmp_rot[4] * scale); this.m12 = (float)(tmp_rot[5] * scale); - + this.m20 = (float)(tmp_rot[6] * scale); this.m21 = (float)(tmp_rot[7] * scale); this.m22 = (float)(tmp_rot[8] * scale); @@ -274,7 +274,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { */ public final void setElement(int row, int column, float value) { - switch (row) + switch (row) { case 0: switch(column) @@ -294,7 +294,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { break; case 1: - switch(column) + switch(column) { case 0: this.m10 = value; @@ -309,9 +309,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { throw new ArrayIndexOutOfBoundsException(VecMathI18N.getString("Matrix3f0")); } break; - + case 2: - switch(column) + switch(column) { case 0: this.m20 = value; @@ -334,7 +334,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Copies the matrix values in the specified row into the vector parameter. + * Copies the matrix values in the specified row into the vector parameter. * @param row the matrix row * @param v the vector into which the matrix row values will be copied */ @@ -358,13 +358,13 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Copies the matrix values in the specified row into the array parameter. + * Copies the matrix values in the specified row into the array parameter. * @param row the matrix row - * @param v the array into which the matrix row values will be copied - */ + * @param v the array into which the matrix row values will be copied + */ public final void getRow(int row, float v[]) { if( row == 0 ) { - v[0] = m00; + v[0] = m00; v[1] = m01; v[2] = m02; } else if(row == 1) { @@ -382,11 +382,11 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Copies the matrix values in the specified column into the vector + * Copies the matrix values in the specified column into the vector * parameter. * @param column the matrix column * @param v the vector into which the matrix row values will be copied - */ + */ public final void getColumn(int column, Vector3f v) { if( column == 0 ) { v.x = m00; @@ -406,12 +406,12 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } - /** - * Copies the matrix values in the specified column into the array + /** + * Copies the matrix values in the specified column into the array * parameter. * @param column the matrix column * @param v the array into which the matrix row values will be copied - */ + */ public final void getColumn(int column, float v[]) { if( column == 0 ) { v[0] = m00; @@ -439,7 +439,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { */ public final float getElement(int row, int column) { - switch (row) + switch (row) { case 0: switch(column) @@ -455,7 +455,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } break; case 1: - switch(column) + switch(column) { case 0: return(this.m10); @@ -467,9 +467,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { break; } break; - + case 2: - switch(column) + switch(column) { case 0: return(this.m20); @@ -481,7 +481,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { break; } break; - + default: break; } @@ -680,21 +680,21 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Performs an SVD normalization of this matrix to calculate - * and return the uniform scale factor. If the matrix has non-uniform - * scale factors, the largest of the x, y, and z scale factors will + * and return the uniform scale factor. If the matrix has non-uniform + * scale factors, the largest of the x, y, and z scale factors will * be returned. This matrix is not modified. * @return the scale factor of this matrix - */ + */ public final float getScale() { - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate(tmp_scale, tmp_rot); return( (float)Matrix3d.max3(tmp_scale )); - } + } /** * Adds a scalar to each component of this matrix. @@ -713,13 +713,13 @@ public class Matrix3f implements java.io.Serializable, Cloneable { m22 += scalar; } - /** + /** * Adds a scalar to each component of the matrix m1 and places * the result into this. Matrix m1 is not modified. * @param scalar the scalar adder. * @param m1 the original matrix values - */ - public final void add(float scalar, Matrix3f m1) + */ + public final void add(float scalar, Matrix3f m1) { this.m00 = m1.m00 + scalar; this.m01 = m1.m01 + scalar; @@ -730,7 +730,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { this.m20 = m1.m20 + scalar; this.m21 = m1.m21 + scalar; this.m22 = m1.m22 + scalar; - } + } /** * Sets the value of this matrix to the matrix sum of matrices m1 and m2. @@ -753,24 +753,24 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to the matrix sum of itself and + * Sets the value of this matrix to the matrix sum of itself and * matrix m1. * @param m1 the other matrix */ public final void add(Matrix3f m1) - { + { this.m00 += m1.m00; this.m01 += m1.m01; this.m02 += m1.m02; - + this.m10 += m1.m10; this.m11 += m1.m11; this.m12 += m1.m12; - + this.m20 += m1.m20; this.m21 += m1.m21; this.m22 += m1.m22; - } + } /** * Sets the value of this matrix to the matrix difference @@ -793,21 +793,21 @@ public class Matrix3f implements java.io.Serializable, Cloneable { this.m22 = m1.m22 - m2.m22; } - /** + /** * Sets the value of this matrix to the matrix difference * of itself and matrix m1 (this = this - m1). * @param m1 the other matrix - */ + */ public final void sub(Matrix3f m1) - { + { this.m00 -= m1.m00; this.m01 -= m1.m01; this.m02 -= m1.m02; - + this.m10 -= m1.m10; this.m11 -= m1.m11; this.m12 -= m1.m12; - + this.m20 -= m1.m20; this.m21 -= m1.m21; this.m22 -= m1.m22; @@ -905,18 +905,18 @@ public class Matrix3f implements java.io.Serializable, Cloneable { float cosTheta = (float)Math.cos((float)a1.angle); float t = (float)1.0 - cosTheta; - float xz = ax * az; + float xz = ax * az; float xy = ax * ay; float yz = ay * az; m00 = t * ax * ax + cosTheta; m01 = t * xy - sinTheta * az; m02 = t * xz + sinTheta * ay; - + m10 = t * xy + sinTheta * az; m11 = t * ay * ay + cosTheta; m12 = t * yz - sinTheta * ax; - + m20 = t * xz - sinTheta * ay; m21 = t * yz + sinTheta * ax; m22 = t * az * az + cosTheta; @@ -954,18 +954,18 @@ public class Matrix3f implements java.io.Serializable, Cloneable { double cosTheta = Math.cos(a1.angle); double t = 1.0 - cosTheta; - double xz = ax * az; + double xz = ax * az; double xy = ax * ay; double yz = ay * az; m00 = (float)(t * ax * ax + cosTheta); m01 = (float)(t * xy - sinTheta * az); m02 = (float)(t * xz + sinTheta * ay); - + m10 = (float)(t * xy + sinTheta * az); m11 = (float)(t * ay * ay + cosTheta); m12 = (float)(t * yz - sinTheta * ax); - + m20 = (float)(t * xz - sinTheta * ay); m21 = (float)(t * yz + sinTheta * ax); m22 = (float)(t * az * az + cosTheta); @@ -993,34 +993,34 @@ public class Matrix3f implements java.io.Serializable, Cloneable { this.m22 = (float) (1.0 - 2.0*q1.x*q1.x - 2.0*q1.y*q1.y); } - /** - * Sets the values in this Matrix3f equal to the row-major - * array parameter (ie, the first three elements of the - * array will be copied into the first row of this matrix, etc.). - * @param m the single precision array of length 9 - */ - public final void set(float[] m) + /** + * Sets the values in this Matrix3f equal to the row-major + * array parameter (ie, the first three elements of the + * array will be copied into the first row of this matrix, etc.). + * @param m the single precision array of length 9 + */ + public final void set(float[] m) { m00 = m[0]; m01 = m[1]; m02 = m[2]; - + m10 = m[3]; m11 = m[4]; m12 = m[5]; - + m20 = m[6]; m21 = m[7]; m22 = m[8]; - - } + + } /** - * Sets the value of this matrix to the value of the Matrix3f - * argument. - * @param m1 the source matrix3f - */ + * Sets the value of this matrix to the value of the Matrix3f + * argument. + * @param m1 the source matrix3f + */ public final void set(Matrix3f m1) { this.m00 = m1.m00; @@ -1037,28 +1037,28 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } - + /** - * Sets the value of this matrix to the float value of the Matrix3d - * argument. - * @param m1 the source matrix3d - */ - public final void set(Matrix3d m1) { - - this.m00 = (float)m1.m00; - this.m01 = (float)m1.m01; - this.m02 = (float)m1.m02; - - this.m10 = (float)m1.m10; + * Sets the value of this matrix to the float value of the Matrix3d + * argument. + * @param m1 the source matrix3d + */ + public final void set(Matrix3d m1) { + + this.m00 = (float)m1.m00; + this.m01 = (float)m1.m01; + this.m02 = (float)m1.m02; + + this.m10 = (float)m1.m10; this.m11 = (float)m1.m11; this.m12 = (float)m1.m12; - + this.m20 = (float)m1.m20; - this.m21 = (float)m1.m21; + this.m21 = (float)m1.m21; this.m22 = (float)m1.m22; - + } - + /** * Sets the value of this matrix to the matrix inverse @@ -1095,27 +1095,27 @@ public class Matrix3f implements java.io.Serializable, Cloneable { // Use LU decomposition and backsubstitution code specifically // for floating-point 3x3 matrices. - // Copy source matrix to t1tmp + // Copy source matrix to t1tmp temp[0] = (double)m1.m00; temp[1] = (double)m1.m01; temp[2] = (double)m1.m02; - + temp[3] = (double)m1.m10; temp[4] = (double)m1.m11; temp[5] = (double)m1.m12; - + temp[6] = (double)m1.m20; temp[7] = (double)m1.m21; temp[8] = (double)m1.m22; - - // Calculate LU decomposition: Is the matrix singular? + + // Calculate LU decomposition: Is the matrix singular? if (!luDecomposition(temp, row_perm)) { - // Matrix has no inverse + // Matrix has no inverse throw new SingularMatrixException(VecMathI18N.getString("Matrix3f12")); } - // Perform back substitution on the identity matrix + // Perform back substitution on the identity matrix for(i=0;i<9;i++) result[i] = 0.0; result[0] = 1.0; result[4] = 1.0; result[8] = 1.0; luBacksubstitution(temp, row_perm, result); @@ -1127,7 +1127,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { this.m10 = (float)result[3]; this.m11 = (float)result[4]; this.m12 = (float)result[5]; - + this.m20 = (float)result[6]; this.m21 = (float)result[7]; this.m22 = (float)result[8]; @@ -1135,13 +1135,13 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Given a 3x3 array "matrix0", this function replaces it with the - * LU decomposition of a row-wise permutation of itself. The input - * parameters are "matrix0" and "dimen". The array "matrix0" is also - * an output parameter. The vector "row_perm[3]" is an output - * parameter that contains the row permutations resulting from partial - * pivoting. The output parameter "even_row_xchg" is 1 when the - * number of row exchanges is even, or -1 otherwise. Assumes data + * Given a 3x3 array "matrix0", this function replaces it with the + * LU decomposition of a row-wise permutation of itself. The input + * parameters are "matrix0" and "dimen". The array "matrix0" is also + * an output parameter. The vector "row_perm[3]" is an output + * parameter that contains the row permutations resulting from partial + * pivoting. The output parameter "even_row_xchg" is 1 when the + * number of row exchanges is even, or -1 otherwise. Assumes data * type is always double. * * This function is similar to luDecomposition, except that it @@ -1150,8 +1150,8 @@ public class Matrix3f implements java.io.Serializable, Cloneable { * @return true if the matrix is nonsingular, or false otherwise. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 40-45. // static boolean luDecomposition(double[] matrix0, @@ -1159,7 +1159,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { double row_scale[] = new double[3]; - // Determine implicit scaling information by looping over rows + // Determine implicit scaling information by looping over rows { int i, j; int ptr, rs; @@ -1168,12 +1168,12 @@ public class Matrix3f implements java.io.Serializable, Cloneable { ptr = 0; rs = 0; - // For each row ... + // For each row ... i = 3; while (i-- != 0) { big = 0.0; - // For each column, find the largest element in the row + // For each column, find the largest element in the row j = 3; while (j-- != 0) { temp = matrix0[ptr++]; @@ -1183,7 +1183,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } } - // Is the matrix singular? + // Is the matrix singular? if (big == 0.0) { return false; } @@ -1197,13 +1197,13 @@ public class Matrix3f implements java.io.Serializable, Cloneable { mtx = 0; - // For all columns, execute Crout's method + // For all columns, execute Crout's method for (j = 0; j < 3; j++) { int i, imax, k; int target, p1, p2; double sum, big, temp; - // Determine elements of upper diagonal matrix U + // Determine elements of upper diagonal matrix U for (i = 0; i < j; i++) { target = mtx + (3*i) + j; sum = matrix0[target]; @@ -1235,7 +1235,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } matrix0[target] = sum; - // Is this the best pivot so far? + // Is this the best pivot so far? if ((temp = row_scale[i] * Math.abs(sum)) >= big) { big = temp; imax = i; @@ -1246,9 +1246,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { throw new RuntimeException(VecMathI18N.getString("Matrix3f13")); } - // Is a row exchange necessary? + // Is a row exchange necessary? if (j != imax) { - // Yes: exchange rows + // Yes: exchange rows k = 3; p1 = mtx + (3*imax); p2 = mtx + (3*j); @@ -1258,19 +1258,19 @@ public class Matrix3f implements java.io.Serializable, Cloneable { matrix0[p2++] = temp; } - // Record change in scale factor + // Record change in scale factor row_scale[imax] = row_scale[j]; } - // Record row permutation + // Record row permutation row_perm[j] = imax; - // Is the matrix singular + // Is the matrix singular if (matrix0[(mtx + (3*j) + j)] == 0.0) { return false; } - // Divide elements of lower diagonal matrix L by pivot + // Divide elements of lower diagonal matrix L by pivot if (j != (3-1)) { temp = 1.0 / (matrix0[(mtx + (3*j) + j)]); target = mtx + (3*(j+1)) + j; @@ -1300,8 +1300,8 @@ public class Matrix3f implements java.io.Serializable, Cloneable { * derived. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 44-45. // static void luBacksubstitution(double[] matrix1, @@ -1311,17 +1311,17 @@ public class Matrix3f implements java.io.Serializable, Cloneable { int i, ii, ip, j, k; int rp; int cv, rv; - + // rp = row_perm; rp = 0; - // For each column vector of matrix2 ... + // For each column vector of matrix2 ... for (k = 0; k < 3; k++) { // cv = &(matrix2[0][k]); cv = k; ii = -1; - // Forward substitution + // Forward substitution for (i = 0; i < 3; i++) { double sum; @@ -1341,7 +1341,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { matrix2[cv+3*i] = sum; } - // Backsubstitution + // Backsubstitution // rv = &(matrix1[3][0]); rv = 2*3; matrix2[cv+3*2] /= matrix1[rv+2]; @@ -1366,7 +1366,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { float total; total = this.m00*(this.m11*this.m22 - this.m12*this.m21) + this.m01*(this.m12*this.m20 - this.m10*this.m22) - + this.m02*(this.m10*this.m21 - this.m11*this.m20); + + this.m02*(this.m10*this.m21 - this.m11*this.m20); return total; } @@ -1391,7 +1391,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the x axis. * @param angle the angle to rotate about the X axis in radians */ @@ -1416,7 +1416,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the y axis. * @param angle the angle to rotate about the Y axis in radians */ @@ -1441,7 +1441,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the z axis. * @param angle the angle to rotate about the Z axis in radians */ @@ -1484,33 +1484,33 @@ public class Matrix3f implements java.io.Serializable, Cloneable { m22 *= scalar; } - /** + /** * Multiplies each element of matrix m1 by a scalar and places * the result into this. Matrix m1 is not modified. * @param scalar the scalar multiplier * @param m1 the original matrix - */ + */ public final void mul(float scalar, Matrix3f m1) - { + { this.m00 = scalar * m1.m00; this.m01 = scalar * m1.m01; this.m02 = scalar * m1.m02; - + this.m10 = scalar * m1.m10; this.m11 = scalar * m1.m11; this.m12 = scalar * m1.m12; - + this.m20 = scalar * m1.m20; this.m21 = scalar * m1.m21; this.m22 = scalar * m1.m22; - } + } /** * Sets the value of this matrix to the result of multiplying itself * with matrix m1. * @param m1 the other matrix - */ + */ public final void mul(Matrix3f m1) { float m00, m01, m02, @@ -1520,15 +1520,15 @@ public class Matrix3f implements java.io.Serializable, Cloneable { m00 = this.m00*m1.m00 + this.m01*m1.m10 + this.m02*m1.m20; m01 = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21; m02 = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22; - + m10 = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; m11 = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21; m12 = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22; - + m20 = this.m20*m1.m00 + this.m21*m1.m10 + this.m22*m1.m20; m21 = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21; m22 = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; @@ -1559,17 +1559,17 @@ public class Matrix3f implements java.io.Serializable, Cloneable { m10, m11, m12, m20, m21, m22; - m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20; - m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21; - m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22; - - m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20; - m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21; - m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22; - - m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; - m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; - m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; + m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20; + m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21; + m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22; + + m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20; + m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21; + m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22; + + m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; + m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; + m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; @@ -1578,13 +1578,13 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Multiplies this matrix by matrix m1, does an SVD normalization + * Multiplies this matrix by matrix m1, does an SVD normalization * of the result, and places the result back into this matrix. * this = SVDnorm(this*m1). * @param m1 the matrix on the right hand side of the multiplication */ public final void mulNormalize(Matrix3f m1){ - + double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix @@ -1618,41 +1618,41 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Multiplies matrix m1 by matrix m2, does an SVD normalization + * Multiplies matrix m1 by matrix m2, does an SVD normalization * of the result, and places the result into this matrix. * this = SVDnorm(m1*m2). * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication - */ + */ public final void mulNormalize(Matrix3f m1, Matrix3f m2){ - + double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + tmp[0] = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20; tmp[1] = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21; tmp[2] = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22; - + tmp[3] = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20; - tmp[4] = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21; - tmp[5] = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22; - + tmp[4] = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21; + tmp[5] = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22; + tmp[6] = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; - tmp[7] = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; - tmp[8] = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; - + tmp[7] = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; + tmp[8] = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; + Matrix3d.compute_svd( tmp, tmp_scale, tmp_rot); - + this.m00 = (float)(tmp_rot[0]); this.m01 = (float)(tmp_rot[1]); this.m02 = (float)(tmp_rot[2]); - + this.m10 = (float)(tmp_rot[3]); this.m11 = (float)(tmp_rot[4]); this.m12 = (float)(tmp_rot[5]); - + this.m20 = (float)(tmp_rot[6]); this.m21 = (float)(tmp_rot[7]); this.m22 = (float)(tmp_rot[8]); @@ -1681,7 +1681,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } else { float m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m10*m2.m01 + m1.m20*m2.m02; m01 = m1.m00*m2.m10 + m1.m10*m2.m11 + m1.m20*m2.m12; @@ -1701,99 +1701,99 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } } - - /** + + /** * Multiplies matrix m1 times the transpose of matrix m2, and * places the result into this. - * @param m1 the matrix on the left hand side of the multiplication + * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication - */ - public final void mulTransposeRight(Matrix3f m1, Matrix3f m2) - { + */ + public final void mulTransposeRight(Matrix3f m1, Matrix3f m2) + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02; this.m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12; this.m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22; - + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02; this.m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12; this.m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22; - + this.m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02; this.m21 = m1.m20*m2.m10 + m1.m21*m2.m11 + m1.m22*m2.m12; this.m22 = m1.m20*m2.m20 + m1.m21*m2.m21 + m1.m22*m2.m22; } else { float m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02; m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12; m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22; - m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02; + m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02; m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12; m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22; - m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02; + m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02; m21 = m1.m20*m2.m10 + m1.m21*m2.m11 + m1.m22*m2.m12; m22 = m1.m20*m2.m20 + m1.m21*m2.m21 + m1.m22*m2.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; } - } + } - /** - * Multiplies the transpose of matrix m1 times matrix m2, and - * places the result into this. - * @param m1 the matrix on the left hand side of the multiplication - * @param m2 the matrix on the right hand side of the multiplication - */ - public final void mulTransposeLeft(Matrix3f m1, Matrix3f m2) - { + /** + * Multiplies the transpose of matrix m1 times matrix m2, and + * places the result into this. + * @param m1 the matrix on the left hand side of the multiplication + * @param m2 the matrix on the right hand side of the multiplication + */ + public final void mulTransposeLeft(Matrix3f m1, Matrix3f m2) + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20; this.m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21; this.m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22; - + this.m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20; this.m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21; this.m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22; - + this.m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20; this.m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21; this.m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22; } else { float m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20; m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21; m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22; - m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20; + m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20; m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21; m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22; - m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20; + m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20; m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21; m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; - } + } } /** - * Performs singular value decomposition normalization of this matrix. + * Performs singular value decomposition normalization of this matrix. */ public final void normalize(){ - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -1812,11 +1812,11 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } - /** - * Perform singular value decomposition normalization of matrix m1 - * and place the normalized values into this. + /** + * Perform singular value decomposition normalization of matrix m1 + * and place the normalized values into this. * @param m1 the matrix values to be normalized - */ + */ public final void normalize(Matrix3f m1){ double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix @@ -1825,25 +1825,25 @@ public class Matrix3f implements java.io.Serializable, Cloneable { tmp[0] = m1.m00; tmp[1] = m1.m01; tmp[2] = m1.m02; - + tmp[3] = m1.m10; tmp[4] = m1.m11; tmp[5] = m1.m12; - + tmp[6] = m1.m20; tmp[7] = m1.m21; tmp[8] = m1.m22; - + Matrix3d.compute_svd( tmp, tmp_scale, tmp_rot ); - + this.m00 = (float)(tmp_rot[0]); this.m01 = (float)(tmp_rot[1]); this.m02 = (float)(tmp_rot[2]); - + this.m10 = (float)(tmp_rot[3]); this.m11 = (float)(tmp_rot[4]); this.m12 = (float)(tmp_rot[5]); - + this.m20 = (float)(tmp_rot[6]); this.m21 = (float)(tmp_rot[7]); this.m22 = (float)(tmp_rot[8]); @@ -1851,7 +1851,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Perform cross product normalization of this matrix. + * Perform cross product normalization of this matrix. */ public final void normalizeCP() { @@ -1872,8 +1872,8 @@ public class Matrix3f implements java.io.Serializable, Cloneable { } /** - * Perform cross product normalization of matrix m1 and place the - * normalized values into this. + * Perform cross product normalization of matrix m1 and place the + * normalized values into this. * @param m1 Provides the matrix values to be normalized */ public final void normalizeCP(Matrix3f m1) @@ -1899,7 +1899,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this Matrix3f. * @param m1 the matrix with which the comparison is made * @return true or false - */ + */ public boolean equals(Matrix3f m1) { try { @@ -1907,7 +1907,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { return(this.m00 == m1.m00 && this.m01 == m1.m01 && this.m02 == m1.m02 && this.m10 == m1.m10 && this.m11 == m1.m11 && this.m12 == m1.m12 && this.m20 == m1.m20 && this.m21 == m1.m21 && this.m22 == m1.m22); - } + } catch (NullPointerException e2) { return false; } } @@ -1918,28 +1918,28 @@ public class Matrix3f implements java.io.Serializable, Cloneable { * this Matrix3f. * @param o1 the object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object o1) { - try { + try { Matrix3f m2 = (Matrix3f) o1; return(this.m00 == m2.m00 && this.m01 == m2.m01 && this.m02 == m2.m02 && this.m10 == m2.m10 && this.m11 == m2.m11 && this.m12 == m2.m12 && this.m20 == m2.m20 && this.m21 == m2.m21 && this.m22 == m2.m22); } - catch (ClassCastException e1) { return false; } + catch (ClassCastException e1) { return false; } catch (NullPointerException e2) { return false; } } /** - * Returns true if the L-infinite distance between this matrix - * and matrix m1 is less than or equal to the epsilon parameter, + * Returns true if the L-infinite distance between this matrix + * and matrix m1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[i=0,1,2 ; j=0,1,2 ; abs(this.m(i,j) - m1.m(i,j)] * @param m1 the matrix to be compared to this matrix - * @param epsilon the threshold value + * @param epsilon the threshold value */ public boolean epsilonEquals(Matrix3f m1, float epsilon) { @@ -1969,7 +1969,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + (long)VecMathUtil.floatToIntBits(m00); @@ -1993,11 +1993,11 @@ public class Matrix3f implements java.io.Serializable, Cloneable { m00 = 0.0f; m01 = 0.0f; m02 = 0.0f; - + m10 = 0.0f; m11 = 0.0f; m12 = 0.0f; - + m20 = 0.0f; m21 = 0.0f; m22 = 0.0f; @@ -2006,17 +2006,17 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Negates the value of this matrix: this = -this. - */ + */ public final void negate() { this.m00 = -this.m00; this.m01 = -this.m01; this.m02 = -this.m02; - + this.m10 = -this.m10; this.m11 = -this.m11; this.m12 = -this.m12; - + this.m20 = -this.m20; this.m21 = -this.m21; this.m22 = -this.m22; @@ -2027,17 +2027,17 @@ public class Matrix3f implements java.io.Serializable, Cloneable { * Sets the value of this matrix equal to the negation of * of the Matrix3f parameter. * @param m1 the source matrix - */ + */ public final void negate(Matrix3f m1) { this.m00 = -m1.m00; this.m01 = -m1.m01; this.m02 = -m1.m02; - + this.m10 = -m1.m10; this.m11 = -m1.m11; this.m12 = -m1.m12; - + this.m20 = -m1.m20; this.m21 = -m1.m21; this.m22 = -m1.m22; @@ -2051,32 +2051,32 @@ public class Matrix3f implements java.io.Serializable, Cloneable { */ public final void transform(Tuple3f t) { float x,y,z; - x = m00* t.x + m01*t.y + m02*t.z; - y = m10* t.x + m11*t.y + m12*t.z; - z = m20* t.x + m21*t.y + m22*t.z; + x = m00* t.x + m01*t.y + m02*t.z; + y = m10* t.x + m11*t.y + m12*t.z; + z = m20* t.x + m21*t.y + m22*t.z; t.set(x,y,z); } /** - * Multiply this matrix by the tuple t and and place the result + * Multiply this matrix by the tuple t and and place the result * into the tuple "result" (result = this*t). * @param t the tuple to be multiplied by this matrix * @param result the tuple into which the product is placed */ - public final void transform(Tuple3f t, Tuple3f result) { + public final void transform(Tuple3f t, Tuple3f result) { float x,y,z; - x = m00* t.x + m01*t.y + m02*t.z; + x = m00* t.x + m01*t.y + m02*t.z; y = m10* t.x + m11*t.y + m12*t.z; - result.z = m20* t.x + m21*t.y + m22*t.z; + result.z = m20* t.x + m21*t.y + m22*t.z; result.x = x; result.y = y; - } + } /** - * perform SVD (if necessary to get rotational component + * perform SVD (if necessary to get rotational component */ void getScaleRotate( double[] scales, double[] rot ) { - + double[] tmp = new double[9]; // scratch matrix tmp[0] = m00; tmp[1] = m01; @@ -2090,7 +2090,7 @@ public class Matrix3f implements java.io.Serializable, Cloneable { Matrix3d.compute_svd(tmp, scales, rot); return; - + } /** @@ -2112,12 +2112,12 @@ public class Matrix3f implements java.io.Serializable, Cloneable { return m1; } - + /** * Get the first matrix element in the first row. - * + * * @return Returns the m00. - * + * * @since vecmath 1.5 */ public final float getM00() { @@ -2126,9 +2126,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the first matrix element in the first row. - * + * * @param m00 The m00 to set. - * + * * @since vecmath 1.5 */ public final void setM00(float m00) { @@ -2137,10 +2137,10 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get the second matrix element in the first row. - * + * * @return Returns the m01. - * - * + * + * * @since vecmath 1.5 */ public final float getM01() { @@ -2149,9 +2149,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the first row. - * + * * @param m01 The m01 to set. - * + * * @since vecmath 1.5 */ public final void setM01(float m01) { @@ -2160,9 +2160,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the first row. - * + * * @return Returns the m02. - * + * * @since vecmath 1.5 */ public final float getM02() { @@ -2171,9 +2171,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the first row. - * + * * @param m02 The m02 to set. - * + * * @since vecmath 1.5 */ public final void setM02(float m02) { @@ -2182,9 +2182,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get first matrix element in the second row. - * + * * @return Returns the m10. - * + * * @since vecmath 1.5 */ public final float getM10() { @@ -2193,9 +2193,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set first matrix element in the second row. - * + * * @param m10 The m10 to set. - * + * * @since vecmath 1.5 */ public final void setM10(float m10) { @@ -2204,9 +2204,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get second matrix element in the second row. - * + * * @return Returns the m11. - * + * * @since vecmath 1.5 */ public final float getM11() { @@ -2215,9 +2215,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the second row. - * + * * @param m11 The m11 to set. - * + * * @since vecmath 1.5 */ public final void setM11(float m11) { @@ -2226,9 +2226,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the second row. - * + * * @return Returns the m12. - * + * * @since vecmath 1.5 */ public final float getM12() { @@ -2246,9 +2246,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get the first matrix element in the third row. - * + * * @return Returns the m20. - * + * * @since vecmath 1.5 */ public final float getM20() { @@ -2257,9 +2257,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the first matrix element in the third row. - * + * * @param m20 The m20 to set. - * + * * @since vecmath 1.5 */ public final void setM20(float m20) { @@ -2268,9 +2268,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get the second matrix element in the third row. - * + * * @return Returns the m21. - * + * * @since vecmath 1.5 */ public final float getM21() { @@ -2279,10 +2279,10 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the third row. - * + * * @param m21 The m21 to set. - * - * @since vecmath 1.5 + * + * @since vecmath 1.5 */ public final void setM21(float m21) { this.m21 = m21; @@ -2290,9 +2290,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the third row . - * + * * @return Returns the m22. - * + * * @since vecmath 1.5 */ public final float getM22() { @@ -2301,9 +2301,9 @@ public class Matrix3f implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the third row. - * + * * @param m22 The m22 to set. - * + * * @since vecmath 1.5 */ public final void setM22(float m22) { diff --git a/src/javax/vecmath/Matrix4d.java b/src/javax/vecmath/Matrix4d.java index 66dc806..c9771eb 100644 --- a/src/javax/vecmath/Matrix4d.java +++ b/src/javax/vecmath/Matrix4d.java @@ -128,7 +128,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { double[] tmp_scale = new double[3]; // scratch matrix */ private static final double EPS = 1.0E-10; - + /** * Constructs and initializes a Matrix4d from the specified 16 values. @@ -215,7 +215,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param s the scale value applied to the rotational components */ public Matrix4d(Quat4d q1, Vector3d t1, double s) - { + { m00 = s*(1.0 - 2.0*q1.y*q1.y - 2.0*q1.z*q1.z); m10 = s*(2.0*(q1.x*q1.y + q1.w*q1.z)); m20 = s*(2.0*(q1.x*q1.z - q1.w*q1.y)); @@ -239,15 +239,15 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } - /** + /** * Constructs and initializes a Matrix4d from the quaternion, - * translation, and scale values; the scale is applied only to the - * rotational components of the matrix (upper 3x3) and not to the - * translational components. - * @param q1 the quaternion value representing the rotational component - * @param t1 the translational component of the matrix - * @param s the scale value applied to the rotational components - */ + * translation, and scale values; the scale is applied only to the + * rotational components of the matrix (upper 3x3) and not to the + * translational components. + * @param q1 the quaternion value representing the rotational component + * @param t1 the translational component of the matrix + * @param s the scale value applied to the rotational components + */ public Matrix4d(Quat4f q1, Vector3d t1, double s) { m00 = s*(1.0 - 2.0*q1.y*q1.y - 2.0*q1.z*q1.z); @@ -274,7 +274,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } /** - * Constructs a new matrix with the same values as the + * Constructs a new matrix with the same values as the * Matrix4d parameter. * @param m1 the source matrix */ @@ -303,31 +303,31 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } /** - * Constructs a new matrix with the same values as the + * Constructs a new matrix with the same values as the * Matrix4f parameter. * @param m1 the source matrix */ public Matrix4d(Matrix4f m1) { - this.m00 = m1.m00; - this.m01 = m1.m01; - this.m02 = m1.m02; - this.m03 = m1.m03; - + this.m00 = m1.m00; + this.m01 = m1.m01; + this.m02 = m1.m02; + this.m03 = m1.m03; + this.m10 = m1.m10; - this.m11 = m1.m11; - this.m12 = m1.m12; - this.m13 = m1.m13; - - this.m20 = m1.m20; - this.m21 = m1.m21; - this.m22 = m1.m22; - this.m23 = m1.m23; - - this.m30 = m1.m30; - this.m31 = m1.m31; - this.m32 = m1.m32; - this.m33 = m1.m33; + this.m11 = m1.m11; + this.m12 = m1.m12; + this.m13 = m1.m13; + + this.m20 = m1.m20; + this.m21 = m1.m21; + this.m22 = m1.m22; + this.m23 = m1.m23; + + this.m30 = m1.m30; + this.m31 = m1.m31; + this.m32 = m1.m32; + this.m33 = m1.m33; } @@ -342,29 +342,29 @@ public class Matrix4d implements java.io.Serializable, Cloneable { */ public Matrix4d(Matrix3f m1, Vector3d t1, double s) { - this.m00 = m1.m00*s; - this.m01 = m1.m01*s; - this.m02 = m1.m02*s; - this.m03 = t1.x; - - this.m10 = m1.m10*s; - this.m11 = m1.m11*s; - this.m12 = m1.m12*s; - this.m13 = t1.y; - - this.m20 = m1.m20*s; - this.m21 = m1.m21*s; - this.m22 = m1.m22*s; - this.m23 = t1.z; - - this.m30 = 0.0; - this.m31 = 0.0; - this.m32 = 0.0; - this.m33 = 1.0; - - } - - /** + this.m00 = m1.m00*s; + this.m01 = m1.m01*s; + this.m02 = m1.m02*s; + this.m03 = t1.x; + + this.m10 = m1.m10*s; + this.m11 = m1.m11*s; + this.m12 = m1.m12*s; + this.m13 = t1.y; + + this.m20 = m1.m20*s; + this.m21 = m1.m21*s; + this.m22 = m1.m22*s; + this.m23 = t1.z; + + this.m30 = 0.0; + this.m31 = 0.0; + this.m32 = 0.0; + this.m33 = 1.0; + + } + + /** * Constructs and initializes a Matrix4f from the rotation matrix, * translation, and scale values; the scale is applied only to the * rotational components of the matrix (upper 3x3) and not to the @@ -372,28 +372,28 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param m1 the rotation matrix representing the rotational components * @param t1 the translational components of the matrix * @param s the scale value applied to the rotational components - */ + */ public Matrix4d(Matrix3d m1, Vector3d t1, double s) { - this.m00 = m1.m00*s; - this.m01 = m1.m01*s; - this.m02 = m1.m02*s; - this.m03 = t1.x; - - this.m10 = m1.m10*s; - this.m11 = m1.m11*s; - this.m12 = m1.m12*s; - this.m13 = t1.y; - - this.m20 = m1.m20*s; - this.m21 = m1.m21*s; - this.m22 = m1.m22*s; - this.m23 = t1.z; - - this.m30 = 0.0; - this.m31 = 0.0; - this.m32 = 0.0; - this.m33 = 1.0; + this.m00 = m1.m00*s; + this.m01 = m1.m01*s; + this.m02 = m1.m02*s; + this.m03 = t1.x; + + this.m10 = m1.m10*s; + this.m11 = m1.m11*s; + this.m12 = m1.m12*s; + this.m13 = t1.y; + + this.m20 = m1.m20*s; + this.m21 = m1.m21*s; + this.m22 = m1.m22*s; + this.m23 = t1.z; + + this.m30 = 0.0; + this.m31 = 0.0; + this.m32 = 0.0; + this.m33 = 1.0; } @@ -427,7 +427,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Returns a string that contains the values of this Matrix4d. * @return the String representation - */ + */ public String toString() { return this.m00 + ", " + this.m01 + ", " + this.m02 + ", " + this.m03 + "\n" + @@ -470,7 +470,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { */ public final void setElement(int row, int column, double value) { - switch (row) + switch (row) { case 0: switch(column) @@ -493,7 +493,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { break; case 1: - switch(column) + switch(column) { case 0: this.m10 = value; @@ -513,7 +513,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { break; case 2: - switch(column) + switch(column) { case 0: this.m20 = value; @@ -533,7 +533,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { break; case 3: - switch(column) + switch(column) { case 0: this.m30 = value; @@ -565,7 +565,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { */ public final double getElement(int row, int column) { - switch (row) + switch (row) { case 0: switch(column) @@ -583,7 +583,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } break; case 1: - switch(column) + switch(column) { case 0: return(this.m10); @@ -597,9 +597,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { break; } break; - + case 2: - switch(column) + switch(column) { case 0: return(this.m20); @@ -613,9 +613,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { break; } break; - + case 3: - switch(column) + switch(column) { case 0: return(this.m30); @@ -629,21 +629,21 @@ public class Matrix4d implements java.io.Serializable, Cloneable { break; } break; - + default: break; } throw new ArrayIndexOutOfBoundsException(VecMathI18N.getString("Matrix4d1")); } - /** - * Copies the matrix values in the specified row into the vector parameter. - * @param row the matrix row - * @param v the vector into which the matrix row values will be copied - */ + /** + * Copies the matrix values in the specified row into the vector parameter. + * @param row the matrix row + * @param v the vector into which the matrix row values will be copied + */ public final void getRow(int row, Vector4d v) { if( row == 0 ) { - v.x = m00; + v.x = m00; v.y = m01; v.z = m02; v.w = m03; @@ -665,15 +665,15 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } else { throw new ArrayIndexOutOfBoundsException(VecMathI18N.getString("Matrix4d2")); } - } - - - /** + } + + + /** * Copies the matrix values in the specified row into the array parameter. - * @param row the matrix row - * @param v the array into which the matrix row values will be copied - */ - public final void getRow(int row, double v[]) { + * @param row the matrix row + * @param v the array into which the matrix row values will be copied + */ + public final void getRow(int row, double v[]) { if( row == 0 ) { v[0] = m00; v[1] = m01; @@ -699,33 +699,33 @@ public class Matrix4d implements java.io.Serializable, Cloneable { throw new ArrayIndexOutOfBoundsException(VecMathI18N.getString("Matrix4d2")); } } - - - - /** - * Copies the matrix values in the specified column into the vector + + + + /** + * Copies the matrix values in the specified column into the vector * parameter. * @param column the matrix column - * @param v the vector into which the matrix column values will be copied - */ - public final void getColumn(int column, Vector4d v) { + * @param v the vector into which the matrix column values will be copied + */ + public final void getColumn(int column, Vector4d v) { if( column == 0 ) { - v.x = m00; + v.x = m00; v.y = m10; v.z = m20; v.w = m30; } else if(column == 1) { - v.x = m01; + v.x = m01; v.y = m11; v.z = m21; v.w = m31; } else if(column == 2) { - v.x = m02; + v.x = m02; v.y = m12; v.z = m22; v.w = m32; } else if(column == 3) { - v.x = m03; + v.x = m03; v.y = m13; v.z = m23; v.w = m33; @@ -734,16 +734,16 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } - } - - - - /** - * Copies the matrix values in the specified column into the array - * parameter. + } + + + + /** + * Copies the matrix values in the specified column into the array + * parameter. * @param column the matrix column - * @param v the array into which the matrix column values will be copied - */ + * @param v the array into which the matrix column values will be copied + */ public final void getColumn(int column, double v[]) { if( column == 0 ) { v[0] = m00; @@ -770,18 +770,18 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } - } - + } + - /** + /** * Performs an SVD normalization of this matrix in order to acquire * the normalized rotational component; the values are placed into * the Matrix3d parameter. * @param m1 the matrix into which the rotational component is placed - */ + */ public final void get(Matrix3d m1) { - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -797,21 +797,21 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m1.m20 = tmp_rot[6]; m1.m21 = tmp_rot[7]; m1.m22 = tmp_rot[8]; - + } - - /** - * Performs an SVD normalization of this matrix in order to acquire - * the normalized rotational component; the values are placed into - * the Matrix3f parameter. - * @param m1 the matrix into which the rotational component is placed - */ - public final void get(Matrix3f m1) + + /** + * Performs an SVD normalization of this matrix in order to acquire + * the normalized rotational component; the values are placed into + * the Matrix3f parameter. + * @param m1 the matrix into which the rotational component is placed + */ + public final void get(Matrix3f m1) { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m1.m00 = (float)tmp_rot[0]; @@ -825,7 +825,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m1.m20 = (float)tmp_rot[6]; m1.m21 = (float)tmp_rot[7]; m1.m22 = (float)tmp_rot[8]; - } + } /** * Performs an SVD normalization of this matrix to calculate @@ -834,10 +834,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param m1 the normalized matrix representing the rotation * @param t1 the translation component * @return the scale component of this transform - */ + */ public final double get(Matrix3d m1, Vector3d t1) - { - + { + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -859,19 +859,19 @@ public class Matrix4d implements java.io.Serializable, Cloneable { t1.z = m23; return( Matrix3d.max3( tmp_scale )); - + } - /** + /** * Performs an SVD normalization of this matrix to calculate * the rotation as a 3x3 matrix, the translation, and the scale. * None of the matrix values are modified. * @param m1 the normalized matrix representing the rotation * @param t1 the translation component * @return the scale component of this transform - */ + */ public final double get(Matrix3f m1, Vector3d t1){ - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -893,15 +893,15 @@ public class Matrix4d implements java.io.Serializable, Cloneable { t1.z = m23; return( Matrix3d.max3( tmp_scale )); - - } + + } /** * Performs an SVD normalization of this matrix in order to acquire * the normalized rotational component; the values are placed into * the Quat4f parameter. * @param q1 quaternion into which the rotation component is placed - */ + */ public final void get(Quat4f q1) { @@ -909,12 +909,12 @@ public class Matrix4d implements java.io.Serializable, Cloneable { double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); - double ww; + double ww; ww = 0.25*(1.0 + tmp_rot[0] + tmp_rot[4] + tmp_rot[8]); if(!((ww<0?-ww:ww) < 1.0e-30)) { q1.w = (float)Math.sqrt(ww); - ww = 0.25/q1.w; + ww = 0.25/q1.w; q1.x = (float)((tmp_rot[7] - tmp_rot[5])*ww); q1.y = (float)((tmp_rot[2] - tmp_rot[6])*ww); q1.z = (float)((tmp_rot[3] - tmp_rot[1])*ww); @@ -925,7 +925,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { ww = -0.5*(tmp_rot[4] + tmp_rot[8]); if(!((ww<0?-ww:ww) < 1.0e-30)) { q1.x = (float)Math.sqrt(ww); - ww = 0.5/q1.x; + ww = 0.5/q1.x; q1.y = (float)(tmp_rot[3]*ww); q1.z = (float)(tmp_rot[6]*ww); return; @@ -938,31 +938,31 @@ public class Matrix4d implements java.io.Serializable, Cloneable { q1.z = (float)(tmp_rot[7]/(2.0*q1.y)); return; } - + q1.y = 0.0f; q1.z = 1.0f; } - /** - * Performs an SVD normalization of q1 matrix in order to acquire - * the normalized rotational component; the values are placed into - * the Quat4d parameter. - * @param q1 the quaternion into which the rotation component is placed - */ - public final void get(Quat4d q1) - { + /** + * Performs an SVD normalization of q1 matrix in order to acquire + * the normalized rotational component; the values are placed into + * the Quat4d parameter. + * @param q1 the quaternion into which the rotation component is placed + */ + public final void get(Quat4d q1) + { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); - double ww; + double ww; ww = 0.25*(1.0 + tmp_rot[0] + tmp_rot[4] + tmp_rot[8]); if(!((ww<0?-ww:ww) < 1.0e-30)) { q1.w = Math.sqrt(ww); - ww = 0.25/q1.w; + ww = 0.25/q1.w; q1.x = (tmp_rot[7] - tmp_rot[5])*ww; q1.y = (tmp_rot[2] - tmp_rot[6])*ww; q1.z = (tmp_rot[3] - tmp_rot[1])*ww; @@ -973,7 +973,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { ww = -0.5*(tmp_rot[4] + tmp_rot[8]); if(!((ww<0?-ww:ww) < 1.0e-30)) { q1.x = Math.sqrt(ww); - ww = 0.5/q1.x; + ww = 0.5/q1.x; q1.y = tmp_rot[3]*ww; q1.z = tmp_rot[6]*ww; return; @@ -986,15 +986,15 @@ public class Matrix4d implements java.io.Serializable, Cloneable { q1.z = tmp_rot[7]/(2.0*q1.y); return; } - + q1.y = 0.0; q1.z = 1.0; - } + } /** * Retrieves the translational components of this matrix. * @param trans the vector that will receive the translational component - */ + */ public final void get(Vector3d trans) { trans.x = m03; @@ -1014,28 +1014,28 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m1.m20 = (float)m20; m1.m21 = (float)m21; m1.m22 = (float)m22; } - /** - * Gets the upper 3x3 values of this matrix and places them into - * the matrix m1. - * @param m1 the matrix that will hold the values + /** + * Gets the upper 3x3 values of this matrix and places them into + * the matrix m1. + * @param m1 the matrix that will hold the values */ public final void getRotationScale(Matrix3d m1) - { - m1.m00 = m00; m1.m01 = m01; m1.m02 = m02; - m1.m10 = m10; m1.m11 = m11; m1.m12 = m12; - m1.m20 = m20; m1.m21 = m21; m1.m22 = m22; - } + { + m1.m00 = m00; m1.m01 = m01; m1.m02 = m02; + m1.m10 = m10; m1.m11 = m11; m1.m12 = m12; + m1.m20 = m20; m1.m21 = m21; m1.m22 = m22; + } /** * Performs an SVD normalization of this matrix to calculate - * and return the uniform scale factor. If the matrix has non-uniform - * scale factors, the largest of the x, y, and z scale factors will + * and return the uniform scale factor. If the matrix has non-uniform + * scale factors, the largest of the x, y, and z scale factors will * be returned. This matrix is not modified. * @return the scale factor of this matrix - */ + */ public final double getScale() { - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -1056,17 +1056,17 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m20 = m1.m20; m21 = m1.m21; m22 = m1.m22; } - /** - * Replaces the upper 3x3 matrix values of this matrix with the - * values in the matrix m1. - * @param m1 the matrix that will be the new upper 3x3 - */ - public final void setRotationScale(Matrix3f m1) - { - m00 = m1.m00; m01 = m1.m01; m02 = m1.m02; - m10 = m1.m10; m11 = m1.m11; m12 = m1.m12; - m20 = m1.m20; m21 = m1.m21; m22 = m1.m22; - } + /** + * Replaces the upper 3x3 matrix values of this matrix with the + * values in the matrix m1. + * @param m1 the matrix that will be the new upper 3x3 + */ + public final void setRotationScale(Matrix3f m1) + { + m00 = m1.m00; m01 = m1.m01; m02 = m1.m02; + m10 = m1.m10; m11 = m1.m11; m12 = m1.m12; + m20 = m1.m20; m21 = m1.m21; m22 = m1.m22; + } /** * Sets the scale component of the current matrix by factoring @@ -1078,7 +1078,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m00 = tmp_rot[0]*scale; @@ -1134,7 +1134,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { this.m33 = w; break; - default: + default: throw new ArrayIndexOutOfBoundsException(VecMathI18N.getString("Matrix4d4")); } @@ -1351,7 +1351,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Adds a scalar to each component of this matrix. * @param scalar the scalar adder - */ + */ public final void add(double scalar) { m00 += scalar; @@ -1377,25 +1377,25 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * the result into this. Matrix m1 is not modified. * @param scalar the scalar adder * @param m1 the original matrix values - */ + */ public final void add(double scalar, Matrix4d m1) { - this.m00 = m1.m00 + scalar; - this.m01 = m1.m01 + scalar; - this.m02 = m1.m02 + scalar; - this.m03 = m1.m03 + scalar; - this.m10 = m1.m10 + scalar; - this.m11 = m1.m11 + scalar; - this.m12 = m1.m12 + scalar; - this.m13 = m1.m13 + scalar; - this.m20 = m1.m20 + scalar; - this.m21 = m1.m21 + scalar; - this.m22 = m1.m22 + scalar; - this.m23 = m1.m23 + scalar; - this.m30 = m1.m30 + scalar; - this.m31 = m1.m31 + scalar; - this.m32 = m1.m32 + scalar; - this.m33 = m1.m33 + scalar; + this.m00 = m1.m00 + scalar; + this.m01 = m1.m01 + scalar; + this.m02 = m1.m02 + scalar; + this.m03 = m1.m03 + scalar; + this.m10 = m1.m10 + scalar; + this.m11 = m1.m11 + scalar; + this.m12 = m1.m12 + scalar; + this.m13 = m1.m13 + scalar; + this.m20 = m1.m20 + scalar; + this.m21 = m1.m21 + scalar; + this.m22 = m1.m22 + scalar; + this.m23 = m1.m23 + scalar; + this.m30 = m1.m30 + scalar; + this.m31 = m1.m31 + scalar; + this.m32 = m1.m32 + scalar; + this.m33 = m1.m33 + scalar; } /** @@ -1431,27 +1431,27 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param m1 the other matrix */ public final void add(Matrix4d m1) - { + { this.m00 += m1.m00; this.m01 += m1.m01; this.m02 += m1.m02; this.m03 += m1.m03; - + this.m10 += m1.m10; this.m11 += m1.m11; this.m12 += m1.m12; this.m13 += m1.m13; - + this.m20 += m1.m20; this.m21 += m1.m21; this.m22 += m1.m22; this.m23 += m1.m23; - + this.m30 += m1.m30; this.m31 += m1.m31; this.m32 += m1.m32; this.m33 += m1.m33; - } + } /** * Sets the value of this matrix to the matrix difference @@ -1482,34 +1482,34 @@ public class Matrix4d implements java.io.Serializable, Cloneable { this.m33 = m1.m33 - m2.m33; } - + /** * Sets the value of this matrix to the matrix difference of itself * and matrix m1 (this = this - m1). * @param m1 the other matrix */ public final void sub(Matrix4d m1) - { + { this.m00 -= m1.m00; this.m01 -= m1.m01; this.m02 -= m1.m02; this.m03 -= m1.m03; - + this.m10 -= m1.m10; this.m11 -= m1.m11; this.m12 -= m1.m12; this.m13 -= m1.m13; - + this.m20 -= m1.m20; this.m21 -= m1.m21; this.m22 -= m1.m22; this.m23 -= m1.m23; - + this.m30 -= m1.m30; this.m31 -= m1.m31; this.m32 -= m1.m32; this.m33 -= m1.m33; - } + } /** * Sets the value of this matrix to its transpose. @@ -1599,13 +1599,13 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m33 = m[15]; } - /** + /** * Sets the rotational component (upper 3x3) of this matrix to the * matrix values in the single precision Matrix3f argument; the other * elements of this matrix are initialized as if this were an identity * matrix (i.e., affine matrix with no translational component). * @param m1 the double precision 3x3 matrix - */ + */ public final void set(Matrix3f m1) { m00 = m1.m00; m01 = m1.m01; m02 = m1.m02; m03 = 0.0; @@ -1614,20 +1614,20 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m30 = 0.0; m31 = 0.0 ; m32 = 0.0 ; m33 = 1.0; } - /** - * Sets the rotational component (upper 3x3) of this matrix to the - * matrix values in the double precision Matrix3d argument; the other - * elements of this matrix are initialized as if this were an identity + /** + * Sets the rotational component (upper 3x3) of this matrix to the + * matrix values in the double precision Matrix3d argument; the other + * elements of this matrix are initialized as if this were an identity * matrix (i.e., affine matrix with no translational component). - * @param m1 the double precision 3x3 matrix - */ - public final void set(Matrix3d m1) + * @param m1 the double precision 3x3 matrix + */ + public final void set(Matrix3d m1) { m00 = m1.m00; m01 = m1.m01; m02 = m1.m02; m03 = 0.0; m10 = m1.m10; m11 = m1.m11; m12 = m1.m12; m13 = 0.0; m20 = m1.m20; m21 = m1.m21; m22 = m1.m22; m23 = 0.0; m30 = 0.0; m31 = 0.0 ; m32 = 0.0 ; m33 = 1.0; - } + } /** * Sets the value of this matrix to the matrix conversion of the @@ -1688,11 +1688,11 @@ public class Matrix4d implements java.io.Serializable, Cloneable { double sinTheta = Math.sin(a1.angle); double cosTheta = Math.cos(a1.angle); double t = 1.0 - cosTheta; - + double xz = ax * az; double xy = ax * ay; double yz = ay * az; - + m00 = t * ax * ax + cosTheta; m01 = t * xy - sinTheta * az; m02 = t * xz + sinTheta * ay; @@ -1802,7 +1802,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m33 = 1.0; } - /** + /** * Sets the value of this matrix from the rotation expressed * by the quaternion q1, the translation t1, and the scale s. * @param q1 the rotation expressed as a quaternion @@ -1810,23 +1810,23 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param s the scale value */ public final void set(Quat4d q1, Vector3d t1, double s) - { + { this.m00 = s*(1.0 - 2.0*q1.y*q1.y - 2.0*q1.z*q1.z); this.m10 = s*(2.0*(q1.x*q1.y + q1.w*q1.z)); this.m20 = s*(2.0*(q1.x*q1.z - q1.w*q1.y)); - + this.m01 = s*(2.0*(q1.x*q1.y - q1.w*q1.z)); this.m11 = s*(1.0 - 2.0*q1.x*q1.x - 2.0*q1.z*q1.z); this.m21 = s*(2.0*(q1.y*q1.z + q1.w*q1.x)); - + this.m02 = s*(2.0*(q1.x*q1.z + q1.w*q1.y)); this.m12 = s*(2.0*(q1.y*q1.z - q1.w*q1.x)); this.m22 = s*(1.0 - 2.0*q1.x*q1.x - 2.0*q1.y*q1.y); - + this.m03 = t1.x; this.m13 = t1.y; this.m23 = t1.z; - + this.m30 = 0.0; this.m31 = 0.0; this.m32 = 0.0; @@ -1839,7 +1839,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param q1 the rotation expressed as a quaternion * @param t1 the translation * @param s the scale value - */ + */ public final void set(Quat4f q1, Vector3d t1, double s) { this.m00 = s*(1.0 - 2.0*q1.y*q1.y - 2.0*q1.z*q1.z); @@ -1870,7 +1870,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param q1 the rotation expressed as a quaternion * @param t1 the translation * @param s the scale value - */ + */ public final void set(Quat4f q1, Vector3f t1, float s) { this.m00 = s*(1.0 - 2.0*q1.y*q1.y - 2.0*q1.z*q1.z); @@ -1898,7 +1898,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Sets the value of this matrix to a copy of the * passed matrix m1. - * @param m1 the matrix4f + * @param m1 the matrix4f */ public final void set(Matrix4f m1) { @@ -1959,7 +1959,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { public final void invert(Matrix4d m1) { - invertGeneral( m1); + invertGeneral( m1); } /** @@ -1967,7 +1967,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { */ public final void invert() { - invertGeneral( this ); + invertGeneral( this ); } /** @@ -1986,34 +1986,34 @@ public class Matrix4d implements java.io.Serializable, Cloneable { // Use LU decomposition and backsubstitution code specifically // for floating-point 4x4 matrices. double[] tmp = new double[16]; // scratch matrix - // Copy source matrix to t1tmp + // Copy source matrix to t1tmp tmp[0] = m1.m00; tmp[1] = m1.m01; tmp[2] = m1.m02; tmp[3] = m1.m03; - + tmp[4] = m1.m10; tmp[5] = m1.m11; tmp[6] = m1.m12; tmp[7] = m1.m13; - + tmp[8] = m1.m20; tmp[9] = m1.m21; tmp[10] = m1.m22; tmp[11] = m1.m23; - + tmp[12] = m1.m30; tmp[13] = m1.m31; tmp[14] = m1.m32; tmp[15] = m1.m33; - // Calculate LU decomposition: Is the matrix singular? + // Calculate LU decomposition: Is the matrix singular? if (!luDecomposition(tmp, row_perm)) { - // Matrix has no inverse + // Matrix has no inverse throw new SingularMatrixException(VecMathI18N.getString("Matrix4d10")); } - // Perform back substitution on the identity matrix + // Perform back substitution on the identity matrix for(i=0;i<16;i++) result[i] = 0.0; result[0] = 1.0; result[5] = 1.0; result[10] = 1.0; result[15] = 1.0; luBacksubstitution(tmp, row_perm, result); @@ -2027,12 +2027,12 @@ public class Matrix4d implements java.io.Serializable, Cloneable { this.m11 = result[5]; this.m12 = result[6]; this.m13 = result[7]; - + this.m20 = result[8]; this.m21 = result[9]; this.m22 = result[10]; this.m23 = result[11]; - + this.m30 = result[12]; this.m31 = result[13]; this.m32 = result[14]; @@ -2041,13 +2041,13 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } /** - * Given a 4x4 array "matrix0", this function replaces it with the - * LU decomposition of a row-wise permutation of itself. The input - * parameters are "matrix0" and "dimen". The array "matrix0" is also - * an output parameter. The vector "row_perm[4]" is an output - * parameter that contains the row permutations resulting from partial - * pivoting. The output parameter "even_row_xchg" is 1 when the - * number of row exchanges is even, or -1 otherwise. Assumes data + * Given a 4x4 array "matrix0", this function replaces it with the + * LU decomposition of a row-wise permutation of itself. The input + * parameters are "matrix0" and "dimen". The array "matrix0" is also + * an output parameter. The vector "row_perm[4]" is an output + * parameter that contains the row permutations resulting from partial + * pivoting. The output parameter "even_row_xchg" is 1 when the + * number of row exchanges is even, or -1 otherwise. Assumes data * type is always double. * * This function is similar to luDecomposition, except that it @@ -2056,8 +2056,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @return true if the matrix is nonsingular, or false otherwise. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 40-45. // static boolean luDecomposition(double[] matrix0, @@ -2065,7 +2065,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { double row_scale[] = new double[4]; - // Determine implicit scaling information by looping over rows + // Determine implicit scaling information by looping over rows { int i, j; int ptr, rs; @@ -2074,12 +2074,12 @@ public class Matrix4d implements java.io.Serializable, Cloneable { ptr = 0; rs = 0; - // For each row ... + // For each row ... i = 4; while (i-- != 0) { big = 0.0; - // For each column, find the largest element in the row + // For each column, find the largest element in the row j = 4; while (j-- != 0) { temp = matrix0[ptr++]; @@ -2089,7 +2089,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } } - // Is the matrix singular? + // Is the matrix singular? if (big == 0.0) { return false; } @@ -2103,13 +2103,13 @@ public class Matrix4d implements java.io.Serializable, Cloneable { mtx = 0; - // For all columns, execute Crout's method + // For all columns, execute Crout's method for (j = 0; j < 4; j++) { int i, imax, k; int target, p1, p2; double sum, big, temp; - // Determine elements of upper diagonal matrix U + // Determine elements of upper diagonal matrix U for (i = 0; i < j; i++) { target = mtx + (4*i) + j; sum = matrix0[target]; @@ -2141,7 +2141,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } matrix0[target] = sum; - // Is this the best pivot so far? + // Is this the best pivot so far? if ((temp = row_scale[i] * Math.abs(sum)) >= big) { big = temp; imax = i; @@ -2152,9 +2152,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { throw new RuntimeException(VecMathI18N.getString("Matrix4d11")); } - // Is a row exchange necessary? + // Is a row exchange necessary? if (j != imax) { - // Yes: exchange rows + // Yes: exchange rows k = 4; p1 = mtx + (4*imax); p2 = mtx + (4*j); @@ -2164,19 +2164,19 @@ public class Matrix4d implements java.io.Serializable, Cloneable { matrix0[p2++] = temp; } - // Record change in scale factor + // Record change in scale factor row_scale[imax] = row_scale[j]; } - // Record row permutation + // Record row permutation row_perm[j] = imax; - // Is the matrix singular + // Is the matrix singular if (matrix0[(mtx + (4*j) + j)] == 0.0) { return false; } - // Divide elements of lower diagonal matrix L by pivot + // Divide elements of lower diagonal matrix L by pivot if (j != (4-1)) { temp = 1.0 / (matrix0[(mtx + (4*j) + j)]); target = mtx + (4*(j+1)) + j; @@ -2206,8 +2206,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * derived. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 44-45. // static void luBacksubstitution(double[] matrix1, @@ -2217,17 +2217,17 @@ public class Matrix4d implements java.io.Serializable, Cloneable { int i, ii, ip, j, k; int rp; int cv, rv; - + // rp = row_perm; rp = 0; - // For each column vector of matrix2 ... + // For each column vector of matrix2 ... for (k = 0; k < 4; k++) { // cv = &(matrix2[0][k]); cv = k; ii = -1; - // Forward substitution + // Forward substitution for (i = 0; i < 4; i++) { double sum; @@ -2247,7 +2247,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { matrix2[cv+4*i] = sum; } - // Backsubstitution + // Backsubstitution // rv = &(matrix1[3][0]); rv = 3*4; matrix2[cv+4*3] /= matrix1[rv+3]; @@ -2271,21 +2271,21 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Computes the determinant of this matrix. - * @return the determinant of the matrix + * @return the determinant of the matrix */ public final double determinant() { double det; - // cofactor exapainsion along first row + // cofactor exapainsion along first row - det = m00*(m11*m22*m33+ m12*m23*m31 + m13*m21*m32 + det = m00*(m11*m22*m33+ m12*m23*m31 + m13*m21*m32 - m13*m22*m31 -m11*m23*m32 - m12*m21*m33); - det -= m01*(m10*m22*m33+ m12*m23*m30 + m13*m20*m32 + det -= m01*(m10*m22*m33+ m12*m23*m30 + m13*m20*m32 - m13*m22*m30 -m10*m23*m32 - m12*m20*m33); - det += m02*(m10*m21*m33+ m11*m23*m30 + m13*m20*m31 + det += m02*(m10*m21*m33+ m11*m23*m30 + m13*m20*m31 - m13*m21*m30 -m10*m23*m31 - m11*m20*m33); - det -= m03*(m10*m21*m32+ m11*m22*m30 + m12*m20*m31 + det -= m03*(m10*m21*m32+ m11*m22*m30 + m12*m20*m31 - m12*m21*m30 -m10*m22*m31 - m11*m20*m32); return( det ); @@ -2416,7 +2416,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param scale the scale component */ public final void set(Matrix3f m1, Vector3f t1, float scale) - { + { this.m00 = m1.m00*scale; this.m01 = m1.m01*scale; this.m02 = m1.m02*scale; @@ -2437,18 +2437,18 @@ public class Matrix4d implements java.io.Serializable, Cloneable { this.m32 = 0.0; this.m33 = 1.0; } - + /** - * Sets the value of this matrix from the rotation expressed by + * Sets the value of this matrix from the rotation expressed by * the rotation matrix m1, the translation t1, and the scale factor. - * The translation is not modified by the scale. - * @param m1 the rotation component + * The translation is not modified by the scale. + * @param m1 the rotation component * @param t1 the translation component - * @param scale the scale component - */ - public final void set(Matrix3d m1, Vector3d t1, double scale) - { + * @param scale the scale component + */ + public final void set(Matrix3d m1, Vector3d t1, double scale) + { this.m00 = m1.m00*scale; this.m01 = m1.m01*scale; this.m02 = m1.m02*scale; @@ -2468,23 +2468,23 @@ public class Matrix4d implements java.io.Serializable, Cloneable { this.m31 = 0.0; this.m32 = 0.0; this.m33 = 1.0; - } + } - /** - * Modifies the translational components of this matrix to the values - * of the Vector3d argument; the other values of this matrix are not - * modified. + /** + * Modifies the translational components of this matrix to the values + * of the Vector3d argument; the other values of this matrix are not + * modified. * @param trans the translational component - */ - public final void setTranslation(Vector3d trans) - { - m03 = trans.x; + */ + public final void setTranslation(Vector3d trans) + { + m03 = trans.x; m13 = trans.y; - m23 = trans.z; - } + m23 = trans.z; + } /** - * Sets the value of this matrix to a counter-clockwise rotation + * Sets the value of this matrix to a counter-clockwise rotation * about the x axis. * @param angle the angle to rotate about the X axis in radians */ @@ -2517,7 +2517,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter-clockwise rotation + * Sets the value of this matrix to a counter-clockwise rotation * about the y axis. * @param angle the angle to rotate about the Y axis in radians */ @@ -2550,7 +2550,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter-clockwise rotation + * Sets the value of this matrix to a counter-clockwise rotation * about the z axis. * @param angle the angle to rotate about the Z axis in radians */ @@ -2611,7 +2611,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * the result into this. Matrix m1 is not modified. * @param scalar the scalar multiplier * @param m1 the original matrix - */ + */ public final void mul(double scalar, Matrix4d m1) { this.m00 = m1.m00 * scalar; @@ -2637,47 +2637,47 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * with matrix m1. * @param m1 the other matrix */ - public final void mul(Matrix4d m1) + public final void mul(Matrix4d m1) { double m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, - m30, m31, m32, m33; // vars for temp result matrix + m30, m31, m32, m33; // vars for temp result matrix - m00 = this.m00*m1.m00 + this.m01*m1.m10 + + m00 = this.m00*m1.m00 + this.m01*m1.m10 + this.m02*m1.m20 + this.m03*m1.m30; - m01 = this.m00*m1.m01 + this.m01*m1.m11 + + m01 = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21 + this.m03*m1.m31; - m02 = this.m00*m1.m02 + this.m01*m1.m12 + + m02 = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22 + this.m03*m1.m32; - m03 = this.m00*m1.m03 + this.m01*m1.m13 + + m03 = this.m00*m1.m03 + this.m01*m1.m13 + this.m02*m1.m23 + this.m03*m1.m33; - m10 = this.m10*m1.m00 + this.m11*m1.m10 + + m10 = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20 + this.m13*m1.m30; - m11 = this.m10*m1.m01 + this.m11*m1.m11 + + m11 = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21 + this.m13*m1.m31; - m12 = this.m10*m1.m02 + this.m11*m1.m12 + + m12 = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22 + this.m13*m1.m32; - m13 = this.m10*m1.m03 + this.m11*m1.m13 + + m13 = this.m10*m1.m03 + this.m11*m1.m13 + this.m12*m1.m23 + this.m13*m1.m33; - m20 = this.m20*m1.m00 + this.m21*m1.m10 + + m20 = this.m20*m1.m00 + this.m21*m1.m10 + this.m22*m1.m20 + this.m23*m1.m30; - m21 = this.m20*m1.m01 + this.m21*m1.m11 + + m21 = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21 + this.m23*m1.m31; - m22 = this.m20*m1.m02 + this.m21*m1.m12 + + m22 = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22 + this.m23*m1.m32; - m23 = this.m20*m1.m03 + this.m21*m1.m13 + + m23 = this.m20*m1.m03 + this.m21*m1.m13 + this.m22*m1.m23 + this.m23*m1.m33; - m30 = this.m30*m1.m00 + this.m31*m1.m10 + + m30 = this.m30*m1.m00 + this.m31*m1.m10 + this.m32*m1.m20 + this.m33*m1.m30; - m31 = this.m30*m1.m01 + this.m31*m1.m11 + + m31 = this.m30*m1.m01 + this.m31*m1.m11 + this.m32*m1.m21 + this.m33*m1.m31; - m32 = this.m30*m1.m02 + this.m31*m1.m12 + + m32 = this.m30*m1.m02 + this.m31*m1.m12 + this.m32*m1.m22 + this.m33*m1.m32; - m33 = this.m30*m1.m03 + this.m31*m1.m13 + + m33 = this.m30*m1.m03 + this.m31*m1.m13 + this.m32*m1.m23 + this.m33*m1.m33; this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; @@ -2695,49 +2695,49 @@ public class Matrix4d implements java.io.Serializable, Cloneable { public final void mul(Matrix4d m1, Matrix4d m2) { if (this != m1 && this != m2) { - // code for mat mul - this.m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + + // code for mat mul + this.m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20 + m1.m03*m2.m30; - this.m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + + this.m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21 + m1.m03*m2.m31; - this.m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + + this.m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22 + m1.m03*m2.m32; - this.m03 = m1.m00*m2.m03 + m1.m01*m2.m13 + + this.m03 = m1.m00*m2.m03 + m1.m01*m2.m13 + m1.m02*m2.m23 + m1.m03*m2.m33; - this.m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20 + m1.m13*m2.m30; - this.m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + + this.m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21 + m1.m13*m2.m31; - this.m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + + this.m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22 + m1.m13*m2.m32; - this.m13 = m1.m10*m2.m03 + m1.m11*m2.m13 + + this.m13 = m1.m10*m2.m03 + m1.m11*m2.m13 + m1.m12*m2.m23 + m1.m13*m2.m33; - this.m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + + this.m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20 + m1.m23*m2.m30; - this.m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + + this.m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21 + m1.m23*m2.m31; - this.m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + + this.m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22 + m1.m23*m2.m32; - this.m23 = m1.m20*m2.m03 + m1.m21*m2.m13 + + this.m23 = m1.m20*m2.m03 + m1.m21*m2.m13 + m1.m22*m2.m23 + m1.m23*m2.m33; - this.m30 = m1.m30*m2.m00 + m1.m31*m2.m10 + + this.m30 = m1.m30*m2.m00 + m1.m31*m2.m10 + m1.m32*m2.m20 + m1.m33*m2.m30; - this.m31 = m1.m30*m2.m01 + m1.m31*m2.m11 + + this.m31 = m1.m30*m2.m01 + m1.m31*m2.m11 + m1.m32*m2.m21 + m1.m33*m2.m31; - this.m32 = m1.m30*m2.m02 + m1.m31*m2.m12 + + this.m32 = m1.m30*m2.m02 + m1.m31*m2.m12 + m1.m32*m2.m22 + m1.m33*m2.m32; - this.m33 = m1.m30*m2.m03 + m1.m31*m2.m13 + + this.m33 = m1.m30*m2.m03 + m1.m31*m2.m13 + m1.m32*m2.m23 + m1.m33*m2.m33; } else { double m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, - m30, m31, m32, m33; // vars for temp result matrix + m30, m31, m32, m33; // vars for temp result matrix - // code for mat mul + // code for mat mul m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20 + m1.m03*m2.m30; m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21 + m1.m03*m2.m31; m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22 + m1.m03*m2.m32; @@ -2769,11 +2769,11 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Multiplies the transpose of matrix m1 times the transpose of matrix * m2, and places the result into this. - * @param m1 the matrix on the left hand side of the multiplication + * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication - */ - public final void mulTransposeBoth(Matrix4d m1, Matrix4d m2) - { + */ + public final void mulTransposeBoth(Matrix4d m1, Matrix4d m2) + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m10*m2.m01 + m1.m20*m2.m02 + m1.m30*m2.m03; this.m01 = m1.m00*m2.m10 + m1.m10*m2.m11 + m1.m20*m2.m12 + m1.m30*m2.m13; @@ -2797,53 +2797,53 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } else { double m00, m01, m02, m03, m10, m11, m12, m13, - m20, m21, m22, m23, // vars for temp result matrix + m20, m21, m22, m23, // vars for temp result matrix m30, m31, m32, m33; - + m00 = m1.m00*m2.m00 + m1.m10*m2.m01 + m1.m20*m2.m02 + m1.m30*m2.m03; m01 = m1.m00*m2.m10 + m1.m10*m2.m11 + m1.m20*m2.m12 + m1.m30*m2.m13; m02 = m1.m00*m2.m20 + m1.m10*m2.m21 + m1.m20*m2.m22 + m1.m30*m2.m23; m03 = m1.m00*m2.m30 + m1.m10*m2.m31 + m1.m20*m2.m32 + m1.m30*m2.m33; - + m10 = m1.m01*m2.m00 + m1.m11*m2.m01 + m1.m21*m2.m02 + m1.m31*m2.m03; m11 = m1.m01*m2.m10 + m1.m11*m2.m11 + m1.m21*m2.m12 + m1.m31*m2.m13; m12 = m1.m01*m2.m20 + m1.m11*m2.m21 + m1.m21*m2.m22 + m1.m31*m2.m23; m13 = m1.m01*m2.m30 + m1.m11*m2.m31 + m1.m21*m2.m32 + m1.m31*m2.m33; - + m20 = m1.m02*m2.m00 + m1.m12*m2.m01 + m1.m22*m2.m02 + m1.m32*m2.m03; m21 = m1.m02*m2.m10 + m1.m12*m2.m11 + m1.m22*m2.m12 + m1.m32*m2.m13; m22 = m1.m02*m2.m20 + m1.m12*m2.m21 + m1.m22*m2.m22 + m1.m32*m2.m23; m23 = m1.m02*m2.m30 + m1.m12*m2.m31 + m1.m22*m2.m32 + m1.m32*m2.m33; - + m30 = m1.m03*m2.m00 + m1.m13*m2.m01 + m1.m23*m2.m02 + m1.m33*m2.m03; m31 = m1.m03*m2.m10 + m1.m13*m2.m11 + m1.m23*m2.m12 + m1.m33*m2.m13; m32 = m1.m03*m2.m20 + m1.m13*m2.m21 + m1.m23*m2.m22 + m1.m33*m2.m23; m33 = m1.m03*m2.m30 + m1.m13*m2.m31 + m1.m23*m2.m32 + m1.m33*m2.m33; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13; this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23; this.m30 = m30; this.m31 = m31; this.m32 = m32; this.m33 = m33; } - - } - - - - /** - * Multiplies matrix m1 times the transpose of matrix m2, and - * places the result into this. - * @param m1 the matrix on the left hand side of the multiplication - * @param m2 the matrix on the right hand side of the multiplication - */ - public final void mulTransposeRight(Matrix4d m1, Matrix4d m2) - { + + } + + + + /** + * Multiplies matrix m1 times the transpose of matrix m2, and + * places the result into this. + * @param m1 the matrix on the left hand side of the multiplication + * @param m2 the matrix on the right hand side of the multiplication + */ + public final void mulTransposeRight(Matrix4d m1, Matrix4d m2) + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02 + m1.m03*m2.m03; this.m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12 + m1.m03*m2.m13; this.m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22 + m1.m03*m2.m23; this.m03 = m1.m00*m2.m30 + m1.m01*m2.m31 + m1.m02*m2.m32 + m1.m03*m2.m33; - + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02 + m1.m13*m2.m03; this.m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12 + m1.m13*m2.m13; this.m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22 + m1.m13*m2.m23; @@ -2890,32 +2890,32 @@ public class Matrix4d implements java.io.Serializable, Cloneable { this.m30 = m30; this.m31 = m31; this.m32 = m32; this.m33 = m33; } } - - - /** - * Multiplies the transpose of matrix m1 times matrix m2, and - * places the result into this. - * @param m1 the matrix on the left hand side of the multiplication - * @param m2 the matrix on the right hand side of the multiplication - */ - public final void mulTransposeLeft(Matrix4d m1, Matrix4d m2) + + + /** + * Multiplies the transpose of matrix m1 times matrix m2, and + * places the result into this. + * @param m1 the matrix on the left hand side of the multiplication + * @param m2 the matrix on the right hand side of the multiplication + */ + public final void mulTransposeLeft(Matrix4d m1, Matrix4d m2) { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20 + m1.m30*m2.m30; this.m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21 + m1.m30*m2.m31; this.m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22 + m1.m30*m2.m32; this.m03 = m1.m00*m2.m03 + m1.m10*m2.m13 + m1.m20*m2.m23 + m1.m30*m2.m33; - + this.m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20 + m1.m31*m2.m30; this.m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21 + m1.m31*m2.m31; this.m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22 + m1.m31*m2.m32; this.m13 = m1.m01*m2.m03 + m1.m11*m2.m13 + m1.m21*m2.m23 + m1.m31*m2.m33; - + this.m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20 + m1.m32*m2.m30; this.m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21 + m1.m32*m2.m31; this.m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22 + m1.m32*m2.m32; this.m23 = m1.m02*m2.m03 + m1.m12*m2.m13 + m1.m22*m2.m23 + m1.m32*m2.m33; - + this.m30 = m1.m03*m2.m00 + m1.m13*m2.m10 + m1.m23*m2.m20 + m1.m33*m2.m30; this.m31 = m1.m03*m2.m01 + m1.m13*m2.m11 + m1.m23*m2.m21 + m1.m33*m2.m31; this.m32 = m1.m03*m2.m02 + m1.m13*m2.m12 + m1.m23*m2.m22 + m1.m33*m2.m32; @@ -2925,24 +2925,24 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m10, m11, m12, m13, m20, m21, m22, m23, // vars for temp result matrix m30, m31, m32, m33; - - + + m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20 + m1.m30*m2.m30; m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21 + m1.m30*m2.m31; m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22 + m1.m30*m2.m32; m03 = m1.m00*m2.m03 + m1.m10*m2.m13 + m1.m20*m2.m23 + m1.m30*m2.m33; - + m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20 + m1.m31*m2.m30; m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21 + m1.m31*m2.m31; m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22 + m1.m31*m2.m32; m13 = m1.m01*m2.m03 + m1.m11*m2.m13 + m1.m21*m2.m23 + m1.m31*m2.m33; - + m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20 + m1.m32*m2.m30; m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21 + m1.m32*m2.m31; m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22 + m1.m32*m2.m32; m23 = m1.m02*m2.m03 + m1.m12*m2.m13 + m1.m22*m2.m23 + m1.m32*m2.m33; - + m30 = m1.m03*m2.m00 + m1.m13*m2.m10 + m1.m23*m2.m20 + m1.m33*m2.m30; m31 = m1.m03*m2.m01 + m1.m13*m2.m11 + m1.m23*m2.m21 + m1.m33*m2.m31; m32 = m1.m03*m2.m02 + m1.m13*m2.m12 + m1.m23*m2.m22 + m1.m33*m2.m32; @@ -2955,8 +2955,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { } } - - + + /** * Returns true if all of the data members of Matrix4d m1 are * equal to the corresponding data members in this Matrix4d. @@ -2972,7 +2972,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { && this.m21 == m1.m21 && this.m22 == m1.m22 && this.m23 == m1.m23 && this.m30 == m1.m30 && this.m31 == m1.m31 && this.m32 == m1.m32 && this.m33 == m1.m33); - } + } catch (NullPointerException e2) { return false; } } @@ -2983,10 +2983,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * this Matrix4d. * @param t1 the matrix with which the comparison is made * @return true or false - */ + */ public boolean equals(Object t1) { - try { + try { Matrix4d m2 = (Matrix4d) t1; return(this.m00 == m2.m00 && this.m01 == m2.m01 && this.m02 == m2.m02 && this.m03 == m2.m03 && this.m10 == m2.m10 && this.m11 == m2.m11 @@ -2995,27 +2995,27 @@ public class Matrix4d implements java.io.Serializable, Cloneable { && this.m30 == m2.m30 && this.m31 == m2.m31 && this.m32 == m2.m32 && this.m33 == m2.m33); } - catch (ClassCastException e1) { return false; } + catch (ClassCastException e1) { return false; } catch (NullPointerException e2) { return false; } } - /** + /** * @deprecated Use epsilonEquals(Matrix4d,double) instead - */ + */ public boolean epsilonEquals(Matrix4d m1, float epsilon) { return epsilonEquals(m1, (double)epsilon); } - /** - * Returns true if the L-infinite distance between this matrix - * and matrix m1 is less than or equal to the epsilon parameter, - * otherwise returns false. The L-infinite - * distance is equal to - * MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs(this.m(i,j) - m1.m(i,j)] - * @param m1 the matrix to be compared to this matrix - * @param epsilon the threshold value - */ - public boolean epsilonEquals(Matrix4d m1, double epsilon) { + /** + * Returns true if the L-infinite distance between this matrix + * and matrix m1 is less than or equal to the epsilon parameter, + * otherwise returns false. The L-infinite + * distance is equal to + * MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs(this.m(i,j) - m1.m(i,j)] + * @param m1 the matrix to be compared to this matrix + * @param epsilon the threshold value + */ + public boolean epsilonEquals(Matrix4d m1, double epsilon) { double diff; diff = m00 - m1.m00; @@ -3067,7 +3067,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { if((diff<0?-diff:diff) > epsilon) return false; return true; - } + } /** * Returns a hash code value based on the data values in this @@ -3076,7 +3076,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + VecMathUtil.doubleToLongBits(m00); @@ -3186,7 +3186,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { vec.y = y; vec.z = z; } - + /** * Transforms the point parameter with this Matrix4d and @@ -3205,8 +3205,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { pointOut.y = y; } - - + + /** * Transforms the point parameter with this Matrix4d and * places the result back into point. The fourth element of the @@ -3223,7 +3223,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { point.y = y; } - + /** * Transforms the point parameter with this Matrix4d and * places the result into pointOut. The fourth element of the @@ -3241,8 +3241,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { pointOut.x = x; pointOut.y = y; } - - + + /** * Transforms the point parameter with this Matrix4d and * places the result back into point. The fourth element of the @@ -3258,7 +3258,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { point.x = x; point.y = y; } - + /** * Transforms the normal parameter by this Matrix4d and places the value @@ -3275,8 +3275,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { normalOut.x = x; normalOut.y = y; } - - + + /** * Transforms the normal parameter by this transform and places the value * back into normal. The fourth element of the normal is assumed to be zero. @@ -3293,7 +3293,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { normal.y = y; } - + /** * Transforms the normal parameter by this Matrix4d and places the value * into normalOut. The fourth element of the normal is assumed to be zero. @@ -3309,8 +3309,8 @@ public class Matrix4d implements java.io.Serializable, Cloneable { normalOut.x = x; normalOut.y = y; } - - + + /** * Transforms the normal parameter by this transform and places the value * back into normal. The fourth element of the normal is assumed to be zero. @@ -3319,7 +3319,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { public final void transform(Vector3f normal) { float x, y; - + x = (float) (m00*normal.x + m01*normal.y + m02*normal.z); y = (float) (m10*normal.x + m11*normal.y + m12*normal.z); normal.z = (float) (m20*normal.x + m21*normal.y + m22*normal.z); @@ -3336,11 +3336,11 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * are replaced by the passed rotation components, * and then the scale is reapplied to the rotational components. * @param m1 double precision 3x3 matrix - */ - public final void setRotation( Matrix3d m1){ + */ + public final void setRotation( Matrix3d m1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m00 = m1.m00*tmp_scale[0]; @@ -3355,9 +3355,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m21 = m1.m21*tmp_scale[1]; m22 = m1.m22*tmp_scale[2]; - } - - + } + + /** * Sets the rotational component (upper 3x3) of this matrix to the * matrix values in the single precision Matrix3f argument; the other @@ -3367,9 +3367,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * are replaced by the passed rotation components, * and then the scale is reapplied to the rotational components. * @param m1 single precision 3x3 matrix - */ - public final void setRotation( Matrix3f m1) - { + */ + public final void setRotation( Matrix3f m1) + { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix @@ -3386,7 +3386,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m20 = m1.m20*tmp_scale[0]; m21 = m1.m21*tmp_scale[1]; m22 = m1.m22*tmp_scale[2]; - } + } /** * Sets the rotational component (upper 3x3) of this matrix to the @@ -3397,39 +3397,39 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * are replaced by the matrix equivalent of the quaternion, * and then the scale is reapplied to the rotational components. * @param q1 the quaternion that specifies the rotation - */ + */ public final void setRotation(Quat4f q1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); - + m00 = (1.0 - 2.0f*q1.y*q1.y - 2.0f*q1.z*q1.z)*tmp_scale[0]; - m10 = (2.0*(q1.x*q1.y + q1.w*q1.z))*tmp_scale[0]; - m20 = (2.0*(q1.x*q1.z - q1.w*q1.y))*tmp_scale[0]; - + m10 = (2.0*(q1.x*q1.y + q1.w*q1.z))*tmp_scale[0]; + m20 = (2.0*(q1.x*q1.z - q1.w*q1.y))*tmp_scale[0]; + m01 = (2.0*(q1.x*q1.y - q1.w*q1.z))*tmp_scale[1]; - m11 = (1.0 - 2.0f*q1.x*q1.x - 2.0f*q1.z*q1.z)*tmp_scale[1]; - m21 = (2.0*(q1.y*q1.z + q1.w*q1.x))*tmp_scale[1]; - + m11 = (1.0 - 2.0f*q1.x*q1.x - 2.0f*q1.z*q1.z)*tmp_scale[1]; + m21 = (2.0*(q1.y*q1.z + q1.w*q1.x))*tmp_scale[1]; + m02 = (2.0*(q1.x*q1.z + q1.w*q1.y))*tmp_scale[2]; - m12 = (2.0*(q1.y*q1.z - q1.w*q1.x))*tmp_scale[2]; - m22 = (1.0 - 2.0f*q1.x*q1.x - 2.0f*q1.y*q1.y)*tmp_scale[2]; + m12 = (2.0*(q1.y*q1.z - q1.w*q1.x))*tmp_scale[2]; + m22 = (1.0 - 2.0f*q1.x*q1.x - 2.0f*q1.y*q1.y)*tmp_scale[2]; } - - /** - * Sets the rotational component (upper 3x3) of this matrix to the - * matrix equivalent values of the quaternion argument; the other - * elements of this matrix are unchanged; a singular value - * decomposition is performed on this object's upper 3x3 matrix to + + /** + * Sets the rotational component (upper 3x3) of this matrix to the + * matrix equivalent values of the quaternion argument; the other + * elements of this matrix are unchanged; a singular value + * decomposition is performed on this object's upper 3x3 matrix to * factor out the scale, then this object's upper 3x3 matrix components * are replaced by the matrix equivalent of the quaternion, - * and then the scale is reapplied to the rotational components. - * @param q1 the quaternion that specifies the rotation - */ + * and then the scale is reapplied to the rotational components. + * @param q1 the quaternion that specifies the rotation + */ public final void setRotation(Quat4d q1){ - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -3437,18 +3437,18 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m00 = (1.0 - 2.0f*q1.y*q1.y - 2.0f*q1.z*q1.z)*tmp_scale[0]; m10 = (2.0*(q1.x*q1.y + q1.w*q1.z))*tmp_scale[0]; m20 = (2.0*(q1.x*q1.z - q1.w*q1.y))*tmp_scale[0]; - + m01 = (2.0*(q1.x*q1.y - q1.w*q1.z))*tmp_scale[1]; m11 = (1.0 - 2.0f*q1.x*q1.x - 2.0f*q1.z*q1.z)*tmp_scale[1]; m21 = (2.0*(q1.y*q1.z + q1.w*q1.x))*tmp_scale[1]; - + m02 = (2.0*(q1.x*q1.z + q1.w*q1.y))*tmp_scale[2]; m12 = (2.0*(q1.y*q1.z - q1.w*q1.x))*tmp_scale[2]; m22 = (1.0 - 2.0f*q1.x*q1.x - 2.0f*q1.y*q1.y)*tmp_scale[2]; - + } - /** + /** * Sets the rotational component (upper 3x3) of this matrix to the * matrix equivalent values of the axis-angle argument; the other * elements of this matrix are unchanged; a singular value @@ -3459,10 +3459,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * @param a1 the axis-angle to be converted (x, y, z, angle) */ public final void setRotation(AxisAngle4d a1) - { + { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); double mag = 1.0/Math.sqrt( a1.x*a1.x + a1.y*a1.y + a1.z*a1.z); @@ -3485,7 +3485,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { m10 = (t * xy + sinTheta * az)*tmp_scale[0]; m11 = (t * ay * ay + cosTheta)*tmp_scale[1]; m12 = (t * yz - sinTheta * ax)*tmp_scale[2]; - + m20 = (t * xz - sinTheta * ay)*tmp_scale[0]; m21 = (t * yz + sinTheta * ax)*tmp_scale[1]; m22 = (t * az * az + cosTheta)*tmp_scale[2]; @@ -3517,7 +3517,7 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Negates the value of this matrix: this = -this. - */ + */ public final void negate() { m00 = -m00; @@ -3542,10 +3542,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { * Sets the value of this matrix equal to the negation of * of the Matrix4d parameter. * @param m1 the source matrix - */ + */ public final void negate(Matrix4d m1) { - this.m00 = -m1.m00; + this.m00 = -m1.m00; this.m01 = -m1.m01; this.m02 = -m1.m02; this.m03 = -m1.m03; @@ -3603,9 +3603,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the first matrix element in the first row. - * + * * @return Returns the m00. - * + * * @since vecmath 1.5 */ public final double getM00() { @@ -3614,10 +3614,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the first matrix element in the first row. - * + * * @param m00 The m00 to set. - * - * + * + * * @since vecmath 1.5 */ public final void setM00(double m00) { @@ -3626,9 +3626,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the second matrix element in the first row. - * + * * @return Returns the m01. - * + * * @since vecmath 1.5 */ public final double getM01() { @@ -3637,9 +3637,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the first row. - * + * * @param m01 The m01 to set. - * + * * @since vecmath 1.5 */ public final void setM01(double m01) { @@ -3648,9 +3648,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the first row. - * + * * @return Returns the m02. - * + * * @since vecmath 1.5 */ public final double getM02() { @@ -3659,9 +3659,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the first row. - * + * * @param m02 The m02 to set. - * + * * @since vecmath 1.5 */ public final void setM02(double m02) { @@ -3670,9 +3670,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get first matrix element in the second row. - * + * * @return Returns the m10. - * + * * @since vecmath 1.5 */ public final double getM10() { @@ -3681,9 +3681,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set first matrix element in the second row. - * + * * @param m10 The m10 to set. - * + * * @since vecmath 1.5 */ public final void setM10(double m10) { @@ -3692,9 +3692,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get second matrix element in the second row. - * + * * @return Returns the m11. - * + * * @since vecmath 1.5 */ public final double getM11() { @@ -3703,9 +3703,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the second row. - * + * * @param m11 The m11 to set. - * + * * @since vecmath 1.5 */ public final void setM11(double m11) { @@ -3714,9 +3714,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the second row. - * + * * @return Returns the m12. - * + * * @since vecmath 1.5 */ public final double getM12() { @@ -3725,10 +3725,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the second row. - * + * * @param m12 The m12 to set. - * - * + * + * * @since vecmath 1.5 */ public final void setM12(double m12) { @@ -3737,9 +3737,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the first matrix element in the third row. - * + * * @return Returns the m20. - * + * * @since vecmath 1.5 */ public final double getM20() { @@ -3748,9 +3748,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the first matrix element in the third row. - * + * * @param m20 The m20 to set. - * + * * @since vecmath 1.5 */ public final void setM20(double m20) { @@ -3759,9 +3759,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the second matrix element in the third row. - * + * * @return Returns the m21. - * + * * @since vecmath 1.5 */ public final double getM21() { @@ -3770,9 +3770,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the third row. - * + * * @param m21 The m21 to set. - * + * * @since vecmath 1.5 */ public final void setM21(double m21) { @@ -3781,9 +3781,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the third row. - * + * * @return Returns the m22. - * + * * @since vecmath 1.5 */ public final double getM22() { @@ -3792,9 +3792,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the third row. - * + * * @param m22 The m22 to set. - * + * * @since vecmath 1.5 */ public final void setM22(double m22) { @@ -3803,9 +3803,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the fourth element of the first row. - * + * * @return Returns the m03. - * + * * @since vecmath 1.5 */ public final double getM03() { @@ -3814,9 +3814,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the fourth element of the first row. - * + * * @param m03 The m03 to set. - * + * * @since vecmath 1.5 */ public final void setM03(double m03) { @@ -3825,9 +3825,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the fourth element of the second row. - * + * * @return Returns the m13. - * + * * @since vecmath 1.5 */ public final double getM13() { @@ -3836,9 +3836,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the fourth element of the second row. - * + * * @param m13 The m13 to set. - * + * * @since vecmath 1.5 */ public final void setM13(double m13) { @@ -3847,9 +3847,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the fourth element of the third row. - * + * * @return Returns the m23. - * + * * @since vecmath 1.5 */ public final double getM23() { @@ -3858,9 +3858,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the fourth element of the third row. - * + * * @param m23 The m23 to set. - * + * * @since vecmath 1.5 */ public final void setM23(double m23) { @@ -3869,9 +3869,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the first element of the fourth row. - * + * * @return Returns the m30. - * + * * @since vecmath 1.5 */ public final double getM30() { @@ -3880,9 +3880,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the first element of the fourth row. - * + * * @param m30 The m30 to set. - * + * * @since vecmath 1.5 */ public final void setM30(double m30) { @@ -3891,9 +3891,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the second element of the fourth row. - * + * * @return Returns the m31. - * + * * @since vecmath 1.5 */ public final double getM31() { @@ -3902,9 +3902,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the second element of the fourth row. - * + * * @param m31 The m31 to set. - * + * * @since vecmath 1.5 */ public final void setM31(double m31) { @@ -3913,10 +3913,10 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the third element of the fourth row. - * + * * @return Returns the m32. - * - * + * + * * @since vecmath 1.5 */ public final double getM32() { @@ -3925,9 +3925,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the third element of the fourth row. - * + * * @param m32 The m32 to set. - * + * * @since vecmath 1.5 */ public final void setM32(double m32) { @@ -3936,9 +3936,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Get the fourth element of the fourth row. - * + * * @return Returns the m33. - * + * * @since vecmath 1.5 */ public final double getM33() { @@ -3947,9 +3947,9 @@ public class Matrix4d implements java.io.Serializable, Cloneable { /** * Set the fourth element of the fourth row. - * + * * @param m33 The m33 to set. - * + * * @since vecmath 1.5 */ public final void setM33(double m33) { diff --git a/src/javax/vecmath/Matrix4f.java b/src/javax/vecmath/Matrix4f.java index d79968a..c2d23b7 100644 --- a/src/javax/vecmath/Matrix4f.java +++ b/src/javax/vecmath/Matrix4f.java @@ -42,7 +42,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { // Compatible with 1.1 static final long serialVersionUID = -8405036035410109353L; - + /** * The first element of the first row. */ @@ -172,7 +172,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = m31; this.m32 = m32; this.m33 = m33; - + } /** @@ -201,7 +201,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = v[13]; this.m32 = v[14]; this.m33 = v[15]; - + } /** @@ -212,7 +212,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * @param q1 the quaternion value representing the rotational component * @param t1 the translational component of the matrix * @param s the scale value applied to the rotational components - */ + */ public Matrix4f(Quat4f q1, Vector3f t1, float s) { m00 = (float)(s*(1.0 - 2.0*q1.y*q1.y - 2.0*q1.z*q1.z)); @@ -239,7 +239,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Constructs a new matrix with the same values as the + * Constructs a new matrix with the same values as the * Matrix4d parameter. * @param m1 the source matrix */ @@ -264,10 +264,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = (float)m1.m31; this.m32 = (float)m1.m32; this.m33 = (float)m1.m33; - + } - - + + /** * Constructs a new matrix with the same values as the * Matrix4f parameter. @@ -294,9 +294,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = m1.m31; this.m32 = m1.m32; this.m33 = m1.m33; - + } - + /** * Constructs and initializes a Matrix4f from the rotation matrix, @@ -328,10 +328,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = 0.0f; this.m32 = 0.0f; this.m33 = 1.0f; - + } - - + + /** * Constructs and initializes a Matrix4f to all zeros. */ @@ -356,13 +356,13 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = (float) 0.0; this.m32 = (float) 0.0; this.m33 = (float) 0.0; - + } - /** + /** * Returns a string that contains the values of this Matrix4f. * @return the String representation - */ + */ public String toString() { return this.m00 + ", " + this.m01 + ", " + this.m02 + ", " + this.m03 + "\n" + @@ -405,7 +405,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { */ public final void setElement(int row, int column, float value) { - switch (row) + switch (row) { case 0: switch(column) @@ -428,7 +428,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { break; case 1: - switch(column) + switch(column) { case 0: this.m10 = value; @@ -448,7 +448,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { break; case 2: - switch(column) + switch(column) { case 0: this.m20 = value; @@ -468,7 +468,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { break; case 3: - switch(column) + switch(column) { case 0: this.m30 = value; @@ -500,7 +500,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { */ public final float getElement(int row, int column) { - switch (row) + switch (row) { case 0: switch(column) @@ -518,7 +518,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } break; case 1: - switch(column) + switch(column) { case 0: return(this.m10); @@ -532,9 +532,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { break; } break; - + case 2: - switch(column) + switch(column) { case 0: return(this.m20); @@ -548,9 +548,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { break; } break; - + case 3: - switch(column) + switch(column) { case 0: return(this.m30); @@ -564,7 +564,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { break; } break; - + default: break; } @@ -575,7 +575,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * Copies the matrix values in the specified row into the vector parameter. * @param row the matrix row * @param v the vector into which the matrix row values will be copied - */ + */ public final void getRow(int row, Vector4f v) { if( row == 0 ) { v.x = m00; @@ -603,11 +603,11 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } - /** + /** * Copies the matrix values in the specified row into the array parameter. * @param row the matrix row * @param v the array into which the matrix row values will be copied - */ + */ public final void getRow(int row, float v[]) { if( row == 0 ) { v[0] = m00; @@ -635,12 +635,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } - /** + /** * Copies the matrix values in the specified column into the vector * parameter. * @param column the matrix column * @param v the vector into which the matrix row values will be copied - */ + */ public final void getColumn(int column, Vector4f v) { if( column == 0 ) { v.x = m00; @@ -668,12 +668,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } - /** + /** * Copies the matrix values in the specified column into the array * parameter. * @param column the matrix column * @param v the array into which the matrix row values will be copied - */ + */ public final void getColumn(int column, float v[]) { if( column == 0 ) { v[0] = m00; @@ -700,16 +700,16 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } } - - /** - * Sets the scale component of the current matrix by factoring - * out the current scale (by doing an SVD) from the rotational - * component and multiplying by the new scale. - * @param scale the new scale amount + + /** + * Sets the scale component of the current matrix by factoring + * out the current scale (by doing an SVD) from the rotational + * component and multiplying by the new scale. + * @param scale the new scale amount */ public final void setScale(float scale){ - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); @@ -733,12 +733,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * the normalized rotational component; the values are placed into * the Matrix3d parameter. * @param m1 matrix into which the rotational component is placed - */ + */ public final void get(Matrix3d m1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m1.m00 = tmp_rot[0]; @@ -760,70 +760,70 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * the normalized rotational component; the values are placed into * the Matrix3f parameter. * @param m1 matrix into which the rotational component is placed - */ + */ public final void get(Matrix3f m1) { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m1.m00 = (float)tmp_rot[0]; m1.m01 = (float)tmp_rot[1]; m1.m02 = (float)tmp_rot[2]; - + m1.m10 = (float)tmp_rot[3]; m1.m11 = (float)tmp_rot[4]; m1.m12 = (float)tmp_rot[5]; - + m1.m20 = (float)tmp_rot[6]; m1.m21 = (float)tmp_rot[7]; m1.m22 = (float)tmp_rot[8]; } - + /** - * Performs an SVD normalization of this matrix to calculate - * the rotation as a 3x3 matrix, the translation, and the scale. - * None of the matrix values are modified. - * @param m1 the normalized matrix representing the rotation - * @param t1 the translation component - * @return the scale component of this transform - */ - public final float get(Matrix3f m1, Vector3f t1) - { + * Performs an SVD normalization of this matrix to calculate + * the rotation as a 3x3 matrix, the translation, and the scale. + * None of the matrix values are modified. + * @param m1 the normalized matrix representing the rotation + * @param t1 the translation component + * @return the scale component of this transform + */ + public final float get(Matrix3f m1, Vector3f t1) + { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); - + m1.m00 = (float)tmp_rot[0]; m1.m01 = (float)tmp_rot[1]; m1.m02 = (float)tmp_rot[2]; - + m1.m10 = (float)tmp_rot[3]; m1.m11 = (float)tmp_rot[4]; m1.m12 = (float)tmp_rot[5]; - + m1.m20 = (float)tmp_rot[6]; m1.m21 = (float)tmp_rot[7]; m1.m22 = (float)tmp_rot[8]; - + t1.x = m03; t1.y = m13; t1.z = m23; - + return( (float)Matrix3d.max3( tmp_scale )); - } - - - /** - * Performs an SVD normalization of this matrix in order to acquire - * the normalized rotational component; the values are placed into - * the Quat4f parameter. - * @param q1 quaternion into which the rotation component is placed + } + + + /** + * Performs an SVD normalization of this matrix in order to acquire + * the normalized rotational component; the values are placed into + * the Quat4f parameter. + * @param q1 quaternion into which the rotation component is placed */ public final void get(Quat4f q1){ double[] tmp_rot = new double[9]; // scratch matrix @@ -858,69 +858,69 @@ public class Matrix4f implements java.io.Serializable, Cloneable { q1.y = (float)(Math.sqrt(ww)); q1.z = (float)(tmp_rot[7]/(2.0*q1.y)); return; - } - + } + q1.y = 0.0f; q1.z = 1.0f; } - - + + /** * Retrieves the translational components of this matrix. * @param trans the vector that will receive the translational component */ public final void get(Vector3f trans) - { + { trans.x = m03; trans.y = m13; trans.z = m23; } - /** - * Gets the upper 3x3 values of this matrix and places them into - * the matrix m1. - * @param m1 the matrix that will hold the values + /** + * Gets the upper 3x3 values of this matrix and places them into + * the matrix m1. + * @param m1 the matrix that will hold the values */ - public final void getRotationScale(Matrix3f m1) - { - m1.m00 = m00; m1.m01 = m01; m1.m02 = m02; - m1.m10 = m10; m1.m11 = m11; m1.m12 = m12; - m1.m20 = m20; m1.m21 = m21; m1.m22 = m22; - } + public final void getRotationScale(Matrix3f m1) + { + m1.m00 = m00; m1.m01 = m01; m1.m02 = m02; + m1.m10 = m10; m1.m11 = m11; m1.m12 = m12; + m1.m20 = m20; m1.m21 = m21; m1.m22 = m22; + } /** * Performs an SVD normalization of this matrix to calculate - * and return the uniform scale factor. If the matrix has non-uniform - * scale factors, the largest of the x, y, and z scale factors will + * and return the uniform scale factor. If the matrix has non-uniform + * scale factors, the largest of the x, y, and z scale factors will * be returned. This matrix is not modified. * @return the scale factor of this matrix - */ - public final float getScale() + */ + public final float getScale() { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); return( (float)Matrix3d.max3( tmp_scale )); - } - + } + - /** - * Replaces the upper 3x3 matrix values of this matrix with the - * values in the matrix m1. - * @param m1 the matrix that will be the new upper 3x3 - */ - public final void setRotationScale(Matrix3f m1) - { + /** + * Replaces the upper 3x3 matrix values of this matrix with the + * values in the matrix m1. + * @param m1 the matrix that will be the new upper 3x3 + */ + public final void setRotationScale(Matrix3f m1) + { m00 = m1.m00; m01 = m1.m01; m02 = m1.m02; m10 = m1.m10; m11 = m1.m11; m12 = m1.m12; m20 = m1.m20; m21 = m1.m21; m22 = m1.m22; - } - - + } + + /** * Sets the specified row of this matrix4f to the four values provided. * @param row the row number to be modified (zero indexed) @@ -1203,7 +1203,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * the result into this. Matrix m1 is not modified. * @param scalar the scalar adder * @param m1 the original matrix values - */ + */ public final void add(float scalar, Matrix4f m1) { this.m00 = m1.m00 + scalar; @@ -1252,33 +1252,33 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m33 = m1.m33 + m2.m33; } - - /** + + /** * Sets the value of this matrix to the sum of itself and matrix m1. * @param m1 the other matrix */ public final void add(Matrix4f m1) - { + { this.m00 += m1.m00; this.m01 += m1.m01; this.m02 += m1.m02; this.m03 += m1.m03; - + this.m10 += m1.m10; this.m11 += m1.m11; this.m12 += m1.m12; this.m13 += m1.m13; - + this.m20 += m1.m20; this.m21 += m1.m21; this.m22 += m1.m22; this.m23 += m1.m23; - + this.m30 += m1.m30; this.m31 += m1.m31; this.m32 += m1.m32; this.m33 += m1.m33; - } + } /** * Performs an element-by-element subtraction of matrix m2 from @@ -1311,7 +1311,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Sets this matrix to the matrix difference of itself and + * Sets this matrix to the matrix difference of itself and * matrix m1 (this = this - m1). * @param m1 the other matrix */ @@ -1321,22 +1321,22 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m01 -= m1.m01; this.m02 -= m1.m02; this.m03 -= m1.m03; - + this.m10 -= m1.m10; this.m11 -= m1.m11; this.m12 -= m1.m12; this.m13 -= m1.m13; - + this.m20 -= m1.m20; this.m21 -= m1.m21; this.m22 -= m1.m22; this.m23 -= m1.m23; - + this.m30 -= m1.m30; this.m31 -= m1.m31; this.m32 -= m1.m32; this.m33 -= m1.m33; - } + } /** * Sets the value of this matrix to its transpose in place. @@ -1458,11 +1458,11 @@ public class Matrix4f implements java.io.Serializable, Cloneable { float sinTheta = (float)Math.sin((double)a1.angle); float cosTheta = (float)Math.cos((double)a1.angle); float t = 1.0f - cosTheta; - + float xz = ax * az; float xy = ax * ay; float yz = ay * az; - + m00 = t * ax * ax + cosTheta; m01 = t * xy - sinTheta * az; m02 = t * xz + sinTheta * ay; @@ -1697,7 +1697,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { public final void invert(Matrix4f m1) { - invertGeneral( m1); + invertGeneral( m1); } /** @@ -1705,7 +1705,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { */ public final void invert() { - invertGeneral( this ); + invertGeneral( this ); } /** @@ -1725,34 +1725,34 @@ public class Matrix4f implements java.io.Serializable, Cloneable { // Use LU decomposition and backsubstitution code specifically // for floating-point 4x4 matrices. - // Copy source matrix to t1tmp + // Copy source matrix to t1tmp temp[0] = m1.m00; temp[1] = m1.m01; temp[2] = m1.m02; temp[3] = m1.m03; - + temp[4] = m1.m10; temp[5] = m1.m11; temp[6] = m1.m12; temp[7] = m1.m13; - + temp[8] = m1.m20; temp[9] = m1.m21; temp[10] = m1.m22; temp[11] = m1.m23; - + temp[12] = m1.m30; temp[13] = m1.m31; temp[14] = m1.m32; temp[15] = m1.m33; - // Calculate LU decomposition: Is the matrix singular? + // Calculate LU decomposition: Is the matrix singular? if (!luDecomposition(temp, row_perm)) { - // Matrix has no inverse + // Matrix has no inverse throw new SingularMatrixException(VecMathI18N.getString("Matrix4f12")); } - // Perform back substitution on the identity matrix + // Perform back substitution on the identity matrix for(i=0;i<16;i++) result[i] = 0.0; result[0] = 1.0; result[5] = 1.0; result[10] = 1.0; result[15] = 1.0; luBacksubstitution(temp, row_perm, result); @@ -1766,12 +1766,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m11 = (float)result[5]; this.m12 = (float)result[6]; this.m13 = (float)result[7]; - + this.m20 = (float)result[8]; this.m21 = (float)result[9]; this.m22 = (float)result[10]; this.m23 = (float)result[11]; - + this.m30 = (float)result[12]; this.m31 = (float)result[13]; this.m32 = (float)result[14]; @@ -1780,13 +1780,13 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Given a 4x4 array "matrix0", this function replaces it with the - * LU decomposition of a row-wise permutation of itself. The input - * parameters are "matrix0" and "dimen". The array "matrix0" is also - * an output parameter. The vector "row_perm[4]" is an output - * parameter that contains the row permutations resulting from partial - * pivoting. The output parameter "even_row_xchg" is 1 when the - * number of row exchanges is even, or -1 otherwise. Assumes data + * Given a 4x4 array "matrix0", this function replaces it with the + * LU decomposition of a row-wise permutation of itself. The input + * parameters are "matrix0" and "dimen". The array "matrix0" is also + * an output parameter. The vector "row_perm[4]" is an output + * parameter that contains the row permutations resulting from partial + * pivoting. The output parameter "even_row_xchg" is 1 when the + * number of row exchanges is even, or -1 otherwise. Assumes data * type is always double. * * This function is similar to luDecomposition, except that it @@ -1795,8 +1795,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * @return true if the matrix is nonsingular, or false otherwise. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 40-45. // static boolean luDecomposition(double[] matrix0, @@ -1804,7 +1804,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { double row_scale[] = new double[4]; - // Determine implicit scaling information by looping over rows + // Determine implicit scaling information by looping over rows { int i, j; int ptr, rs; @@ -1813,12 +1813,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable { ptr = 0; rs = 0; - // For each row ... + // For each row ... i = 4; while (i-- != 0) { big = 0.0; - // For each column, find the largest element in the row + // For each column, find the largest element in the row j = 4; while (j-- != 0) { temp = matrix0[ptr++]; @@ -1828,7 +1828,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } } - // Is the matrix singular? + // Is the matrix singular? if (big == 0.0) { return false; } @@ -1842,13 +1842,13 @@ public class Matrix4f implements java.io.Serializable, Cloneable { mtx = 0; - // For all columns, execute Crout's method + // For all columns, execute Crout's method for (j = 0; j < 4; j++) { int i, imax, k; int target, p1, p2; double sum, big, temp; - // Determine elements of upper diagonal matrix U + // Determine elements of upper diagonal matrix U for (i = 0; i < j; i++) { target = mtx + (4*i) + j; sum = matrix0[target]; @@ -1880,7 +1880,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } matrix0[target] = sum; - // Is this the best pivot so far? + // Is this the best pivot so far? if ((temp = row_scale[i] * Math.abs(sum)) >= big) { big = temp; imax = i; @@ -1891,9 +1891,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { throw new RuntimeException(VecMathI18N.getString("Matrix4f13")); } - // Is a row exchange necessary? + // Is a row exchange necessary? if (j != imax) { - // Yes: exchange rows + // Yes: exchange rows k = 4; p1 = mtx + (4*imax); p2 = mtx + (4*j); @@ -1903,19 +1903,19 @@ public class Matrix4f implements java.io.Serializable, Cloneable { matrix0[p2++] = temp; } - // Record change in scale factor + // Record change in scale factor row_scale[imax] = row_scale[j]; } - // Record row permutation + // Record row permutation row_perm[j] = imax; - // Is the matrix singular + // Is the matrix singular if (matrix0[(mtx + (4*j) + j)] == 0.0) { return false; } - // Divide elements of lower diagonal matrix L by pivot + // Divide elements of lower diagonal matrix L by pivot if (j != (4-1)) { temp = 1.0 / (matrix0[(mtx + (4*j) + j)]); target = mtx + (4*(j+1)) + j; @@ -1945,8 +1945,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * derived. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 44-45. // static void luBacksubstitution(double[] matrix1, @@ -1956,17 +1956,17 @@ public class Matrix4f implements java.io.Serializable, Cloneable { int i, ii, ip, j, k; int rp; int cv, rv; - + // rp = row_perm; rp = 0; - // For each column vector of matrix2 ... + // For each column vector of matrix2 ... for (k = 0; k < 4; k++) { // cv = &(matrix2[0][k]); cv = k; ii = -1; - // Forward substitution + // Forward substitution for (i = 0; i < 4; i++) { double sum; @@ -1986,7 +1986,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { matrix2[cv+4*i] = sum; } - // Backsubstitution + // Backsubstitution // rv = &(matrix1[3][0]); rv = 3*4; matrix2[cv+4*3] /= matrix1[rv+3]; @@ -2016,15 +2016,15 @@ public class Matrix4f implements java.io.Serializable, Cloneable { { float det; - // cofactor exapainsion along first row + // cofactor exapainsion along first row - det = m00*(m11*m22*m33+ m12*m23*m31 + m13*m21*m32 + det = m00*(m11*m22*m33+ m12*m23*m31 + m13*m21*m32 - m13*m22*m31 -m11*m23*m32 - m12*m21*m33); - det -= m01*(m10*m22*m33+ m12*m23*m30 + m13*m20*m32 + det -= m01*(m10*m22*m33+ m12*m23*m30 + m13*m20*m32 - m13*m22*m30 -m10*m23*m32 - m12*m20*m33); - det += m02*(m10*m21*m33+ m11*m23*m30 + m13*m20*m31 + det += m02*(m10*m21*m33+ m11*m23*m30 + m13*m20*m31 - m13*m21*m30 -m10*m23*m31 - m11*m20*m33); - det -= m03*(m10*m21*m32+ m11*m22*m30 + m12*m20*m31 + det -= m03*(m10*m21*m32+ m11*m22*m30 + m12*m20*m31 - m12*m21*m30 -m10*m22*m31 - m11*m20*m32); return( det ); @@ -2036,7 +2036,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * elements of this matrix are initialized as if this were an identity * matrix (i.e., affine matrix with no translational component). * @param m1 the single-precision 3x3 matrix - */ + */ public final void set(Matrix3f m1) { m00 = m1.m00; m01 = m1.m01; m02 = m1.m02; m03 = 0.0f; @@ -2051,7 +2051,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * elements of this matrix are initialized as if this were an identity * matrix (i.e., affine matrix with no translational component). * @param m1 the double-precision 3x3 matrix - */ + */ public final void set(Matrix3d m1) { m00 = (float)m1.m00; m01 = (float)m1.m01; m02 = (float)m1.m02; m03 = 0.0f; @@ -2093,7 +2093,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * array parameter (ie, the first four elements of the * array will be copied into the first row of this matrix, etc.). * @param m the single precision array of length 16 - */ + */ public final void set(float[] m) { m00 = m[0]; @@ -2124,7 +2124,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m00 = (float) 1.0; this.m01 = (float) 0.0; this.m02 = (float) 0.0; - this.m03 = v1.x; + this.m03 = v1.x; this.m10 = (float) 0.0; this.m11 = (float) 1.0; @@ -2143,9 +2143,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this transform to a scale and translation matrix; - * the scale is not applied to the translation and all of the matrix - * values are modified. + * Sets the value of this transform to a scale and translation matrix; + * the scale is not applied to the translation and all of the matrix + * values are modified. * @param scale the scale factor for the matrix * @param t1 the translation amount */ @@ -2173,9 +2173,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this transform to a scale and translation matrix; - * the translation is scaled by the scale factor and all of the matrix - * values are modified. + * Sets the value of this transform to a scale and translation matrix; + * the translation is scaled by the scale factor and all of the matrix + * values are modified. * @param t1 the translation amount * @param scale the scale factor for the matrix */ @@ -2203,7 +2203,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix from the rotation expressed by + * Sets the value of this matrix from the rotation expressed by * the rotation matrix m1, the translation t1, and the scale factor. * The translation is not modified by the scale. * @param m1 the rotation component @@ -2269,17 +2269,17 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * of the Vector3f argument; the other values of this matrix are not * modified. * @param trans the translational component - */ + */ public final void setTranslation(Vector3f trans) { - m03 = trans.x; + m03 = trans.x; m13 = trans.y; m23 = trans.z; } - + /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the x axis. * @param angle the angle to rotate about the X axis in radians */ @@ -2312,7 +2312,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the y axis. * @param angle the angle to rotate about the Y axis in radians */ @@ -2345,7 +2345,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the z axis. * @param angle the angle to rotate about the Z axis in radians */ @@ -2381,8 +2381,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * Multiplies each element of this matrix by a scalar. * @param scalar the scalar multiplier. */ - public final void mul(float scalar) - { + public final void mul(float scalar) + { m00 *= scalar; m01 *= scalar; m02 *= scalar; @@ -2401,12 +2401,12 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m33 *= scalar; } - /** + /** * Multiplies each element of matrix m1 by a scalar and places * the result into this. Matrix m1 is not modified. - * @param scalar the scalar multiplier. - * @param m1 the original matrix. - */ + * @param scalar the scalar multiplier. + * @param m1 the original matrix. + */ public final void mul(float scalar, Matrix4f m1) { this.m00 = m1.m00 * scalar; @@ -2425,56 +2425,56 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m31 = m1.m31 * scalar; this.m32 = m1.m32 * scalar; this.m33 = m1.m33 * scalar; - } + } /** * Sets the value of this matrix to the result of multiplying itself * with matrix m1. * @param m1 the other matrix */ - public final void mul(Matrix4f m1) + public final void mul(Matrix4f m1) { float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; // vars for temp result matrix - m00 = this.m00*m1.m00 + this.m01*m1.m10 + + m00 = this.m00*m1.m00 + this.m01*m1.m10 + this.m02*m1.m20 + this.m03*m1.m30; - m01 = this.m00*m1.m01 + this.m01*m1.m11 + + m01 = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21 + this.m03*m1.m31; - m02 = this.m00*m1.m02 + this.m01*m1.m12 + + m02 = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22 + this.m03*m1.m32; - m03 = this.m00*m1.m03 + this.m01*m1.m13 + + m03 = this.m00*m1.m03 + this.m01*m1.m13 + this.m02*m1.m23 + this.m03*m1.m33; - m10 = this.m10*m1.m00 + this.m11*m1.m10 + - this.m12*m1.m20 + this.m13*m1.m30; - m11 = this.m10*m1.m01 + this.m11*m1.m11 + + m10 = this.m10*m1.m00 + this.m11*m1.m10 + + this.m12*m1.m20 + this.m13*m1.m30; + m11 = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21 + this.m13*m1.m31; - m12 = this.m10*m1.m02 + this.m11*m1.m12 + + m12 = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22 + this.m13*m1.m32; - m13 = this.m10*m1.m03 + this.m11*m1.m13 + + m13 = this.m10*m1.m03 + this.m11*m1.m13 + this.m12*m1.m23 + this.m13*m1.m33; - m20 = this.m20*m1.m00 + this.m21*m1.m10 + - this.m22*m1.m20 + this.m23*m1.m30; - m21 = this.m20*m1.m01 + this.m21*m1.m11 + + m20 = this.m20*m1.m00 + this.m21*m1.m10 + + this.m22*m1.m20 + this.m23*m1.m30; + m21 = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21 + this.m23*m1.m31; - m22 = this.m20*m1.m02 + this.m21*m1.m12 + + m22 = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22 + this.m23*m1.m32; - m23 = this.m20*m1.m03 + this.m21*m1.m13 + + m23 = this.m20*m1.m03 + this.m21*m1.m13 + this.m22*m1.m23 + this.m23*m1.m33; - m30 = this.m30*m1.m00 + this.m31*m1.m10 + - this.m32*m1.m20 + this.m33*m1.m30; - m31 = this.m30*m1.m01 + this.m31*m1.m11 + + m30 = this.m30*m1.m00 + this.m31*m1.m10 + + this.m32*m1.m20 + this.m33*m1.m30; + m31 = this.m30*m1.m01 + this.m31*m1.m11 + this.m32*m1.m21 + this.m33*m1.m31; - m32 = this.m30*m1.m02 + this.m31*m1.m12 + + m32 = this.m30*m1.m02 + this.m31*m1.m12 + this.m32*m1.m22 + this.m33*m1.m32; - m33 = this.m30*m1.m03 + this.m31*m1.m13 + + m33 = this.m30*m1.m03 + this.m31*m1.m13 + this.m32*m1.m23 + this.m33*m1.m33; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13; this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23; @@ -2491,40 +2491,40 @@ public class Matrix4f implements java.io.Serializable, Cloneable { { if (this != m1 && this != m2) { - this.m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + + this.m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20 + m1.m03*m2.m30; - this.m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + + this.m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21 + m1.m03*m2.m31; - this.m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + + this.m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22 + m1.m03*m2.m32; - this.m03 = m1.m00*m2.m03 + m1.m01*m2.m13 + + this.m03 = m1.m00*m2.m03 + m1.m01*m2.m13 + m1.m02*m2.m23 + m1.m03*m2.m33; - this.m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20 + m1.m13*m2.m30; - this.m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + + this.m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21 + m1.m13*m2.m31; - this.m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + + this.m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22 + m1.m13*m2.m32; - this.m13 = m1.m10*m2.m03 + m1.m11*m2.m13 + + this.m13 = m1.m10*m2.m03 + m1.m11*m2.m13 + m1.m12*m2.m23 + m1.m13*m2.m33; - this.m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + + this.m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20 + m1.m23*m2.m30; - this.m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + + this.m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21 + m1.m23*m2.m31; - this.m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + + this.m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22 + m1.m23*m2.m32; - this.m23 = m1.m20*m2.m03 + m1.m21*m2.m13 + + this.m23 = m1.m20*m2.m03 + m1.m21*m2.m13 + m1.m22*m2.m23 + m1.m23*m2.m33; - this.m30 = m1.m30*m2.m00 + m1.m31*m2.m10 + + this.m30 = m1.m30*m2.m00 + m1.m31*m2.m10 + m1.m32*m2.m20 + m1.m33*m2.m30; - this.m31 = m1.m30*m2.m01 + m1.m31*m2.m11 + + this.m31 = m1.m30*m2.m01 + m1.m31*m2.m11 + m1.m32*m2.m21 + m1.m33*m2.m31; - this.m32 = m1.m30*m2.m02 + m1.m31*m2.m12 + + this.m32 = m1.m30*m2.m02 + m1.m31*m2.m12 + m1.m32*m2.m22 + m1.m33*m2.m32; - this.m33 = m1.m30*m2.m03 + m1.m31*m2.m13 + + this.m33 = m1.m30*m2.m03 + m1.m31*m2.m13 + m1.m32*m2.m23 + m1.m33*m2.m33; } else { float m00, m01, m02, m03, @@ -2535,17 +2535,17 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21 + m1.m03*m2.m31; m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22 + m1.m03*m2.m32; m03 = m1.m00*m2.m03 + m1.m01*m2.m13 + m1.m02*m2.m23 + m1.m03*m2.m33; - + m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20 + m1.m13*m2.m30; m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21 + m1.m13*m2.m31; m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22 + m1.m13*m2.m32; m13 = m1.m10*m2.m03 + m1.m11*m2.m13 + m1.m12*m2.m23 + m1.m13*m2.m33; - + m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20 + m1.m23*m2.m30; m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21 + m1.m23*m2.m31; m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22 + m1.m23*m2.m32; m23 = m1.m20*m2.m03 + m1.m21*m2.m13 + m1.m22*m2.m23 + m1.m23*m2.m33; - + m30 = m1.m30*m2.m00 + m1.m31*m2.m10 + m1.m32*m2.m20 + m1.m33*m2.m30; m31 = m1.m30*m2.m01 + m1.m31*m2.m11 + m1.m32*m2.m21 + m1.m33*m2.m31; m32 = m1.m30*m2.m02 + m1.m31*m2.m12 + m1.m32*m2.m22 + m1.m33*m2.m32; @@ -2563,7 +2563,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * m2, and places the result into this. * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication - */ + */ public final void mulTransposeBoth(Matrix4f m1, Matrix4f m2) { if (this != m1 && this != m2) { @@ -2591,27 +2591,27 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m10, m11, m12, m13, m20, m21, m22, m23, // vars for temp result matrix m30, m31, m32, m33; - + m00 = m1.m00*m2.m00 + m1.m10*m2.m01 + m1.m20*m2.m02 + m1.m30*m2.m03; m01 = m1.m00*m2.m10 + m1.m10*m2.m11 + m1.m20*m2.m12 + m1.m30*m2.m13; m02 = m1.m00*m2.m20 + m1.m10*m2.m21 + m1.m20*m2.m22 + m1.m30*m2.m23; m03 = m1.m00*m2.m30 + m1.m10*m2.m31 + m1.m20*m2.m32 + m1.m30*m2.m33; - + m10 = m1.m01*m2.m00 + m1.m11*m2.m01 + m1.m21*m2.m02 + m1.m31*m2.m03; m11 = m1.m01*m2.m10 + m1.m11*m2.m11 + m1.m21*m2.m12 + m1.m31*m2.m13; m12 = m1.m01*m2.m20 + m1.m11*m2.m21 + m1.m21*m2.m22 + m1.m31*m2.m23; m13 = m1.m01*m2.m30 + m1.m11*m2.m31 + m1.m21*m2.m32 + m1.m31*m2.m33; - + m20 = m1.m02*m2.m00 + m1.m12*m2.m01 + m1.m22*m2.m02 + m1.m32*m2.m03; m21 = m1.m02*m2.m10 + m1.m12*m2.m11 + m1.m22*m2.m12 + m1.m32*m2.m13; m22 = m1.m02*m2.m20 + m1.m12*m2.m21 + m1.m22*m2.m22 + m1.m32*m2.m23; m23 = m1.m02*m2.m30 + m1.m12*m2.m31 + m1.m22*m2.m32 + m1.m32*m2.m33; - + m30 = m1.m03*m2.m00 + m1.m13*m2.m01 + m1.m23*m2.m02 + m1.m33*m2.m03; m31 = m1.m03*m2.m10 + m1.m13*m2.m11 + m1.m23*m2.m12 + m1.m33*m2.m13; m32 = m1.m03*m2.m20 + m1.m13*m2.m21 + m1.m23*m2.m22 + m1.m33*m2.m23; m33 = m1.m03*m2.m30 + m1.m13*m2.m31 + m1.m23*m2.m32 + m1.m33*m2.m33; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13; this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23; @@ -2627,23 +2627,23 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * @param m2 the matrix on the right hand side of the multiplication */ public final void mulTransposeRight(Matrix4f m1, Matrix4f m2) - { + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02 + m1.m03*m2.m03; this.m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12 + m1.m03*m2.m13; this.m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22 + m1.m03*m2.m23; this.m03 = m1.m00*m2.m30 + m1.m01*m2.m31 + m1.m02*m2.m32 + m1.m03*m2.m33; - + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02 + m1.m13*m2.m03; this.m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12 + m1.m13*m2.m13; this.m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22 + m1.m13*m2.m23; this.m13 = m1.m10*m2.m30 + m1.m11*m2.m31 + m1.m12*m2.m32 + m1.m13*m2.m33; - + this.m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02 + m1.m23*m2.m03; this.m21 = m1.m20*m2.m10 + m1.m21*m2.m11 + m1.m22*m2.m12 + m1.m23*m2.m13; this.m22 = m1.m20*m2.m20 + m1.m21*m2.m21 + m1.m22*m2.m22 + m1.m23*m2.m23; this.m23 = m1.m20*m2.m30 + m1.m21*m2.m31 + m1.m22*m2.m32 + m1.m23*m2.m33; - + this.m30 = m1.m30*m2.m00 + m1.m31*m2.m01 + m1.m32*m2.m02 + m1.m33*m2.m03; this.m31 = m1.m30*m2.m10 + m1.m31*m2.m11 + m1.m32*m2.m12 + m1.m33*m2.m13; this.m32 = m1.m30*m2.m20 + m1.m31*m2.m21 + m1.m32*m2.m22 + m1.m33*m2.m23; @@ -2653,27 +2653,27 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m10, m11, m12, m13, m20, m21, m22, m23, // vars for temp result matrix m30, m31, m32, m33; - + m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02 + m1.m03*m2.m03; m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12 + m1.m03*m2.m13; m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22 + m1.m03*m2.m23; m03 = m1.m00*m2.m30 + m1.m01*m2.m31 + m1.m02*m2.m32 + m1.m03*m2.m33; - + m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02 + m1.m13*m2.m03; m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12 + m1.m13*m2.m13; m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22 + m1.m13*m2.m23; m13 = m1.m10*m2.m30 + m1.m11*m2.m31 + m1.m12*m2.m32 + m1.m13*m2.m33; - + m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02 + m1.m23*m2.m03; m21 = m1.m20*m2.m10 + m1.m21*m2.m11 + m1.m22*m2.m12 + m1.m23*m2.m13; m22 = m1.m20*m2.m20 + m1.m21*m2.m21 + m1.m22*m2.m22 + m1.m23*m2.m23; m23 = m1.m20*m2.m30 + m1.m21*m2.m31 + m1.m22*m2.m32 + m1.m23*m2.m33; - + m30 = m1.m30*m2.m00 + m1.m31*m2.m01 + m1.m32*m2.m02 + m1.m33*m2.m03; m31 = m1.m30*m2.m10 + m1.m31*m2.m11 + m1.m32*m2.m12 + m1.m33*m2.m13; m32 = m1.m30*m2.m20 + m1.m31*m2.m21 + m1.m32*m2.m22 + m1.m33*m2.m23; m33 = m1.m30*m2.m30 + m1.m31*m2.m31 + m1.m32*m2.m32 + m1.m33*m2.m33; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13; this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23; @@ -2681,32 +2681,32 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } } - - - /** + + + /** * Multiplies the transpose of matrix m1 times matrix m2, and * places the result into this. * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication */ public final void mulTransposeLeft(Matrix4f m1, Matrix4f m2) - { + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20 + m1.m30*m2.m30; this.m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21 + m1.m30*m2.m31; this.m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22 + m1.m30*m2.m32; this.m03 = m1.m00*m2.m03 + m1.m10*m2.m13 + m1.m20*m2.m23 + m1.m30*m2.m33; - + this.m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20 + m1.m31*m2.m30; this.m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21 + m1.m31*m2.m31; this.m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22 + m1.m31*m2.m32; this.m13 = m1.m01*m2.m03 + m1.m11*m2.m13 + m1.m21*m2.m23 + m1.m31*m2.m33; - + this.m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20 + m1.m32*m2.m30; this.m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21 + m1.m32*m2.m31; this.m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22 + m1.m32*m2.m32; this.m23 = m1.m02*m2.m03 + m1.m12*m2.m13 + m1.m22*m2.m23 + m1.m32*m2.m33; - + this.m30 = m1.m03*m2.m00 + m1.m13*m2.m10 + m1.m23*m2.m20 + m1.m33*m2.m30; this.m31 = m1.m03*m2.m01 + m1.m13*m2.m11 + m1.m23*m2.m21 + m1.m33*m2.m31; this.m32 = m1.m03*m2.m02 + m1.m13*m2.m12 + m1.m23*m2.m22 + m1.m33*m2.m32; @@ -2716,24 +2716,24 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m10, m11, m12, m13, m20, m21, m22, m23, // vars for temp result matrix m30, m31, m32, m33; - - + + m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20 + m1.m30*m2.m30; m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21 + m1.m30*m2.m31; m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22 + m1.m30*m2.m32; m03 = m1.m00*m2.m03 + m1.m10*m2.m13 + m1.m20*m2.m23 + m1.m30*m2.m33; - + m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20 + m1.m31*m2.m30; m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21 + m1.m31*m2.m31; m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22 + m1.m31*m2.m32; m13 = m1.m01*m2.m03 + m1.m11*m2.m13 + m1.m21*m2.m23 + m1.m31*m2.m33; - + m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20 + m1.m32*m2.m30; m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21 + m1.m32*m2.m31; m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22 + m1.m32*m2.m32; m23 = m1.m02*m2.m03 + m1.m12*m2.m13 + m1.m22*m2.m23 + m1.m32*m2.m33; - + m30 = m1.m03*m2.m00 + m1.m13*m2.m10 + m1.m23*m2.m20 + m1.m33*m2.m30; m31 = m1.m03*m2.m01 + m1.m13*m2.m11 + m1.m23*m2.m21 + m1.m33*m2.m31; m32 = m1.m03*m2.m02 + m1.m13*m2.m12 + m1.m23*m2.m22 + m1.m33*m2.m32; @@ -2746,38 +2746,38 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } } - + /** * Returns true if all of the data members of Matrix4f m1 are * equal to the corresponding data members in this Matrix4f. * @param m1 the matrix with which the comparison is made. * @return true or false - */ + */ public boolean equals(Matrix4f m1) { try { return(this.m00 == m1.m00 && this.m01 == m1.m01 && this.m02 == m1.m02 - && this.m03 == m1.m03 && this.m10 == m1.m10 && this.m11 == m1.m11 - && this.m12 == m1.m12 && this.m13 == m1.m13 && this.m20 == m1.m20 + && this.m03 == m1.m03 && this.m10 == m1.m10 && this.m11 == m1.m11 + && this.m12 == m1.m12 && this.m13 == m1.m13 && this.m20 == m1.m20 && this.m21 == m1.m21 && this.m22 == m1.m22 && this.m23 == m1.m23 && this.m30 == m1.m30 && this.m31 == m1.m31 && this.m32 == m1.m32 && this.m33 == m1.m33); - } + } catch (NullPointerException e2) { return false; } } - /** + /** * Returns true if the Object t1 is of type Matrix4f and all of the * data members of t1 are equal to the corresponding data members in * this Matrix4f. * @param t1 the matrix with which the comparison is made. * @return true or false - */ + */ public boolean equals(Object t1) { - try { + try { Matrix4f m2 = (Matrix4f) t1; return(this.m00 == m2.m00 && this.m01 == m2.m01 && this.m02 == m2.m02 && this.m03 == m2.m03 && this.m10 == m2.m10 && this.m11 == m2.m11 @@ -2790,15 +2790,15 @@ public class Matrix4f implements java.io.Serializable, Cloneable { catch (NullPointerException e2) { return false; } } - /** + /** * Returns true if the L-infinite distance between this matrix * and matrix m1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs(this.m(i,j) - m1.m(i,j)] * @param m1 the matrix to be compared to this matrix - * @param epsilon the threshold value - */ + * @param epsilon the threshold value + */ public boolean epsilonEquals(Matrix4f m1, float epsilon) { @@ -2836,7 +2836,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + (long)VecMathUtil.floatToIntBits(m00); @@ -2880,8 +2880,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable { vecOut.y = y; vecOut.z = z; } - - + + /** * Transform the vector vec using this Transform and place the * result back into vec. @@ -2890,7 +2890,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { public final void transform(Tuple4f vec) { float x,y,z; - + x = m00*vec.x + m01*vec.y + m02*vec.z + m03*vec.w; y = m10*vec.x + m11*vec.y @@ -2920,8 +2920,8 @@ public class Matrix4f implements java.io.Serializable, Cloneable { pointOut.x = x; pointOut.y = y; } - - + + /** * Transforms the point parameter with this Matrix4f and * places the result back into point. The fourth element of the @@ -2937,7 +2937,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { point.x = x; point.y = y; } - + /** * Transforms the normal parameter by this Matrix4f and places the value @@ -2955,7 +2955,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { normalOut.y = y; } - + /** * Transforms the normal parameter by this transform and places the value * back into normal. The fourth element of the normal is assumed to be zero. @@ -2972,22 +2972,22 @@ public class Matrix4f implements java.io.Serializable, Cloneable { normal.y = y; } - + /** * Sets the rotational component (upper 3x3) of this matrix to the * matrix values in the double precision Matrix3d argument; the other - * elements of this matrix are unchanged; a singular value - * decomposition is performed on this object's upper 3x3 matrix to + * elements of this matrix are unchanged; a singular value + * decomposition is performed on this object's upper 3x3 matrix to * factor out the scale, then this object's upper 3x3 matrix components - * are replaced by the passed rotation components, - * and then the scale is reapplied to the rotational components. + * are replaced by the passed rotation components, + * and then the scale is reapplied to the rotational components. * @param m1 double precision 3x3 matrix - */ + */ public final void setRotation( Matrix3d m1) { double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m00 = (float)(m1.m00*tmp_scale[0]); @@ -3010,14 +3010,14 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * elements of this matrix are unchanged; a singular value * decomposition is performed on this object's upper 3x3 matrix to * factor out the scale, then this object's upper 3x3 matrix components - * are replaced by the passed rotation components, + * are replaced by the passed rotation components, * and then the scale is reapplied to the rotational components. * @param m1 single precision 3x3 matrix - */ + */ public final void setRotation( Matrix3f m1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); m00 = (float)(m1.m00*tmp_scale[0]); @@ -3031,7 +3031,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m20 = (float)(m1.m20*tmp_scale[0]); m21 = (float)(m1.m21*tmp_scale[1]); m22 = (float)(m1.m22*tmp_scale[2]); - } + } /** * Sets the rotational component (upper 3x3) of this matrix to the @@ -3039,70 +3039,70 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * elements of this matrix are unchanged; a singular value * decomposition is performed on this object's upper 3x3 matrix to * factor out the scale, then this object's upper 3x3 matrix components - * are replaced by the matrix equivalent of the quaternion, + * are replaced by the matrix equivalent of the quaternion, * and then the scale is reapplied to the rotational components. * @param q1 the quaternion that specifies the rotation - */ - public final void setRotation(Quat4f q1){ + */ + public final void setRotation(Quat4f q1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix getScaleRotate( tmp_scale, tmp_rot ); - + m00 = (float)((1.0f - 2.0f*q1.y*q1.y - 2.0f*q1.z*q1.z)*tmp_scale[0]); m10 = (float)((2.0f*(q1.x*q1.y + q1.w*q1.z))*tmp_scale[0]); m20 = (float)((2.0f*(q1.x*q1.z - q1.w*q1.y))*tmp_scale[0]); - + m01 = (float)((2.0f*(q1.x*q1.y - q1.w*q1.z))*tmp_scale[1]); m11 = (float)((1.0f - 2.0f*q1.x*q1.x - 2.0f*q1.z*q1.z)*tmp_scale[1]); m21 = (float)((2.0f*(q1.y*q1.z + q1.w*q1.x))*tmp_scale[1]); - + m02 = (float)((2.0f*(q1.x*q1.z + q1.w*q1.y))*tmp_scale[2]); m12 = (float)((2.0f*(q1.y*q1.z - q1.w*q1.x))*tmp_scale[2]); m22 = (float)((1.0f - 2.0f*q1.x*q1.x - 2.0f*q1.y*q1.y)*tmp_scale[2]); - - } - - - /** + + } + + + /** * Sets the rotational component (upper 3x3) of this matrix to the * matrix equivalent values of the quaternion argument; the other - * elements of this matrix are unchanged; a singular value + * elements of this matrix are unchanged; a singular value * decomposition is performed on this object's upper 3x3 matrix to - * factor out the scale, then this object's upper 3x3 matrix components - * are replaced by the matrix equivalent of the quaternion, - * and then the scale is reapplied to the rotational components. + * factor out the scale, then this object's upper 3x3 matrix components + * are replaced by the matrix equivalent of the quaternion, + * and then the scale is reapplied to the rotational components. * @param q1 the quaternion that specifies the rotation - */ - public final void setRotation(Quat4d q1){ + */ + public final void setRotation(Quat4d q1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); - + m00 = (float)((1.0f - 2.0f*q1.y*q1.y - 2.0f*q1.z*q1.z)*tmp_scale[0]); m10 = (float)((2.0f*(q1.x*q1.y + q1.w*q1.z))*tmp_scale[0]); m20 = (float)((2.0f*(q1.x*q1.z - q1.w*q1.y))*tmp_scale[0]); - + m01 = (float)((2.0f*(q1.x*q1.y - q1.w*q1.z))*tmp_scale[1]); m11 = (float)((1.0f - 2.0f*q1.x*q1.x - 2.0f*q1.z*q1.z)*tmp_scale[1]); m21 = (float)((2.0f*(q1.y*q1.z + q1.w*q1.x))*tmp_scale[1]); - + m02 = (float)((2.0f*(q1.x*q1.z + q1.w*q1.y))*tmp_scale[2]); m12 = (float)((2.0f*(q1.y*q1.z - q1.w*q1.x))*tmp_scale[2]); m22 = (float)((1.0f - 2.0f*q1.x*q1.x - 2.0f*q1.y*q1.y)*tmp_scale[2]); - } + } - /** + /** * Sets the rotational component (upper 3x3) of this matrix to the * matrix equivalent values of the axis-angle argument; the other - * elements of this matrix are unchanged; a singular value + * elements of this matrix are unchanged; a singular value * decomposition is performed on this object's upper 3x3 matrix to - * factor out the scale, then this object's upper 3x3 matrix components + * factor out the scale, then this object's upper 3x3 matrix components * are replaced by the matrix equivalent of the axis-angle, * and then the scale is reapplied to the rotational components. * @param a1 the axis-angle to be converted (x, y, z, angle) - */ - public final void setRotation(AxisAngle4f a1){ + */ + public final void setRotation(AxisAngle4f a1){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix @@ -3126,19 +3126,19 @@ public class Matrix4f implements java.io.Serializable, Cloneable { double ax = a1.x*mag; double ay = a1.y*mag; double az = a1.z*mag; - + double sinTheta = Math.sin(a1.angle); double cosTheta = Math.cos(a1.angle); double t = 1.0 - cosTheta; - + double xz = a1.x * a1.z; double xy = a1.x * a1.y; double yz = a1.y * a1.z; - + m00 = (float)((t * ax * ax + cosTheta)*tmp_scale[0]); m01 = (float)((t * xy - sinTheta * az)*tmp_scale[1]); m02 = (float)((t * xz + sinTheta * ay)*tmp_scale[2]); - + m10 = (float)((t * xy + sinTheta * az)*tmp_scale[0]); m11 = (float)((t * ay * ay + cosTheta)*tmp_scale[1]); m12 = (float)((t * yz - sinTheta * ax)*tmp_scale[2]); @@ -3147,9 +3147,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { m21 = (float)((t * yz + sinTheta * ax)*tmp_scale[1]); m22 = (float)((t * az * az + cosTheta)*tmp_scale[2]); } - - } + + } /** * Sets this matrix to all zeros. @@ -3176,7 +3176,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Negates the value of this matrix: this = -this. - */ + */ public final void negate() { m00 = -m00; @@ -3201,7 +3201,7 @@ public class Matrix4f implements java.io.Serializable, Cloneable { * Sets the value of this matrix equal to the negation of * of the Matrix4f parameter. * @param m1 the source matrix - */ + */ public final void negate(Matrix4f m1) { this.m00 = -m1.m00; @@ -3222,22 +3222,22 @@ public class Matrix4f implements java.io.Serializable, Cloneable { this.m33 = -m1.m33; } private final void getScaleRotate(double scales[], double rots[]) { - + double[] tmp = new double[9]; // scratch matrix tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; - + tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; - + tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; - + Matrix3d.compute_svd( tmp, scales, rots); - + return; } @@ -3263,9 +3263,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the first matrix element in the first row. - * + * * @return Returns the m00. - * + * * @since vecmath 1.5 */ public final float getM00() { @@ -3274,9 +3274,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the first matrix element in the first row. - * + * * @param m00 The m00 to set. - * + * * @since vecmath 1.5 */ public final void setM00(float m00) { @@ -3285,9 +3285,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the second matrix element in the first row. - * + * * @return Returns the m01. - * + * * @since vecmath 1.5 */ public final float getM01() { @@ -3296,9 +3296,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the first row. - * + * * @param m01 The m01 to set. - * + * * @since vecmath 1.5 */ public final void setM01(float m01) { @@ -3307,9 +3307,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the first row. - * + * * @return Returns the m02. - * + * * @since vecmath 1.5 */ public final float getM02() { @@ -3318,9 +3318,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the first row. - * + * * @param m02 The m02 to set. - * + * * @since vecmath 1.5 */ public final void setM02(float m02) { @@ -3329,9 +3329,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get first matrix element in the second row. - * + * * @return Returns the m10. - * + * * @since vecmath 1.5 */ public final float getM10() { @@ -3340,9 +3340,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set first matrix element in the second row. - * + * * @param m10 The m10 to set. - * + * * @since vecmath 1.5 */ public final void setM10(float m10) { @@ -3351,9 +3351,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get second matrix element in the second row. - * + * * @return Returns the m11. - * + * * @since vecmath 1.5 */ public final float getM11() { @@ -3362,9 +3362,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the second row. - * + * * @param m11 The m11 to set. - * + * * @since vecmath 1.5 */ public final void setM11(float m11) { @@ -3373,9 +3373,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the second row. - * + * * @return Returns the m12. - * + * * @since vecmath 1.5 */ public final float getM12() { @@ -3384,9 +3384,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the second row. - * + * * @param m12 The m12 to set. - * + * * @since vecmath 1.5 */ public final void setM12(float m12) { @@ -3395,9 +3395,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the first matrix element in the third row. - * + * * @return Returns the m20. - * + * * @since vecmath 1.5 */ public final float getM20() { @@ -3406,9 +3406,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the first matrix element in the third row. - * + * * @param m20 The m20 to set. - * + * * @since vecmath 1.5 */ public final void setM20(float m20) { @@ -3417,9 +3417,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the second matrix element in the third row. - * + * * @return Returns the m21. - * + * * @since vecmath 1.5 */ public final float getM21() { @@ -3428,9 +3428,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the second matrix element in the third row. - * + * * @param m21 The m21 to set. - * + * * @since vecmath 1.5 */ public final void setM21(float m21) { @@ -3439,9 +3439,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the third matrix element in the third row. - * + * * @return Returns the m22. - * + * * @since vecmath 1.5 */ public final float getM22() { @@ -3450,9 +3450,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the third matrix element in the third row. - * + * * @param m22 The m22 to set. - * + * * @since vecmath 1.5 */ public final void setM22(float m22) { @@ -3461,9 +3461,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the fourth element of the first row. - * + * * @return Returns the m03. - * + * * @since vecmath 1.5 */ public final float getM03() { @@ -3472,9 +3472,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the fourth element of the first row. - * + * * @param m03 The m03 to set. - * + * * @since vecmath 1.5 */ public final void setM03(float m03) { @@ -3483,9 +3483,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the fourth element of the second row. - * + * * @return Returns the m13. - * + * * @since vecmath 1.5 */ public final float getM13() { @@ -3494,9 +3494,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the fourth element of the second row. - * + * * @param m13 The m13 to set. - * + * * @since vecmath 1.5 */ public final void setM13(float m13) { @@ -3505,9 +3505,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the fourth element of the third row. - * + * * @return Returns the m23. - * + * * @since vecmath 1.5 */ public final float getM23() { @@ -3516,9 +3516,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the fourth element of the third row. - * + * * @param m23 The m23 to set. - * + * * @since vecmath 1.5 */ public final void setM23(float m23) { @@ -3527,9 +3527,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the first element of the fourth row. - * + * * @return Returns the m30. - * + * * @since vecmath 1.5 */ public final float getM30() { @@ -3538,10 +3538,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the first element of the fourth row. - * + * * @param m30 The m30 to set. - * - * + * + * * @since vecmath 1.5 */ public final void setM30(float m30) { @@ -3550,9 +3550,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the second element of the fourth row. - * + * * @return Returns the m31. - * + * * @since vecmath 1.5 */ public final float getM31() { @@ -3561,9 +3561,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the second element of the fourth row. - * + * * @param m31 The m31 to set. - * + * * @since vecmath 1.5 */ public final void setM31(float m31) { @@ -3571,10 +3571,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable { } /** - * Get the third element of the fourth row. - * + * Get the third element of the fourth row. + * * @return Returns the m32. - * + * * @since vecmath 1.5 */ public final float getM32() { @@ -3583,10 +3583,10 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the third element of the fourth row. - * + * * @param m32 The m32 to set. - * - * + * + * * @since vecmath 1.5 */ public final void setM32(float m32) { @@ -3595,9 +3595,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Get the fourth element of the fourth row. - * + * * @return Returns the m33. - * + * * @since vecmath 1.5 */ public final float getM33() { @@ -3606,9 +3606,9 @@ public class Matrix4f implements java.io.Serializable, Cloneable { /** * Set the fourth element of the fourth row. - * + * * @param m33 The m33 to set. - * + * * @since vecmath 1.5 */ public final void setM33(float m33) { diff --git a/src/javax/vecmath/Point2d.java b/src/javax/vecmath/Point2d.java index 570ee6e..9c16c2e 100644 --- a/src/javax/vecmath/Point2d.java +++ b/src/javax/vecmath/Point2d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 2 element point that is represented by double precision floating + * A 2 element point that is represented by double precision floating * point x,y coordinates. * */ @@ -87,8 +87,8 @@ public class Point2d extends Tuple2d implements java.io.Serializable { /** * Constructs and initializes a Point2d from the specified Tuple2d. * @param t1 the Tuple2d containing the initialization x y data - */ - public Point2d(Tuple2d t1) + */ + public Point2d(Tuple2d t1) { super(t1); } @@ -97,8 +97,8 @@ public class Point2d extends Tuple2d implements java.io.Serializable { /** * Constructs and initializes a Point2d from the specified Tuple2f. * @param t1 the Tuple2f containing the initialization x y data - */ - public Point2d(Tuple2f t1) + */ + public Point2d(Tuple2f t1) { super(t1); } @@ -120,20 +120,20 @@ public class Point2d extends Tuple2d implements java.io.Serializable { { double dx, dy; - dx = this.x-p1.x; + dx = this.x-p1.x; dy = this.y-p1.y; return dx*dx+dy*dy; } /** * Computes the distance between this point and point p1. - * @param p1 the other point - */ + * @param p1 the other point + */ public final double distance(Point2d p1) { double dx, dy; - dx = this.x-p1.x; + dx = this.x-p1.x; dy = this.y-p1.y; return Math.sqrt(dx*dx+dy*dy); } @@ -151,8 +151,8 @@ public class Point2d extends Tuple2d implements java.io.Serializable { /** * Computes the L-infinite distance between this point and - * point p1. The L-infinite distance is equal to - * MAX[abs(x1-x2), abs(y1-y2)]. + * point p1. The L-infinite distance is equal to + * MAX[abs(x1-x2), abs(y1-y2)]. * @param p1 the other point */ public final double distanceLinf(Point2d p1) diff --git a/src/javax/vecmath/Point2f.java b/src/javax/vecmath/Point2f.java index a22e305..11272a5 100644 --- a/src/javax/vecmath/Point2f.java +++ b/src/javax/vecmath/Point2f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 2 element point that is represented by single precision floating + * A 2 element point that is represented by single precision floating * point x,y coordinates. * */ @@ -87,8 +87,8 @@ public class Point2f extends Tuple2f implements java.io.Serializable { /** * Constructs and initializes a Point2f from the specified Tuple2d. * @param t1 the Tuple2d containing the initialization x y z data - */ - public Point2f(Tuple2d t1) + */ + public Point2f(Tuple2d t1) { super(t1); } @@ -98,8 +98,8 @@ public class Point2f extends Tuple2f implements java.io.Serializable { /** * Constructs and initializes a Point2f from the specified Tuple2f. * @param t1 the Tuple2f containing the initialization x y data - */ - public Point2f(Tuple2f t1) + */ + public Point2f(Tuple2f t1) { super(t1); } @@ -121,20 +121,20 @@ public class Point2f extends Tuple2f implements java.io.Serializable { { float dx, dy; - dx = this.x-p1.x; + dx = this.x-p1.x; dy = this.y-p1.y; return dx*dx+dy*dy; } /** * Computes the distance between this point and point p1. - * @param p1 the other point - */ + * @param p1 the other point + */ public final float distance(Point2f p1) { float dx, dy; - dx = this.x-p1.x; + dx = this.x-p1.x; dy = this.y-p1.y; return (float) Math.sqrt(dx*dx+dy*dy); } @@ -152,8 +152,8 @@ public class Point2f extends Tuple2f implements java.io.Serializable { /** * Computes the L-infinite distance between this point and - * point p1. The L-infinite distance is equal to - * MAX[abs(x1-x2), abs(y1-y2)]. + * point p1. The L-infinite distance is equal to + * MAX[abs(x1-x2), abs(y1-y2)]. * @param p1 the other point */ public final float distanceLinf(Point2f p1) diff --git a/src/javax/vecmath/Point3d.java b/src/javax/vecmath/Point3d.java index 670ce5a..2bdbc1e 100644 --- a/src/javax/vecmath/Point3d.java +++ b/src/javax/vecmath/Point3d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 3 element point that is represented by double precision floating point + * A 3 element point that is represented by double precision floating point * x,y,z coordinates. * */ @@ -85,20 +85,20 @@ public class Point3d extends Tuple3d implements java.io.Serializable { } - /** - * Constructs and initializes a Point3d from the specified Tuple3f. - * @param t1 the Tuple3f containing the initialization x y z data - */ - public Point3d(Tuple3f t1) - { - super(t1); + /** + * Constructs and initializes a Point3d from the specified Tuple3f. + * @param t1 the Tuple3f containing the initialization x y z data + */ + public Point3d(Tuple3f t1) + { + super(t1); } - - - /** - * Constructs and initializes a Point3d from the specified Tuple3d. - * @param t1 the Tuple3d containing the initialization x y z data - */ + + + /** + * Constructs and initializes a Point3d from the specified Tuple3d. + * @param t1 the Tuple3d containing the initialization x y z data + */ public Point3d(Tuple3d t1) { super(t1); @@ -116,7 +116,7 @@ public class Point3d extends Tuple3d implements java.io.Serializable { /** * Returns the square of the distance between this point and point p1. - * @param p1 the other point + * @param p1 the other point * @return the square of the distance */ public final double distanceSquared(Point3d p1) @@ -133,7 +133,7 @@ public class Point3d extends Tuple3d implements java.io.Serializable { /** * Returns the distance between this point and point p1. * @param p1 the other point - * @return the distance + * @return the distance */ public final double distance(Point3d p1) { @@ -175,12 +175,12 @@ public class Point3d extends Tuple3d implements java.io.Serializable { /** - * Multiplies each of the x,y,z components of the Point4d parameter - * by 1/w and places the projected values into this point. - * @param p1 the source Point4d, which is not modified - */ + * Multiplies each of the x,y,z components of the Point4d parameter + * by 1/w and places the projected values into this point. + * @param p1 the source Point4d, which is not modified + */ public final void project(Point4d p1) - { + { double oneOw; oneOw = 1/p1.w; @@ -188,7 +188,7 @@ public class Point3d extends Tuple3d implements java.io.Serializable { y = p1.y*oneOw; z = p1.z*oneOw; - } + } } diff --git a/src/javax/vecmath/Point3f.java b/src/javax/vecmath/Point3f.java index 2e72bc2..6fe22d0 100644 --- a/src/javax/vecmath/Point3f.java +++ b/src/javax/vecmath/Point3f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 3 element point that is represented by single precision floating point + * A 3 element point that is represented by single precision floating point * x,y,z coordinates. * */ @@ -89,8 +89,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable { /** * Constructs and initializes a Point3f from the specified Tuple3f. * @param t1 the Tuple3f containing the initialization x y z data - */ - public Point3f(Tuple3f t1) + */ + public Point3f(Tuple3f t1) { super(t1); } @@ -99,8 +99,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable { /** * Constructs and initializes a Point3f from the specified Tuple3d. * @param t1 the Tuple3d containing the initialization x y z data - */ - public Point3f(Tuple3d t1) + */ + public Point3f(Tuple3d t1) { super(t1); } @@ -116,7 +116,7 @@ public class Point3f extends Tuple3f implements java.io.Serializable { /** - * Computes the square of the distance between this point and + * Computes the square of the distance between this point and * point p1. * @param p1 the other point * @return the square of the distance @@ -163,8 +163,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable { /** * Computes the L-infinite distance between this point and - * point p1. The L-infinite distance is equal to - * MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)]. + * point p1. The L-infinite distance is equal to + * MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)]. * @param p1 the other point * @return the L-infinite distance */ diff --git a/src/javax/vecmath/Point4d.java b/src/javax/vecmath/Point4d.java index c873e27..1e99b81 100644 --- a/src/javax/vecmath/Point4d.java +++ b/src/javax/vecmath/Point4d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4 element vector represented by double precision floating point + * A 4 element vector represented by double precision floating point * x,y,z,w coordinates. * */ @@ -87,25 +87,25 @@ public class Point4d extends Tuple4d implements java.io.Serializable { } - /** - * Constructs and initializes a Point4d from the specified Tuple4f. - * @param t1 the Tuple4f containing the initialization x y z w data - */ - public Point4d(Tuple4f t1) - { - super(t1); - } - - - /** - * Constructs and initializes a Point4d from the specified Tuple4d. - * @param t1 the Tuple4d containing the initialization x y z w data - */ - public Point4d(Tuple4d t1) - { - super(t1); - } - + /** + * Constructs and initializes a Point4d from the specified Tuple4f. + * @param t1 the Tuple4f containing the initialization x y z w data + */ + public Point4d(Tuple4f t1) + { + super(t1); + } + + + /** + * Constructs and initializes a Point4d from the specified Tuple4d. + * @param t1 the Tuple4d containing the initialization x y z w data + */ + public Point4d(Tuple4d t1) + { + super(t1); + } + /** * Constructs and initializes a Point4d from the specified Tuple3d. @@ -203,18 +203,18 @@ public class Point4d extends Tuple4d implements java.io.Serializable { double t1, t2; t1 = Math.max( Math.abs(this.x-p1.x), Math.abs(this.y-p1.y)); t2 = Math.max( Math.abs(this.z-p1.z), Math.abs(this.w-p1.w)); - + return Math.max(t1,t2); } /** - * Multiplies each of the x,y,z components of the Point4d parameter + * Multiplies each of the x,y,z components of the Point4d parameter * by 1/w, places the projected values into this point, and places - * a 1 as the w parameter of this point. - * @param p1 the source Point4d, which is not modified - */ + * a 1 as the w parameter of this point. + * @param p1 the source Point4d, which is not modified + */ public final void project(Point4d p1) - { + { double oneOw; oneOw = 1/p1.w; @@ -223,7 +223,7 @@ public class Point4d extends Tuple4d implements java.io.Serializable { z = p1.z*oneOw; w = 1.0; - } + } } diff --git a/src/javax/vecmath/Point4f.java b/src/javax/vecmath/Point4f.java index c8922d2..5a7fda1 100644 --- a/src/javax/vecmath/Point4f.java +++ b/src/javax/vecmath/Point4f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4 element point represented by single precision floating point x,y,z,w + * A 4 element point represented by single precision floating point x,y,z,w * coordinates. * */ @@ -58,7 +58,7 @@ public class Point4f extends Tuple4f implements java.io.Serializable { /** - * Constructs and initializes a Point4f from the array of length 4. + * Constructs and initializes a Point4f from the array of length 4. * @param p the array of length 4 containing xyzw in order */ public Point4f(float[] p) @@ -87,25 +87,25 @@ public class Point4f extends Tuple4f implements java.io.Serializable { } - /** - * Constructs and initializes a Point4f from the specified Tuple4f. - * @param t1 the Tuple4f containing the initialization x y z w data - */ - public Point4f(Tuple4f t1) - { - super(t1); + /** + * Constructs and initializes a Point4f from the specified Tuple4f. + * @param t1 the Tuple4f containing the initialization x y z w data + */ + public Point4f(Tuple4f t1) + { + super(t1); } - - - /** - * Constructs and initializes a Point4f from the specified Tuple4d. - * @param t1 the Tuple4d containing the initialization x y z w data - */ + + + /** + * Constructs and initializes a Point4f from the specified Tuple4d. + * @param t1 the Tuple4d containing the initialization x y z w data + */ public Point4f(Tuple4d t1) { super(t1); } - + /** * Constructs and initializes a Point4f from the specified Tuple3f. @@ -205,19 +205,19 @@ public class Point4f extends Tuple4f implements java.io.Serializable { float t1, t2; t1 = Math.max( Math.abs(this.x-p1.x), Math.abs(this.y-p1.y)); t2 = Math.max( Math.abs(this.z-p1.z), Math.abs(this.w-p1.w)); - + return(Math.max(t1,t2)); } /** - * Multiplies each of the x,y,z components of the Point4f parameter + * Multiplies each of the x,y,z components of the Point4f parameter * by 1/w, places the projected values into this point, and places - * a 1 as the w parameter of this point. - * @param p1 the source Point4f, which is not modified - */ + * a 1 as the w parameter of this point. + * @param p1 the source Point4f, which is not modified + */ public final void project(Point4f p1) - { + { float oneOw; oneOw = 1/p1.w; @@ -226,6 +226,6 @@ public class Point4f extends Tuple4f implements java.io.Serializable { z = p1.z*oneOw; w = 1.0f; - } + } } diff --git a/src/javax/vecmath/Quat4d.java b/src/javax/vecmath/Quat4d.java index a139f7f..c236eef 100644 --- a/src/javax/vecmath/Quat4d.java +++ b/src/javax/vecmath/Quat4d.java @@ -32,7 +32,7 @@ package javax.vecmath; /** - * A 4-element quaternion represented by double precision floating + * A 4-element quaternion represented by double precision floating * point x,y,z,w coordinates. The quaternion is always normalized. * */ @@ -65,12 +65,12 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { } /** - * Constructs and initializes a Quat4d from the array of length 4. + * Constructs and initializes a Quat4d from the array of length 4. * @param q the array of length 4 containing xyzw in order */ public Quat4d(double[] q) { - double mag; + double mag; mag = 1.0/Math.sqrt( q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3] ); x = q[0]*mag; y = q[1]*mag; @@ -98,12 +98,12 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { } - /** - * Constructs and initializes a Quat4d from the specified Tuple4f. - * @param t1 the Tuple4f containing the initialization x y z w data - */ - public Quat4d(Tuple4f t1) - { + /** + * Constructs and initializes a Quat4d from the specified Tuple4f. + * @param t1 the Tuple4f containing the initialization x y z w data + */ + public Quat4d(Tuple4f t1) + { double mag; mag = 1.0/Math.sqrt( t1.x*t1.x + t1.y*t1.y + t1.z*t1.z + t1.w*t1.w ); x = t1.x*mag; @@ -112,12 +112,12 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { w = t1.w*mag; } - - - /** - * Constructs and initializes a Quat4d from the specified Tuple4d. - * @param t1 the Tuple4d containing the initialization x y z w data - */ + + + /** + * Constructs and initializes a Quat4d from the specified Tuple4d. + * @param t1 the Tuple4d containing the initialization x y z w data + */ public Quat4d(Tuple4d t1) { double mag; @@ -152,7 +152,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { /** - * Negate the value of of each of this quaternion's x,y,z coordinates + * Negate the value of of each of this quaternion's x,y,z coordinates * in place. */ public final void conjugate() @@ -165,7 +165,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { /** * Sets the value of this quaternion to the quaternion product of - * quaternions q1 and q2 (this = q1 * q2). + * quaternions q1 and q2 (this = q1 * q2). * Note that this is safe for aliasing (e.g. this can be q1 or q2). * @param q1 the first quaternion * @param q2 the second quaternion @@ -193,12 +193,12 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { /** * Sets the value of this quaternion to the quaternion product of - * itself and q1 (this = this * q1). + * itself and q1 (this = this * q1). * @param q1 the other quaternion */ public final void mul(Quat4d q1) { - double x, y, w; + double x, y, w; w = this.w*q1.w - this.x*q1.x - this.y*q1.y - this.z*q1.z; x = this.w*q1.x + q1.w*this.x + this.y*q1.z - this.z*q1.y; @@ -207,24 +207,24 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { this.w = w; this.x = x; this.y = y; - } + } - /** + /** * Multiplies quaternion q1 by the inverse of quaternion q2 and places - * the value into this quaternion. The value of both argument quaternions + * the value into this quaternion. The value of both argument quaternions * is preservered (this = q1 * q2^-1). - * @param q1 the first quaternion + * @param q1 the first quaternion * @param q2 the second quaternion - */ - public final void mulInverse(Quat4d q1, Quat4d q2) - { - Quat4d tempQuat = new Quat4d(q2); - - tempQuat.inverse(); - this.mul(q1, tempQuat); + */ + public final void mulInverse(Quat4d q1, Quat4d q2) + { + Quat4d tempQuat = new Quat4d(q2); + + tempQuat.inverse(); + this.mul(q1, tempQuat); } - + /** @@ -234,7 +234,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { * @param q1 the other quaternion */ public final void mulInverse(Quat4d q1) - { + { Quat4d tempQuat = new Quat4d(q1); tempQuat.inverse(); @@ -263,8 +263,8 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { */ public final void inverse() { - double norm; - + double norm; + norm = 1.0/(this.w*this.w + this.x*this.x + this.y*this.y + this.z*this.z); this.w *= norm; this.x *= -norm; @@ -328,7 +328,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { * the passed matrix. * @param m1 the matrix4f */ - public final void set(Matrix4f m1) + public final void set(Matrix4f m1) { double ww = 0.25*(m1.m00 + m1.m11 + m1.m22 + m1.m33); @@ -365,7 +365,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { this.z = 1; return; } - + this.x = 0; ww = 0.5*(1.0 - m1.m22); if (ww >= EPS2) { @@ -421,7 +421,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { this.z = 1; return; } - + this.x = 0.0; ww = 0.5*(1.0 - m1.m22); if (ww >= EPS2) { @@ -429,7 +429,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { this.z = m1.m21/(2.0*this.y); return; } - + this.y = 0; this.z = 1; } @@ -477,19 +477,19 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { this.z = 1; return; } - + this.x = 0; ww = 0.5*(1.0 - m1.m22); if (ww >= EPS2) { this.y = Math.sqrt(ww); this.z = (m1.m21/(2.0*this.y)); } - + this.y = 0; this.z = 1; } - + /** * Sets the value of this quaternion to the rotational component of * the passed matrix. @@ -529,10 +529,10 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { } else { this.x = 0; this.y = 0; - this.z = 1; + this.z = 1; return; } - + this.x = 0; ww = 0.5*(1.0 - m1.m22); if (ww >= EPS2) { @@ -540,12 +540,12 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { this.z = m1.m21/(2.0*this.y); return; } - + this.y = 0; this.z = 1; } - + /** * Sets the value of this quaternion to the equivalent rotation * of the AxisAngle argument. @@ -554,7 +554,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { public final void set(AxisAngle4f a) { double mag,amag; - // Quat = cos(theta/2) + sin(theta/2)(roation_axis) + // Quat = cos(theta/2) + sin(theta/2)(roation_axis) amag = Math.sqrt( a.x*a.x + a.y*a.y + a.z*a.z); if( amag < EPS ) { @@ -570,7 +570,7 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { y = a.y*amag*mag; z = a.z*amag*mag; } - + } /** @@ -581,25 +581,25 @@ public class Quat4d extends Tuple4d implements java.io.Serializable { public final void set(AxisAngle4d a) { double mag,amag; - // Quat = cos(theta/2) + sin(theta/2)(roation_axis) - + // Quat = cos(theta/2) + sin(theta/2)(roation_axis) + amag = Math.sqrt( a.x*a.x + a.y*a.y + a.z*a.z); if( amag < EPS ) { w = 0.0; x = 0.0; y = 0.0; z = 0.0; - } else { - amag = 1.0/amag; + } else { + amag = 1.0/amag; mag = Math.sin(a.angle/2.0); w = Math.cos(a.angle/2.0); x = a.x*amag*mag; y = a.y*amag*mag; z = a.z*amag*mag; } - + } - + /** * Performs a great circle interpolation between this quaternion * and the quaternion parameter and places the result into this diff --git a/src/javax/vecmath/Quat4f.java b/src/javax/vecmath/Quat4f.java index d0b6129..b7e3b95 100644 --- a/src/javax/vecmath/Quat4f.java +++ b/src/javax/vecmath/Quat4f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4 element unit quaternion represented by single precision floating + * A 4 element unit quaternion represented by single precision floating * point x,y,z,w coordinates. The quaternion is always normalized. * */ @@ -66,7 +66,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { } /** - * Constructs and initializes a Quat4f from the array of length 4. + * Constructs and initializes a Quat4f from the array of length 4. * @param q the array of length 4 containing xyzw in order */ public Quat4f(float[] q) @@ -100,12 +100,12 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { } - /** - * Constructs and initializes a Quat4f from the specified Tuple4f. - * @param t1 the Tuple4f containing the initialization x y z w data - */ - public Quat4f(Tuple4f t1) - { + /** + * Constructs and initializes a Quat4f from the specified Tuple4f. + * @param t1 the Tuple4f containing the initialization x y z w data + */ + public Quat4f(Tuple4f t1) + { float mag; mag = (float)(1.0/Math.sqrt( t1.x*t1.x + t1.y*t1.y + t1.z*t1.z + t1.w*t1.w )); x = t1.x*mag; @@ -114,12 +114,12 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { w = t1.w*mag; } - - - /** - * Constructs and initializes a Quat4f from the specified Tuple4d. - * @param t1 the Tuple4d containing the initialization x y z w data - */ + + + /** + * Constructs and initializes a Quat4f from the specified Tuple4d. + * @param t1 the Tuple4d containing the initialization x y z w data + */ public Quat4f(Tuple4d t1) { double mag; @@ -165,7 +165,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { /** * Sets the value of this quaternion to the quaternion product of - * quaternions q1 and q2 (this = q1 * q2). + * quaternions q1 and q2 (this = q1 * q2). * Note that this is safe for aliasing (e.g. this can be q1 or q2). * @param q1 the first quaternion * @param q2 the second quaternion @@ -193,12 +193,12 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { /** * Sets the value of this quaternion to the quaternion product of - * itself and q1 (this = this * q1). + * itself and q1 (this = this * q1). * @param q1 the other quaternion */ public final void mul(Quat4f q1) { - float x, y, w; + float x, y, w; w = this.w*q1.w - this.x*q1.x - this.y*q1.y - this.z*q1.z; x = this.w*q1.x + q1.w*this.x + this.y*q1.z - this.z*q1.y; @@ -207,24 +207,24 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.w = w; this.x = x; this.y = y; - } + } - /** + /** * Multiplies quaternion q1 by the inverse of quaternion q2 and places - * the value into this quaternion. The value of both argument quaternions + * the value into this quaternion. The value of both argument quaternions * is preservered (this = q1 * q2^-1). * @param q1 the first quaternion * @param q2 the second quaternion - */ - public final void mulInverse(Quat4f q1, Quat4f q2) - { - Quat4f tempQuat = new Quat4f(q2); - - tempQuat.inverse(); - this.mul(q1, tempQuat); + */ + public final void mulInverse(Quat4f q1, Quat4f q2) + { + Quat4f tempQuat = new Quat4f(q2); + + tempQuat.inverse(); + this.mul(q1, tempQuat); } - + /** @@ -234,7 +234,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { * @param q1 the other quaternion */ public final void mulInverse(Quat4f q1) - { + { Quat4f tempQuat = new Quat4f(q1); tempQuat.inverse(); @@ -264,8 +264,8 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { */ public final void inverse() { - float norm; - + float norm; + norm = 1.0f/(this.w*this.w + this.x*this.x + this.y*this.y + this.z*this.z); this.w *= norm; this.x *= -norm; @@ -329,7 +329,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { * the passed matrix. * @param m1 the Matrix4f */ - public final void set(Matrix4f m1) + public final void set(Matrix4f m1) { float ww = 0.25f*(m1.m00 + m1.m11 + m1.m22 + m1.m33); @@ -341,7 +341,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.y = (m1.m02 - m1.m20)*ww; this.z = (m1.m10 - m1.m01)*ww; return; - } + } } else { this.w = 0; this.x = 0; @@ -352,7 +352,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.w = 0; ww = -0.5f*(m1.m11 + m1.m22); - + if (ww >= 0) { if (ww >= EPS2) { this.x = (float) Math.sqrt((double) ww); @@ -367,7 +367,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.z = 1; return; } - + this.x = 0; ww = 0.5f*(1.0f - m1.m22); @@ -376,7 +376,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.z = m1.m21/(2.0f*this.y); return; } - + this.y = 0; this.z = 1; } @@ -417,14 +417,14 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.y = (float)(m1.m10*ww); this.z = (float)(m1.m20*ww); return; - } + } } else { this.x = 0; this.y = 0; this.z = 1; return; } - + this.x = 0; ww = 0.5*(1.0 - m1.m22); if (ww >= EPS2) { @@ -432,7 +432,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.z = (float) (m1.m21/(2.0*(double)(this.y))); return; } - + this.y = 0; this.z = 1; } @@ -488,7 +488,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.z = m1.m21/(2.0f*this.y); return; } - + this.y = 0; this.z = 1; } @@ -536,7 +536,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.z = 1; return; } - + this.x = 0; ww = 0.5*(1.0 - m1.m22); if (ww >= EPS2) { @@ -544,7 +544,7 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { this.z = (float) (m1.m21/(2.0*(double)(this.y))); return; } - + this.y = 0; this.z = 1; } @@ -558,15 +558,15 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { public final void set(AxisAngle4f a) { float mag,amag; - // Quat = cos(theta/2) + sin(theta/2)(roation_axis) + // Quat = cos(theta/2) + sin(theta/2)(roation_axis) amag = (float)Math.sqrt( a.x*a.x + a.y*a.y + a.z*a.z); if (amag < EPS ) { w = 0.0f; x = 0.0f; y = 0.0f; z = 0.0f; - } else { - amag = 1.0f/amag; + } else { + amag = 1.0f/amag; mag = (float)Math.sin(a.angle/2.0); w = (float)Math.cos(a.angle/2.0); x = a.x*amag*mag; @@ -584,26 +584,26 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { public final void set(AxisAngle4d a) { float mag,amag; - // Quat = cos(theta/2) + sin(theta/2)(roation_axis) - + // Quat = cos(theta/2) + sin(theta/2)(roation_axis) + amag = (float)(1.0/Math.sqrt( a.x*a.x + a.y*a.y + a.z*a.z)); - + if (amag < EPS ) { w = 0.0f; x = 0.0f; y = 0.0f; z = 0.0f; - } else { - amag = 1.0f/amag; + } else { + amag = 1.0f/amag; mag = (float)Math.sin(a.angle/2.0); w = (float)Math.cos(a.angle/2.0); x = (float)a.x*amag*mag; y = (float)a.y*amag*mag; z = (float)a.z*amag*mag; } - + } - + /** * Performs a great circle interpolation between this quaternion @@ -614,12 +614,12 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { */ public final void interpolate(Quat4f q1, float alpha) { // From "Advanced Animation and Rendering Techniques" - // by Watt and Watt pg. 364, function as implemented appeared to be + // by Watt and Watt pg. 364, function as implemented appeared to be // incorrect. Fails to choose the same quaternion for the double // covering. Resulting in change of direction for rotations. // Fixed function to negate the first quaternion in the case that the - // dot product of q1 and this is negative. Second case was not needed. - + // dot product of q1 and this is negative. Second case was not needed. + double dot,s1,s2,om,sinom; dot = x*q1.x + y*q1.y + z*q1.z + w*q1.w; @@ -648,25 +648,25 @@ public class Quat4f extends Tuple4f implements java.io.Serializable { - /** + /** * Performs a great circle interpolation between quaternion q1 - * and quaternion q2 and places the result into this quaternion. + * and quaternion q2 and places the result into this quaternion. * @param q1 the first quaternion * @param q2 the second quaternion - * @param alpha the alpha interpolation parameter - */ - public final void interpolate(Quat4f q1, Quat4f q2, float alpha) { + * @param alpha the alpha interpolation parameter + */ + public final void interpolate(Quat4f q1, Quat4f q2, float alpha) { // From "Advanced Animation and Rendering Techniques" - // by Watt and Watt pg. 364, function as implemented appeared to be + // by Watt and Watt pg. 364, function as implemented appeared to be // incorrect. Fails to choose the same quaternion for the double // covering. Resulting in change of direction for rotations. // Fixed function to negate the first quaternion in the case that the - // dot product of q1 and this is negative. Second case was not needed. + // dot product of q1 and this is negative. Second case was not needed. double dot,s1,s2,om,sinom; dot = q2.x*q1.x + q2.y*q1.y + q2.z*q1.z + q2.w*q1.w; - + if ( dot < 0 ) { // negate quaternion q1.x = -q1.x; q1.y = -q1.y; q1.z = -q1.z; q1.w = -q1.w; diff --git a/src/javax/vecmath/TexCoord2f.java b/src/javax/vecmath/TexCoord2f.java index 1c06590..5698060 100644 --- a/src/javax/vecmath/TexCoord2f.java +++ b/src/javax/vecmath/TexCoord2f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 2-element vector that is represented by single-precision floating + * A 2-element vector that is represented by single-precision floating * point x,y coordinates. * */ @@ -77,8 +77,8 @@ public class TexCoord2f extends Tuple2f implements java.io.Serializable { /** * Constructs and initializes a TexCoord2f from the specified Tuple2f. * @param t1 the Tuple2f containing the initialization x y data - */ - public TexCoord2f(Tuple2f t1) + */ + public TexCoord2f(Tuple2f t1) { super(t1); } diff --git a/src/javax/vecmath/TexCoord3f.java b/src/javax/vecmath/TexCoord3f.java index 0b712ac..8bbbb92 100644 --- a/src/javax/vecmath/TexCoord3f.java +++ b/src/javax/vecmath/TexCoord3f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 3 element texture coordinate that is represented by single precision + * A 3 element texture coordinate that is represented by single precision * floating point x,y,z coordinates. * */ @@ -79,8 +79,8 @@ public class TexCoord3f extends Tuple3f implements java.io.Serializable { /** * Constructs and initializes a TexCoord3f from the specified Tuple3f. * @param t1 the Tuple3f containing the initialization x y z data - */ - public TexCoord3f(Tuple3f t1) + */ + public TexCoord3f(Tuple3f t1) { super(t1); } @@ -89,8 +89,8 @@ public class TexCoord3f extends Tuple3f implements java.io.Serializable { /** * Constructs and initializes a TexCoord3f from the specified Tuple3d. * @param t1 the Tuple3d containing the initialization x y z data - */ - public TexCoord3f(Tuple3d t1) + */ + public TexCoord3f(Tuple3d t1) { super(t1); } diff --git a/src/javax/vecmath/TexCoord4f.java b/src/javax/vecmath/TexCoord4f.java index 6562a91..fbcf779 100644 --- a/src/javax/vecmath/TexCoord4f.java +++ b/src/javax/vecmath/TexCoord4f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4 element texture coordinate that is represented by single precision + * A 4 element texture coordinate that is represented by single precision * floating point x,y,z,w coordinates. * * @since vecmath 1.3 @@ -81,8 +81,8 @@ public class TexCoord4f extends Tuple4f implements java.io.Serializable { /** * Constructs and initializes a TexCoord4f from the specified Tuple4f. * @param t1 the Tuple4f containing the initialization x y z w data - */ - public TexCoord4f(Tuple4f t1) + */ + public TexCoord4f(Tuple4f t1) { super(t1); } @@ -91,8 +91,8 @@ public class TexCoord4f extends Tuple4f implements java.io.Serializable { /** * Constructs and initializes a TexCoord4f from the specified Tuple4d. * @param t1 the Tuple4d containing the initialization x y z w data - */ - public TexCoord4f(Tuple4d t1) + */ + public TexCoord4f(Tuple4d t1) { super(t1); } diff --git a/src/javax/vecmath/Tuple2d.java b/src/javax/vecmath/Tuple2d.java index 5655aab..d97ef25 100644 --- a/src/javax/vecmath/Tuple2d.java +++ b/src/javax/vecmath/Tuple2d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A generic 2-element tuple that is represented by double-precision + * A generic 2-element tuple that is represented by double-precision * floating point x,y coordinates. * */ @@ -120,7 +120,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** - * Sets the value of this tuple from the 2 values specified in + * Sets the value of this tuple from the 2 values specified in * the array. * @param t the array of length 2 containing xy in order */ @@ -140,7 +140,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { this.x = t1.x; this.y = t1.y; } - + /** * Sets the value of this tuple to the value of Tuple2f t1. @@ -178,7 +178,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** * Sets the value of this tuple to the vector sum of itself and tuple t1. * @param t1 the other tuple - */ + */ public final void add(Tuple2d t1) { this.x += t1.x; @@ -187,23 +187,23 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** - * Sets the value of this tuple to the vector difference of - * tuple t1 and t2 (this = t1 - t2). + * Sets the value of this tuple to the vector difference of + * tuple t1 and t2 (this = t1 - t2). * @param t1 the first tuple * @param t2 the second tuple - */ + */ public final void sub(Tuple2d t1, Tuple2d t2) { this.x = t1.x - t2.x; this.y = t1.y - t2.y; - } + } /** * Sets the value of this tuple to the vector difference of * itself and tuple t1 (this = this - t1). * @param t1 the other vector - */ + */ public final void sub(Tuple2d t1) { this.x -= t1.x; @@ -263,13 +263,13 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { * @param s the scalar value * @param t1 the tuple to be multipled * @param t2 the tuple to be added - */ + */ public final void scaleAdd(double s, Tuple2d t1, Tuple2d t2) { - this.x = s*t1.x + t2.x; - this.y = s*t1.y + t2.y; - } - + this.x = s*t1.x + t2.x; + this.y = s*t1.y + t2.y; + } + /** * Sets the value of this tuple to the scalar multiplication @@ -292,7 +292,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + VecMathUtil.doubleToLongBits(x); @@ -301,12 +301,12 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } - /** + /** * Returns true if all of the data members of Tuple2d t1 are * equal to the corresponding data members in this Tuple2d. * @param t1 the vector with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple2d t1) { try { @@ -316,13 +316,13 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } - /** + /** * Returns true if the Object t1 is of type Tuple2d and all of the * data members of t1 are equal to the corresponding data members in * this Tuple2d. * @param t1 the object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object t1) { try { @@ -336,11 +336,11 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this tuple - * and tuple t1 is less than or equal to the epsilon parameter, + * and tuple t1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to MAX[abs(x1-x2), abs(y1-y2)]. + * distance is equal to MAX[abs(x1-x2), abs(y1-y2)]. * @param t1 the tuple to be compared to this tuple - * @param epsilon the threshold value + * @param epsilon the threshold value * @return true or false */ public boolean epsilonEquals(Tuple2d t1, double epsilon) @@ -362,7 +362,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this Tuple2d. * The form is (x,y). * @return the String representation - */ + */ public String toString() { return("(" + this.x + ", " + this.y + ")"); @@ -370,15 +370,15 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** - * Clamps the tuple parameter to the range [low, high] and - * places the values into this tuple. + * Clamps the tuple parameter to the range [low, high] and + * places the values into this tuple. * @param min the lowest value in the tuple after clamping - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified */ public final void clamp(double min, double max, Tuple2d t) { - if( t.x > max ) { + if( t.x > max ) { x = max; } else if( t.x < min ){ x = min; @@ -386,7 +386,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { x = t.x; } - if( t.y > max ) { + if( t.y > max ) { y = max; } else if( t.y < min ){ y = min; @@ -397,62 +397,62 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } - /** - * Clamps the minimum value of the tuple parameter to the min + /** + * Clamps the minimum value of the tuple parameter to the min * parameter and places the values into this tuple. - * @param min the lowest value in the tuple after clamping + * @param min the lowest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMin(double min, Tuple2d t) - { - if( t.x < min ) { + */ + public final void clampMin(double min, Tuple2d t) + { + if( t.x < min ) { x = min; } else { x = t.x; } - if( t.y < min ) { + if( t.y < min ) { y = min; } else { y = t.y; } - } + } - /** - * Clamps the maximum value of the tuple parameter to the max + /** + * Clamps the maximum value of the tuple parameter to the max * parameter and places the values into this tuple. - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMax(double max, Tuple2d t) - { - if( t.x > max ) { + */ + public final void clampMax(double max, Tuple2d t) + { + if( t.x > max ) { x = max; - } else { + } else { x = t.x; } - + if( t.y > max ) { y = max; } else { y = t.y; } - } + } - /** - * Sets each component of the tuple parameter to its absolute + /** + * Sets each component of the tuple parameter to its absolute * value and places the modified values into this tuple. * @param t the source tuple, which will not be modified - */ + */ public final void absolute(Tuple2d t) { x = Math.abs(t.x); y = Math.abs(t.y); - } + } @@ -468,7 +468,7 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } else if( x < min ){ x = min; } - + if( y > max ) { y = max; } else if( y < min ){ @@ -477,24 +477,24 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } - + /** * Clamps the minimum value of this tuple to the min parameter. * @param min the lowest value in this tuple after clamping */ public final void clampMin(double min) - { + { if( x < min ) x=min; if( y < min ) y=min; - } - - + } + + /** * Clamps the maximum value of this tuple to the max parameter. * @param max the highest value in the tuple after clamping */ public final void clampMax(double max) - { + { if( x > max ) x=max; if( y > max ) y=max; } @@ -510,8 +510,8 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } - /** - * Linearly interpolates between tuples t1 and t2 and places the + /** + * Linearly interpolates between tuples t1 and t2 and places the * result into this tuple: this = (1-alpha)*t1 + alpha*t2. * @param t1 the first tuple * @param t2 the second tuple @@ -524,18 +524,18 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } - /** - * Linearly interpolates between this tuple and tuple t1 and + /** + * Linearly interpolates between this tuple and tuple t1 and * places the result into this tuple: this = (1-alpha)*this + alpha*t1. * @param t1 the first tuple - * @param alpha the alpha interpolation parameter - */ - public final void interpolate(Tuple2d t1, double alpha) - { + * @param alpha the alpha interpolation parameter + */ + public final void interpolate(Tuple2d t1, double alpha) + { this.x = (1-alpha)*this.x + alpha*t1.x; this.y = (1-alpha)*this.y + alpha*t1.y; - } + } /** * Creates a new object of the same class as this object. @@ -558,9 +558,9 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getX() { @@ -570,9 +570,9 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(double x) { @@ -582,9 +582,9 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getY() { @@ -594,9 +594,9 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(double y) { diff --git a/src/javax/vecmath/Tuple2f.java b/src/javax/vecmath/Tuple2f.java index 57d2703..f46bcaf 100644 --- a/src/javax/vecmath/Tuple2f.java +++ b/src/javax/vecmath/Tuple2f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A generic 2-element tuple that is represented by single-precision + * A generic 2-element tuple that is represented by single-precision * floating point x,y coordinates. * */ @@ -121,7 +121,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** - * Sets the value of this tuple from the 2 values specified in + * Sets the value of this tuple from the 2 values specified in * the array. * @param t the array of length 2 containing xy in order */ @@ -141,7 +141,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { this.x = t1.x; this.y = t1.y; } - + /** * Sets the value of this tuple to the value of the Tuple2d argument. @@ -180,7 +180,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** * Sets the value of this tuple to the vector sum of itself and tuple t1. * @param t1 the other tuple - */ + */ public final void add(Tuple2f t1) { this.x += t1.x; @@ -189,23 +189,23 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** - * Sets the value of this tuple to the vector difference of - * tuple t1 and t2 (this = t1 - t2). + * Sets the value of this tuple to the vector difference of + * tuple t1 and t2 (this = t1 - t2). * @param t1 the first tuple * @param t2 the second tuple - */ + */ public final void sub(Tuple2f t1, Tuple2f t2) { this.x = t1.x - t2.x; this.y = t1.y - t2.y; - } + } /** * Sets the value of this tuple to the vector difference of * itself and tuple t1 (this = this - t1). * @param t1 the other tuple - */ + */ public final void sub(Tuple2f t1) { this.x -= t1.x; @@ -265,13 +265,13 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { * @param s the scalar value * @param t1 the tuple to be multipled * @param t2 the tuple to be added - */ + */ public final void scaleAdd(float s, Tuple2f t1, Tuple2f t2) { - this.x = s*t1.x + t2.x; - this.y = s*t1.y + t2.y; - } - + this.x = s*t1.x + t2.x; + this.y = s*t1.y + t2.y; + } + /** * Sets the value of this tuple to the scalar multiplication @@ -294,7 +294,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + (long)VecMathUtil.floatToIntBits(x); @@ -303,12 +303,12 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } - /** + /** * Returns true if all of the data members of Tuple2f t1 are * equal to the corresponding data members in this Tuple2f. * @param t1 the vector with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple2f t1) { try { @@ -318,13 +318,13 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } - /** + /** * Returns true if the Object t1 is of type Tuple2f and all of the * data members of t1 are equal to the corresponding data members in * this Tuple2f. * @param t1 the object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object t1) { try { @@ -338,11 +338,11 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this tuple - * and tuple t1 is less than or equal to the epsilon parameter, + * and tuple t1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to MAX[abs(x1-x2), abs(y1-y2)]. + * distance is equal to MAX[abs(x1-x2), abs(y1-y2)]. * @param t1 the tuple to be compared to this tuple - * @param epsilon the threshold value + * @param epsilon the threshold value * @return true or false */ public boolean epsilonEquals(Tuple2f t1, float epsilon) @@ -364,7 +364,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this Tuple2f. * The form is (x,y). * @return the String representation - */ + */ public String toString() { return("(" + this.x + ", " + this.y + ")"); @@ -372,15 +372,15 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** - * Clamps the tuple parameter to the range [low, high] and - * places the values into this tuple. + * Clamps the tuple parameter to the range [low, high] and + * places the values into this tuple. * @param min the lowest value in the tuple after clamping - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified */ public final void clamp(float min, float max, Tuple2f t) { - if( t.x > max ) { + if( t.x > max ) { x = max; } else if( t.x < min ){ x = min; @@ -388,7 +388,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { x = t.x; } - if( t.y > max ) { + if( t.y > max ) { y = max; } else if( t.y < min ){ y = min; @@ -399,62 +399,62 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } - /** - * Clamps the minimum value of the tuple parameter to the min + /** + * Clamps the minimum value of the tuple parameter to the min * parameter and places the values into this tuple. - * @param min the lowest value in the tuple after clamping + * @param min the lowest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMin(float min, Tuple2f t) - { - if( t.x < min ) { + */ + public final void clampMin(float min, Tuple2f t) + { + if( t.x < min ) { x = min; } else { x = t.x; } - if( t.y < min ) { + if( t.y < min ) { y = min; } else { y = t.y; } - } + } - /** - * Clamps the maximum value of the tuple parameter to the max + /** + * Clamps the maximum value of the tuple parameter to the max * parameter and places the values into this tuple. - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMax(float max, Tuple2f t) - { - if( t.x > max ) { + */ + public final void clampMax(float max, Tuple2f t) + { + if( t.x > max ) { x = max; - } else { + } else { x = t.x; } - + if( t.y > max ) { y = max; } else { y = t.y; } - } + } - /** - * Sets each component of the tuple parameter to its absolute + /** + * Sets each component of the tuple parameter to its absolute * value and places the modified values into this tuple. * @param t the source tuple, which will not be modified - */ + */ public final void absolute(Tuple2f t) { x = Math.abs(t.x); y = Math.abs(t.y); - } + } @@ -470,7 +470,7 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } else if( x < min ){ x = min; } - + if( y > max ) { y = max; } else if( y < min ){ @@ -479,24 +479,24 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } - + /** * Clamps the minimum value of this tuple to the min parameter. * @param min the lowest value in this tuple after clamping */ public final void clampMin(float min) - { + { if( x < min ) x=min; if( y < min ) y=min; - } - - + } + + /** * Clamps the maximum value of this tuple to the max parameter. * @param max the highest value in the tuple after clamping */ public final void clampMax(float max) - { + { if( x > max ) x=max; if( y > max ) y=max; } @@ -512,8 +512,8 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } - /** - * Linearly interpolates between tuples t1 and t2 and places the + /** + * Linearly interpolates between tuples t1 and t2 and places the * result into this tuple: this = (1-alpha)*t1 + alpha*t2. * @param t1 the first tuple * @param t2 the second tuple @@ -523,23 +523,23 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { { this.x = (1-alpha)*t1.x + alpha*t2.x; this.y = (1-alpha)*t1.y + alpha*t2.y; - + } - /** - * Linearly interpolates between this tuple and tuple t1 and + /** + * Linearly interpolates between this tuple and tuple t1 and * places the result into this tuple: this = (1-alpha)*this + alpha*t1. * @param t1 the first tuple - * @param alpha the alpha interpolation parameter - */ - public final void interpolate(Tuple2f t1, float alpha) - { + * @param alpha the alpha interpolation parameter + */ + public final void interpolate(Tuple2f t1, float alpha) + { this.x = (1-alpha)*this.x + alpha*t1.x; this.y = (1-alpha)*this.y + alpha*t1.y; - } + } /** * Creates a new object of the same class as this object. @@ -562,9 +562,9 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getX() { @@ -574,9 +574,9 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(float x) { @@ -586,9 +586,9 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getY() { @@ -598,9 +598,9 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(float y) { diff --git a/src/javax/vecmath/Tuple2i.java b/src/javax/vecmath/Tuple2i.java index 6ba5c64..7d67caf 100644 --- a/src/javax/vecmath/Tuple2i.java +++ b/src/javax/vecmath/Tuple2i.java @@ -459,9 +459,9 @@ public abstract class Tuple2i implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the x coordinate. - * + * * @since vecmath 1.5 */ public final int getX() { @@ -471,9 +471,9 @@ public abstract class Tuple2i implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(int x) { @@ -483,9 +483,9 @@ public abstract class Tuple2i implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final int getY() { @@ -495,9 +495,9 @@ public abstract class Tuple2i implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(int y) { diff --git a/src/javax/vecmath/Tuple3b.java b/src/javax/vecmath/Tuple3b.java index b31be00..037f1f9 100644 --- a/src/javax/vecmath/Tuple3b.java +++ b/src/javax/vecmath/Tuple3b.java @@ -121,29 +121,29 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { * @return a String with the values */ public String toString() - { + { return("(" + ((int)this.x & 0xff) + ", " + ((int)this.y & 0xff) + ", " + ((int)this.z & 0xff) + ")"); - } + } + - - /** + /** * Places the value of the x,y,z components of this Tuple3b * into the array of length 3. * @param t array of length 3 into which the component values are copied - */ + */ public final void get(byte[] t) - { - + { + t[0] = this.x; t[1] = this.y; t[2] = this.z; - } + } /** - * Places the value of the x,y,z components of this tuple into + * Places the value of the x,y,z components of this tuple into * the tuple t1. * @param t1 the tuple into which the values are placed */ @@ -156,37 +156,37 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** - * Sets the value of the data members of this tuple to the value + * Sets the value of the data members of this tuple to the value * of the argument tuple t1. * @param t1 the source tuple for the memberwise copy - */ + */ public final void set(Tuple3b t1) - { + { this.x = t1.x; this.y = t1.y; this.z = t1.z; - } + } + - /** - * Sets the value of the x,y,z, data members of this tuple to the + * Sets the value of the x,y,z, data members of this tuple to the * values in the array t of length 3. * @param t array of length 3 which is the source for the memberwise copy - */ + */ public final void set(byte[] t) - { + { this.x = t[0]; this.y = t[1]; this.z = t[2]; - } + } + - /** * Returns true if all of the data members of tuple t1 are equal to - * the corresponding data members in this tuple. + * the corresponding data members in this tuple. * @param t1 the tuple with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple3b t1) { try { @@ -201,7 +201,7 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { * data members of t1 are equal to the corresponding data members in * this Tuple3b. * @param t1 the object with which the comparison is made - */ + */ public boolean equals(Object t1) { try { @@ -220,13 +220,13 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { return ((((int)x & 0xff) << 0) | (((int)y & 0xff) << 8) | (((int)z & 0xff) << 16)); } - + /** * Creates a new object of the same class as this object. * @@ -248,9 +248,9 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** * Get <i>x</i>, the first value. - * + * * @return the first value. - * + * * @since vecmath 1.5 */ public final byte getX() { @@ -260,9 +260,9 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** * Set <i>x</i>, the first value. - * - * @param x the first value to set. - * + * + * @param x the first value to set. + * * @since vecmath 1.5 */ public final void setX(byte x) { @@ -272,9 +272,9 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** * Get <i>y</i>, the second value. - * - * @return the second value. - * + * + * @return the second value. + * * @since vecmath 1.5 */ public final byte getY() { @@ -284,9 +284,9 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** * Set <i>y</i>, the second value. - * + * * @param y the second value to set. - * + * * @since vecmath 1.5 */ public final void setY(byte y) { @@ -295,9 +295,9 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** * Get <i>z</i>, the third value. - * - * @return the third value. - * + * + * @return the third value. + * * @since vecmath 1.5 */ public final byte getZ() { @@ -307,9 +307,9 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { /** * Set <i>z</i>, the third value. - * + * * @param z the third value to set. - * + * * @since vecmath 1.5 */ public final void setZ(byte z) { diff --git a/src/javax/vecmath/Tuple3d.java b/src/javax/vecmath/Tuple3d.java index 72ba831..7fbe401 100644 --- a/src/javax/vecmath/Tuple3d.java +++ b/src/javax/vecmath/Tuple3d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A generic 3-element tuple that is represented by double-precision + * A generic 3-element tuple that is represented by double-precision * floating point x,y,z coordinates. * */ @@ -164,7 +164,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Copies the x,y,z coordinates of this tuple into the array t * of length 3. - * @param t the target array + * @param t the target array */ public final void get(double[] t) { @@ -199,12 +199,12 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this tuple to the sum of itself and t1. * @param t1 the other tuple - */ + */ public final void add(Tuple3d t1) - { + { this.x += t1.x; this.y += t1.y; this.z += t1.z; @@ -222,14 +222,14 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { this.y = t1.y - t2.y; this.z = t1.z - t2.z; } - - /** + + /** * Sets the value of this tuple to the difference * of itself and t1 (this = this - t1). * @param t1 the other tuple - */ + */ public final void sub(Tuple3d t1) - { + { this.x -= t1.x; this.y -= t1.y; this.z -= t1.z; @@ -303,7 +303,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * @deprecated Use scaleAdd(double,Tuple3d) instead - */ + */ public final void scaleAdd(double s, Tuple3f t1) { scaleAdd(s, new Point3d(t1)); } @@ -314,7 +314,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * of itself and then adds tuple t1 (this = s*this + t1). * @param s the scalar value * @param t1 the tuple to be added - */ + */ public final void scaleAdd(double s, Tuple3d t1) { this.x = s*this.x + t1.x; this.y = s*this.y + t1.y; @@ -327,7 +327,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this Tuple3d. * The form is (x,y,z). * @return the String representation - */ + */ public String toString() { return "(" + this.x + ", " + this.y + ", " + this.z + ")"; } @@ -340,7 +340,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + VecMathUtil.doubleToLongBits(x); @@ -355,7 +355,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this Tuple3d. * @param t1 the tuple with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple3d t1) { try { @@ -370,7 +370,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * this Tuple3d. * @param t1 the Object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object t1) { try { @@ -384,11 +384,11 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this tuple - * and tuple t1 is less than or equal to the epsilon parameter, + * and tuple t1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite * distance is equal to MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)]. * @param t1 the tuple to be compared to this tuple - * @param epsilon the threshold value + * @param epsilon the threshold value * @return true or false */ public boolean epsilonEquals(Tuple3d t1, double epsilon) @@ -421,10 +421,10 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** - * Clamps the tuple parameter to the range [low, high] and - * places the values into this tuple. + * Clamps the tuple parameter to the range [low, high] and + * places the values into this tuple. * @param min the lowest value in the tuple after clamping - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified */ public final void clamp(double min, double max, Tuple3d t) { @@ -435,7 +435,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } else { x = t.x; } - + if( t.y > max ) { y = max; } else if( t.y < min ){ @@ -443,7 +443,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } else { y = t.y; } - + if( t.z > max ) { z = max; } else if( t.z < min ){ @@ -455,90 +455,90 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } - /** + /** * @deprecated Use clampMin(double,Tuple3d) instead - */ + */ public final void clampMin(float min, Tuple3d t) { clampMin((double)min, t); } - /** - * Clamps the minimum value of the tuple parameter to the min + /** + * Clamps the minimum value of the tuple parameter to the min * parameter and places the values into this tuple. - * @param min the lowest value in the tuple after clamping + * @param min the lowest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMin(double min, Tuple3d t) { + */ + public final void clampMin(double min, Tuple3d t) { if( t.x < min ) { x = min; } else { x = t.x; } - + if( t.y < min ) { y = min; } else { y = t.y; } - + if( t.z < min ) { z = min; } else { z = t.z; } - } + } - /** + /** * @deprecated Use clampMax(double,Tuple3d) instead - */ + */ public final void clampMax(float max, Tuple3d t) { clampMax((double)max, t); } - /** - * Clamps the maximum value of the tuple parameter to the max + /** + * Clamps the maximum value of the tuple parameter to the max * parameter and places the values into this tuple. - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMax(double max, Tuple3d t) { + */ + public final void clampMax(double max, Tuple3d t) { if( t.x > max ) { x = max; } else { x = t.x; } - + if( t.y > max ) { y = max; } else { y = t.y; } - + if( t.z > max ) { z = max; } else { z = t.z; } - } + } - /** - * Sets each component of the tuple parameter to its absolute + /** + * Sets each component of the tuple parameter to its absolute * value and places the modified values into this tuple. * @param t the source tuple, which will not be modified - */ + */ public final void absolute(Tuple3d t) { x = Math.abs(t.x); y = Math.abs(t.y); z = Math.abs(t.z); - } + } /** @@ -560,13 +560,13 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } else if( x < min ){ x = min; } - + if( y > max ) { y = max; } else if( y < min ){ y = min; } - + if( z > max ) { z = max; } else if( z < min ){ @@ -575,10 +575,10 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } - - /** + + /** * @deprecated Use clampMin(double) instead - */ + */ public final void clampMin(float min) { clampMin((double)min); } @@ -588,17 +588,17 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * Clamps the minimum value of this tuple to the min parameter. * @param min the lowest value in this tuple after clamping */ - public final void clampMin(double min) { + public final void clampMin(double min) { if( x < min ) x=min; if( y < min ) y=min; if( z < min ) z=min; - } - - - /** + } + + + /** * @deprecated Use clampMax(double) instead - */ + */ public final void clampMax(float max) { clampMax((double)max); } @@ -608,7 +608,7 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { * Clamps the maximum value of this tuple to the max parameter. * @param max the highest value in the tuple after clamping */ - public final void clampMax(double max) { + public final void clampMax(double max) { if( x > max ) x=max; if( y > max ) y=max; if( z > max ) z=max; @@ -635,19 +635,19 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** - * Linearly interpolates between tuples t1 and t2 and places the + * Linearly interpolates between tuples t1 and t2 and places the * result into this tuple: this = (1-alpha)*t1 + alpha*t2. * @param t1 the first tuple - * @param t2 the second tuple - * @param alpha the alpha interpolation parameter - */ + * @param t2 the second tuple + * @param alpha the alpha interpolation parameter + */ public final void interpolate(Tuple3d t1, Tuple3d t2, double alpha) { this.x = (1-alpha)*t1.x + alpha*t2.x; this.y = (1-alpha)*t1.y + alpha*t2.y; this.z = (1-alpha)*t1.z + alpha*t2.z; } - - + + /** * @deprecated Use interpolate(Tuple3d,double) instead */ @@ -656,18 +656,18 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } - /** - * Linearly interpolates between this tuple and tuple t1 and - * places the result into this tuple: this = (1-alpha)*this + alpha*t1. - * @param t1 the first tuple - * @param alpha the alpha interpolation parameter - */ + /** + * Linearly interpolates between this tuple and tuple t1 and + * places the result into this tuple: this = (1-alpha)*this + alpha*t1. + * @param t1 the first tuple + * @param alpha the alpha interpolation parameter + */ public final void interpolate(Tuple3d t1, double alpha) { this.x = (1-alpha)*this.x + alpha*t1.x; this.y = (1-alpha)*this.y + alpha*t1.y; this.z = (1-alpha)*this.z + alpha*t1.z; - } - + } + /** * Creates a new object of the same class as this object. * @@ -688,9 +688,9 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getX() { @@ -700,9 +700,9 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(double x) { @@ -712,9 +712,9 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getY() { @@ -724,9 +724,9 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(double y) { @@ -735,9 +735,9 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Get the <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getZ() { @@ -747,9 +747,9 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { /** * Set the <i>z</i> coordinate. - * + * * @param z value to <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(double z) { diff --git a/src/javax/vecmath/Tuple3f.java b/src/javax/vecmath/Tuple3f.java index 9ca6940..3eb9fe3 100644 --- a/src/javax/vecmath/Tuple3f.java +++ b/src/javax/vecmath/Tuple3f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A generic 3-element tuple that is represented by single precision-floating + * A generic 3-element tuple that is represented by single precision-floating * point x,y,z coordinates. * */ @@ -123,7 +123,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this Tuple3f. * The form is (x,y,z). * @return the String representation - */ + */ public String toString() { return "(" + this.x + ", " + this.y + ", " + this.z + ")"; } @@ -180,9 +180,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } - /** + /** * Gets the value of this tuple and copies the values into t. - * @param t the array of length 3 into which the values are copied + * @param t the array of length 3 into which the values are copied */ public final void get(float[] t) { @@ -197,7 +197,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { * @param t the Tuple3f object into which the values of this object are copied */ public final void get(Tuple3f t) - { + { t.x = this.x; t.y = this.y; t.z = this.z; @@ -217,10 +217,10 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this tuple to the vector sum of itself and tuple t1. * @param t1 the other tuple - */ + */ public final void add(Tuple3f t1) { this.x += t1.x; @@ -243,13 +243,13 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this tuple to the vector difference of * itself and tuple t1 (this = this - t1) . * @param t1 the other tuple - */ + */ public final void sub(Tuple3f t1) - { + { this.x -= t1.x; this.y -= t1.y; this.z -= t1.z; @@ -342,7 +342,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { * this Tuple3f. * @param t1 the vector with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple3f t1) { try { @@ -356,7 +356,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { * this Tuple3f. * @param t1 the Object with which the comparison is made * @return true or false - */ + */ public boolean equals(Object t1) { try { @@ -370,11 +370,11 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this tuple - * and tuple t1 is less than or equal to the epsilon parameter, + * and tuple t1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite * distance is equal to MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)]. * @param t1 the tuple to be compared to this tuple - * @param epsilon the threshold value + * @param epsilon the threshold value * @return true or false */ public boolean epsilonEquals(Tuple3f t1, float epsilon) @@ -405,7 +405,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + (long)VecMathUtil.floatToIntBits(x); @@ -415,16 +415,16 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } - - /** - * Clamps the tuple parameter to the range [low, high] and - * places the values into this tuple. - * @param min the lowest value in the tuple after clamping - * @param max the highest value in the tuple after clamping + + /** + * Clamps the tuple parameter to the range [low, high] and + * places the values into this tuple. + * @param min the lowest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clamp(float min, float max, Tuple3f t) - { + */ + public final void clamp(float min, float max, Tuple3f t) + { if( t.x > max ) { x = max; } else if( t.x < min ){ @@ -432,7 +432,7 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } else { x = t.x; } - + if( t.y > max ) { y = max; } else if( t.y < min ){ @@ -449,72 +449,72 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { z = t.z; } - } - - - /** - * Clamps the minimum value of the tuple parameter to the min - * parameter and places the values into this tuple. - * @param min the lowest value in the tuple after clamping + } + + + /** + * Clamps the minimum value of the tuple parameter to the min + * parameter and places the values into this tuple. + * @param min the lowest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMin(float min, Tuple3f t) - { + */ + public final void clampMin(float min, Tuple3f t) + { if( t.x < min ) { x = min; } else { x = t.x; } - + if( t.y < min ) { y = min; } else { y = t.y; } - + if( t.z < min ) { z = min; } else { z = t.z; } - } - - - /** - * Clamps the maximum value of the tuple parameter to the max - * parameter and places the values into this tuple. - * @param max the highest value in the tuple after clamping + } + + + /** + * Clamps the maximum value of the tuple parameter to the max + * parameter and places the values into this tuple. + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMax(float max, Tuple3f t) - { + */ + public final void clampMax(float max, Tuple3f t) + { if( t.x > max ) { x = max; } else { x = t.x; } - + if( t.y > max ) { y = max; } else { y = t.y; } - + if( t.z > max ) { z = max; } else { z = t.z; } - } - - - /** + } + + + /** * Sets each component of the tuple parameter to its absolute * value and places the modified values into this tuple. * @param t the source tuple, which will not be modified - */ + */ public final void absolute(Tuple3f t) { x = Math.abs(t.x); @@ -536,13 +536,13 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } else if( x < min ){ x = min; } - + if( y > max ) { y = max; } else if( y < min ){ y = min; } - + if( z > max ) { z = max; } else if( z < min ){ @@ -551,26 +551,26 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } - + /** * Clamps the minimum value of this tuple to the min parameter. * @param min the lowest value in this tuple after clamping */ public final void clampMin(float min) - { + { if( x < min ) x=min; if( y < min ) y=min; if( z < min ) z=min; - } - - + } + + /** * Clamps the maximum value of this tuple to the max parameter. * @param max the highest value in the tuple after clamping */ public final void clampMax(float max) - { + { if( x > max ) x=max; if( y > max ) y=max; if( z > max ) z=max; @@ -590,38 +590,38 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } - /** - * Linearly interpolates between tuples t1 and t2 and places the + /** + * Linearly interpolates between tuples t1 and t2 and places the * result into this tuple: this = (1-alpha)*t1 + alpha*t2. * @param t1 the first tuple - * @param t2 the second tuple - * @param alpha the alpha interpolation parameter - */ - public final void interpolate(Tuple3f t1, Tuple3f t2, float alpha) - { + * @param t2 the second tuple + * @param alpha the alpha interpolation parameter + */ + public final void interpolate(Tuple3f t1, Tuple3f t2, float alpha) + { this.x = (1-alpha)*t1.x + alpha*t2.x; this.y = (1-alpha)*t1.y + alpha*t2.y; this.z = (1-alpha)*t1.z + alpha*t2.z; - - - } - - - /** - * Linearly interpolates between this tuple and tuple t1 and - * places the result into this tuple: this = (1-alpha)*this + alpha*t1. - * @param t1 the first tuple - * @param alpha the alpha interpolation parameter - */ - public final void interpolate(Tuple3f t1, float alpha) - { + + + } + + + /** + * Linearly interpolates between this tuple and tuple t1 and + * places the result into this tuple: this = (1-alpha)*this + alpha*t1. + * @param t1 the first tuple + * @param alpha the alpha interpolation parameter + */ + public final void interpolate(Tuple3f t1, float alpha) + { this.x = (1-alpha)*this.x + alpha*t1.x; this.y = (1-alpha)*this.y + alpha*t1.y; this.z = (1-alpha)*this.z + alpha*t1.z; - } - + } + /** * Creates a new object of the same class as this object. * @@ -643,9 +643,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getX() { @@ -655,9 +655,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(float x) { @@ -667,9 +667,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getY() { @@ -679,9 +679,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(float y) { @@ -690,9 +690,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Get the <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate - * + * * @since vecmath 1.5 */ public final float getZ() { @@ -702,9 +702,9 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { /** * Set the <i>Z</i> coordinate. - * + * * @param z value to <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(float z) { diff --git a/src/javax/vecmath/Tuple3i.java b/src/javax/vecmath/Tuple3i.java index bd4f0c3..3f421b4 100644 --- a/src/javax/vecmath/Tuple3i.java +++ b/src/javax/vecmath/Tuple3i.java @@ -521,9 +521,9 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final int getX() { @@ -533,9 +533,9 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(int x) { @@ -545,9 +545,9 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final int getY() { @@ -557,9 +557,9 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(int y) { @@ -568,7 +568,7 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { /** * Get the <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. * @since vecmath 1.5 */ @@ -579,9 +579,9 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { /** * Set the <i>z</i> coordinate. - * + * * @param z value to <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(int z) { diff --git a/src/javax/vecmath/Tuple4b.java b/src/javax/vecmath/Tuple4b.java index ea48b7f..26e1cc9 100644 --- a/src/javax/vecmath/Tuple4b.java +++ b/src/javax/vecmath/Tuple4b.java @@ -129,7 +129,7 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Returns a string that contains the values of this Tuple4b. * @return the String representation - */ + */ public String toString() { return("(" + ((int)this.x & 0xff) + @@ -153,7 +153,7 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { } - /** + /** * Places the value of the x,y,z,w components of this * Tuple4b into the tuple t1. * @param t1 tuple into which the values are placed @@ -194,7 +194,7 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { this.w = b[3]; } - + /** * Returns true if all of the data members of tuple t1 are equal to * the corresponding data members in this tuple. @@ -203,7 +203,7 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { public boolean equals(Tuple4b t1) { try { - return(this.x == t1.x && this.y == t1.y && + return(this.x == t1.x && this.y == t1.y && this.z == t1.z && this.w == t1.w); } catch (NullPointerException e2) {return false;} @@ -220,7 +220,7 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { { try { Tuple4b t2 = (Tuple4b) t1; - return(this.x == t2.x && this.y == t2.y && + return(this.x == t2.x && this.y == t2.y && this.z == t2.z && this.w == t2.w); } catch (NullPointerException e2) {return false;} @@ -236,7 +236,7 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { return ((((int)x & 0xff) << 0) | (((int)y & 0xff) << 8) | @@ -265,9 +265,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Get <i>x</i>, the first value. - * + * * @return Returns <i>x</i>, the first value. - * + * * @since vecmath 1.5 */ public final byte getX() { @@ -277,9 +277,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Set <i>x</i>, the first value. - * + * * @param x the first value. - * + * * @since vecmath 1.5 */ public final void setX(byte x) { @@ -289,9 +289,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Get <i>y</i>, the second value. - * + * * @return Returns <i>y</i>, the second value. - * + * * @since vecmath 1.5 */ public final byte getY() { @@ -301,9 +301,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Set <i>y</i>, the second value. - * + * * @param y the second value. - * + * * @since vecmath 1.5 */ public final void setY(byte y) { @@ -312,9 +312,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Get <i>z</i>, the third value. - * - * @return Returns <i>z</i>, the third value. - * + * + * @return Returns <i>z</i>, the third value. + * * @since vecmath 1.5 */ public final byte getZ() { @@ -324,9 +324,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Set <i>z</i>, the third value. - * + * * @param z the third value. - * + * * @since vecmath 1.5 */ public final void setZ(byte z) { @@ -336,9 +336,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Get <i>w</i>, the fourth value. - * + * * @return Returns <i>w</i> - the fourth value. - * + * * @since vecmath 1.5 */ public final byte getW() { @@ -348,9 +348,9 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { /** * Set <i>w</i>, the fourth value. - * + * * @param w the fourth value. - * + * * @since vecmath 1.5 */ public final void setW(byte w) { diff --git a/src/javax/vecmath/Tuple4d.java b/src/javax/vecmath/Tuple4d.java index 45fa0e8..7020f2d 100644 --- a/src/javax/vecmath/Tuple4d.java +++ b/src/javax/vecmath/Tuple4d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4 element tuple represented by double precision floating point + * A 4 element tuple represented by double precision floating point * x,y,z,w coordinates. * */ @@ -229,7 +229,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this tuple to the sum of itself and tuple t1. * @param t1 the other tuple */ @@ -257,13 +257,13 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } - /** + /** * Sets the value of this tuple to the difference of itself * and tuple t1 (this = this - t1). * @param t1 the other tuple */ public final void sub(Tuple4d t1) - { + { this.x -= t1.x; this.y -= t1.y; this.z -= t1.z; @@ -341,35 +341,35 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } - + /** * @deprecated Use scaleAdd(double,Tuple4d) instead - */ + */ public final void scaleAdd(float s, Tuple4d t1) { scaleAdd((double)s, t1); } - /** + /** * Sets the value of this tuple to the scalar multiplication * of itself and then adds tuple t1 (this = s*this + t1). - * @param s the scalar value - * @param t1 the tuple to be added - */ + * @param s the scalar value + * @param t1 the tuple to be added + */ public final void scaleAdd(double s, Tuple4d t1) { - this.x = s*this.x + t1.x; - this.y = s*this.y + t1.y; - this.z = s*this.z + t1.z; + this.x = s*this.x + t1.x; + this.y = s*this.y + t1.y; + this.z = s*this.z + t1.z; this.w = s*this.w + t1.w; - } - + } + /** * Returns a string that contains the values of this Tuple4d. * The form is (x,y,z,w). * @return the String representation - */ + */ public String toString() { return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + ")"; } @@ -380,7 +380,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this Tuple4d. * @param t1 the tuple with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple4d t1) { try { @@ -402,7 +402,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { try { Tuple4d t2 = (Tuple4d) t1; - return(this.x == t2.x && this.y == t2.y && + return(this.x == t2.x && this.y == t2.y && this.z == t2.z && this.w == t2.w); } catch (NullPointerException e2) {return false;} @@ -412,12 +412,12 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this tuple - * and tuple t1 is less than or equal to the epsilon parameter, + * and tuple t1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(w1-w2)]. * @param t1 the tuple to be compared to this tuple - * @param epsilon the threshold value + * @param epsilon the threshold value * @return true or false */ public boolean epsilonEquals(Tuple4d t1, double epsilon) @@ -452,7 +452,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + VecMathUtil.doubleToLongBits(x); @@ -472,10 +472,10 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** - * Clamps the tuple parameter to the range [low, high] and - * places the values into this tuple. + * Clamps the tuple parameter to the range [low, high] and + * places the values into this tuple. * @param min the lowest value in the tuple after clamping - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified */ public final void clamp(double min, double max, Tuple4d t) { @@ -483,10 +483,10 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { x = max; } else if( t.x < min ){ x = min; - } else { + } else { x = t.x; } - + if( t.y > max ) { y = max; } else if( t.y < min ){ @@ -494,7 +494,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } else { y = t.y; } - + if( t.z > max ) { z = max; } else if( t.z < min ){ @@ -522,38 +522,38 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } - /** - * Clamps the minimum value of the tuple parameter to the min + /** + * Clamps the minimum value of the tuple parameter to the min * parameter and places the values into this tuple. - * @param min the lowest value in the tuple after clamping + * @param min the lowest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMin(double min, Tuple4d t) { + */ + public final void clampMin(double min, Tuple4d t) { if( t.x < min ) { x = min; } else { x = t.x; } - + if( t.y < min ) { y = min; } else { y = t.y; } - + if( t.z < min ) { z = min; } else { z = t.z; } - + if( t.w < min ) { w = min; } else { w = t.w; } - } + } /** @@ -564,45 +564,45 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } - /** - * Clamps the maximum value of the tuple parameter to the max + /** + * Clamps the maximum value of the tuple parameter to the max * parameter and places the values into this tuple. - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMax(double max, Tuple4d t) { + */ + public final void clampMax(double max, Tuple4d t) { if( t.x > max ) { x = max; } else { x = t.x; } - + if( t.y > max ) { y = max; } else { y = t.y; } - + if( t.z > max ) { z = max; } else { z = t.z; } - + if( t.w > max ) { w = max; } else { w = t.z; } - } + } - /** - * Sets each component of the tuple parameter to its absolute + /** + * Sets each component of the tuple parameter to its absolute * value and places the modified values into this tuple. * @param t the source tuple, which will not be modified - */ + */ public final void absolute(Tuple4d t) { x = Math.abs(t.x); @@ -610,7 +610,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { z = Math.abs(t.z); w = Math.abs(t.w); - } + } @@ -633,19 +633,19 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } else if( x < min ){ x = min; } - + if( y > max ) { y = max; } else if( y < min ){ y = min; } - + if( z > max ) { z = max; } else if( z < min ){ z = min; } - + if( w > max ) { w = max; } else if( w < min ){ @@ -654,7 +654,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } - + /** * @deprecated Use clampMin(double) instead */ @@ -667,14 +667,14 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { * Clamps the minimum value of this tuple to the min parameter. * @param min the lowest value in this tuple after clamping */ - public final void clampMin(double min) { + public final void clampMin(double min) { if( x < min ) x=min; if( y < min ) y=min; if( z < min ) z=min; if( w < min ) w=min; - } - - + } + + /** * @deprecated Use clampMax(double) instead */ @@ -687,7 +687,7 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { * Clamps the maximum value of this tuple to the max parameter. * @param max the highest value in the tuple after clamping */ - public final void clampMax(double max) { + public final void clampMax(double max) { if( x > max ) x=max; if( y > max ) y=max; if( z > max ) z=max; @@ -718,20 +718,20 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** - * Linearly interpolates between tuples t1 and t2 and places the + * Linearly interpolates between tuples t1 and t2 and places the * result into this tuple: this = (1-alpha)*t1 + alpha*t2. * @param t1 the first tuple - * @param t2 the second tuple - * @param alpha the alpha interpolation parameter - */ + * @param t2 the second tuple + * @param alpha the alpha interpolation parameter + */ public void interpolate(Tuple4d t1, Tuple4d t2, double alpha) { this.x = (1-alpha)*t1.x + alpha*t2.x; this.y = (1-alpha)*t1.y + alpha*t2.y; this.z = (1-alpha)*t1.z + alpha*t2.z; this.w = (1-alpha)*t1.w + alpha*t2.w; - } - - + } + + /** * @deprecated Use interpolate(Tuple4d,double) instead */ @@ -741,11 +741,11 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** - * Linearly interpolates between this tuple and tuple t1 and - * places the result into this tuple: this = (1-alpha)*this + alpha*t1. - * @param t1 the first tuple - * @param alpha the alpha interpolation parameter - */ + * Linearly interpolates between this tuple and tuple t1 and + * places the result into this tuple: this = (1-alpha)*this + alpha*t1. + * @param t1 the first tuple + * @param alpha the alpha interpolation parameter + */ public void interpolate(Tuple4d t1, double alpha) { this.x = (1-alpha)*this.x + alpha*t1.x; this.y = (1-alpha)*this.y + alpha*t1.y; @@ -773,9 +773,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the x coordinate. - * + * * @since vecmath 1.5 */ public final double getX() { @@ -785,9 +785,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(double x) { @@ -797,9 +797,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getY() { @@ -809,9 +809,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(double y) { @@ -820,9 +820,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Get the <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getZ() { @@ -832,9 +832,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Set the <i>z</i> coordinate. - * + * * @param z value to <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(double z) { @@ -844,9 +844,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Get the <i>w</i> coordinate. - * + * * @return the <i>w</i> coordinate. - * + * * @since vecmath 1.5 */ public final double getW() { @@ -856,9 +856,9 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { /** * Set the <i>w</i> coordinate. - * + * * @param w value to <i>w</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setW(double w) { diff --git a/src/javax/vecmath/Tuple4f.java b/src/javax/vecmath/Tuple4f.java index fbd42be..508e7d4 100644 --- a/src/javax/vecmath/Tuple4f.java +++ b/src/javax/vecmath/Tuple4f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4-element tuple represented by single-precision floating point x,y,z,w + * A 4-element tuple represented by single-precision floating point x,y,z,w * coordinates. * */ @@ -80,7 +80,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** - * Constructs and initializes a Tuple4f from the array of length 4. + * Constructs and initializes a Tuple4f from the array of length 4. * @param t the array of length 4 containing xyzw in order */ public Tuple4f(float[] t) @@ -188,7 +188,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Copies the values of this tuple into the array t. - * @param t the array + * @param t the array */ public final void get(float[] t) { @@ -196,13 +196,13 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { t[1] = this.y; t[2] = this.z; t[3] = this.w; - } + } + - - /** + /** * Copies the values of this tuple into the tuple t. * @param t the target tuple - */ + */ public final void get(Tuple4f t) { t.x = this.x; @@ -231,7 +231,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { * @param t1 the other tuple */ public final void add(Tuple4f t1) - { + { this.x += t1.x; this.y += t1.y; this.z += t1.z; @@ -257,10 +257,10 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Sets the value of this tuple to the difference * of itself and t1 (this = this - t1). - * @param t1 the other tuple + * @param t1 the other tuple */ public final void sub(Tuple4f t1) - { + { this.x -= t1.x; this.y -= t1.y; this.z -= t1.z; @@ -343,7 +343,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { * of itself and then adds tuple t1 (this = s*this + t1). * @param s the scalar value * @param t1 the tuple to be added - */ + */ public final void scaleAdd(float s, Tuple4f t1) { this.x = s*this.x + t1.x; @@ -358,7 +358,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { * Returns a string that contains the values of this Tuple4f. * The form is (x,y,z,w). * @return the String representation - */ + */ public String toString() { return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + ")"; } @@ -368,7 +368,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this Tuple4f. * @param t1 the vector with which the comparison is made * @return true or false - */ + */ public boolean equals(Tuple4f t1) { try { @@ -389,7 +389,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { { try { Tuple4f t2 = (Tuple4f) t1; - return(this.x == t2.x && this.y == t2.y && + return(this.x == t2.x && this.y == t2.y && this.z == t2.z && this.w == t2.w); } catch (NullPointerException e2) {return false;} @@ -399,12 +399,12 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Returns true if the L-infinite distance between this tuple - * and tuple t1 is less than or equal to the epsilon parameter, + * and tuple t1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(w1-w2)]. * @param t1 the tuple to be compared to this tuple - * @param epsilon the threshold value + * @param epsilon the threshold value * @return true or false */ public boolean epsilonEquals(Tuple4f t1, float epsilon) @@ -438,7 +438,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + (long)VecMathUtil.floatToIntBits(x); @@ -450,10 +450,10 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** - * Clamps the tuple parameter to the range [low, high] and - * places the values into this tuple. + * Clamps the tuple parameter to the range [low, high] and + * places the values into this tuple. * @param min the lowest value in the tuple after clamping - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified */ public final void clamp(float min, float max, Tuple4f t) @@ -462,10 +462,10 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { x = max; } else if( t.x < min ){ x = min; - } else { + } else { x = t.x; } - + if( t.y > max ) { y = max; } else if( t.y < min ){ @@ -473,7 +473,7 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { } else { y = t.y; } - + if( t.z > max ) { z = max; } else if( t.z < min ){ @@ -493,89 +493,89 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { } - /** - * Clamps the minimum value of the tuple parameter to the min + /** + * Clamps the minimum value of the tuple parameter to the min * parameter and places the values into this tuple. - * @param min the lowest value in the tuple after clamping + * @param min the lowest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMin(float min, Tuple4f t) - { + */ + public final void clampMin(float min, Tuple4f t) + { if( t.x < min ) { x = min; } else { x = t.x; } - + if( t.y < min ) { y = min; } else { y = t.y; } - + if( t.z < min ) { z = min; } else { z = t.z; } - + if( t.w < min ) { w = min; } else { w = t.w; } - - } + + } - /** - * Clamps the maximum value of the tuple parameter to the max + /** + * Clamps the maximum value of the tuple parameter to the max * parameter and places the values into this tuple. - * @param max the highest value in the tuple after clamping + * @param max the highest value in the tuple after clamping * @param t the source tuple, which will not be modified - */ - public final void clampMax(float max, Tuple4f t) - { + */ + public final void clampMax(float max, Tuple4f t) + { if( t.x > max ) { x = max; } else { x = t.x; } - + if( t.y > max ) { y = max; } else { y = t.y; } - + if( t.z > max ) { z = max; } else { z = t.z; } - + if( t.w > max ) { w = max; } else { w = t.z; } - } + } - /** - * Sets each component of the tuple parameter to its absolute + /** + * Sets each component of the tuple parameter to its absolute * value and places the modified values into this tuple. * @param t the source tuple, which will not be modified - */ + */ public final void absolute(Tuple4f t) { x = Math.abs(t.x); y = Math.abs(t.y); z = Math.abs(t.z); w = Math.abs(t.w); - } + } /** @@ -590,19 +590,19 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { } else if( x < min ){ x = min; } - + if( y > max ) { y = max; } else if( y < min ){ y = min; } - + if( z > max ) { z = max; } else if( z < min ){ z = min; } - + if( w > max ) { w = max; } else if( w < min ){ @@ -611,27 +611,27 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { } - + /** * Clamps the minimum value of this tuple to the min parameter. * @param min the lowest value in this tuple after clamping */ public final void clampMin(float min) - { + { if( x < min ) x=min; if( y < min ) y=min; if( z < min ) z=min; if( w < min ) w=min; - } - - + } + + /** * Clamps the maximum value of this tuple to the max parameter. * @param max the highest value in the tuple after clamping */ public final void clampMax(float max) - { + { if( x > max ) x=max; if( y > max ) y=max; if( z > max ) z=max; @@ -652,38 +652,38 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { } - /** - * Linearly interpolates between tuples t1 and t2 and places the + /** + * Linearly interpolates between tuples t1 and t2 and places the * result into this tuple: this = (1-alpha)*t1 + alpha*t2. * @param t1 the first tuple - * @param t2 the second tuple - * @param alpha the alpha interpolation parameter - */ - public void interpolate(Tuple4f t1, Tuple4f t2, float alpha) - { + * @param t2 the second tuple + * @param alpha the alpha interpolation parameter + */ + public void interpolate(Tuple4f t1, Tuple4f t2, float alpha) + { this.x = (1-alpha)*t1.x + alpha*t2.x; this.y = (1-alpha)*t1.y + alpha*t2.y; this.z = (1-alpha)*t1.z + alpha*t2.z; this.w = (1-alpha)*t1.w + alpha*t2.w; - } - - - /** - * Linearly interpolates between this tuple and tuple t1 and - * places the result into this tuple: this = (1-alpha)*this + alpha*t1. - * @param t1 the first tuple - * @param alpha the alpha interpolation parameter - */ - public void interpolate(Tuple4f t1, float alpha) - { + } + + + /** + * Linearly interpolates between this tuple and tuple t1 and + * places the result into this tuple: this = (1-alpha)*this + alpha*t1. + * @param t1 the first tuple + * @param alpha the alpha interpolation parameter + */ + public void interpolate(Tuple4f t1, float alpha) + { this.x = (1-alpha)*this.x + alpha*t1.x; this.y = (1-alpha)*this.y + alpha*t1.y; this.z = (1-alpha)*this.z + alpha*t1.z; this.w = (1-alpha)*this.w + alpha*t1.w; - } - + } + /** * Creates a new object of the same class as this object. * @@ -704,9 +704,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getX() { @@ -716,9 +716,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(float x) { @@ -728,9 +728,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getY() { @@ -740,9 +740,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(float y) { @@ -751,9 +751,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Get the <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getZ() { @@ -763,9 +763,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Set the <i>z</i> coordinate. - * + * * @param z value to <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(float z) { @@ -775,9 +775,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Get the <i>w</i> coordinate. - * + * * @return the <i>w</i> coordinate. - * + * * @since vecmath 1.5 */ public final float getW() { @@ -787,9 +787,9 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { /** * Set the <i>w</i> coordinate. - * + * * @param w value to <i>w</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setW(float w) { diff --git a/src/javax/vecmath/Tuple4i.java b/src/javax/vecmath/Tuple4i.java index 0239ada..c60192c 100644 --- a/src/javax/vecmath/Tuple4i.java +++ b/src/javax/vecmath/Tuple4i.java @@ -587,9 +587,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Get the <i>x</i> coordinate. - * + * * @return the <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final int getX() { @@ -599,9 +599,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Set the <i>x</i> coordinate. - * + * * @param x value to <i>x</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setX(int x) { @@ -611,9 +611,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Get the <i>y</i> coordinate. - * + * * @return the <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final int getY() { @@ -623,9 +623,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Set the <i>y</i> coordinate. - * + * * @param y value to <i>y</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setY(int y) { @@ -634,9 +634,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Get the <i>z</i> coordinate. - * + * * @return the <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final int getZ() { @@ -646,9 +646,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Set the <i>z</i> coordinate. - * + * * @param z value to <i>z</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setZ(int z) { @@ -668,9 +668,9 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { /** * Set the <i>w</i> coordinate. - * + * * @param w value to <i>w</i> coordinate. - * + * * @since vecmath 1.5 */ public final void setW(int w) { diff --git a/src/javax/vecmath/Vector2d.java b/src/javax/vecmath/Vector2d.java index 02a3f77..d0f52ba 100644 --- a/src/javax/vecmath/Vector2d.java +++ b/src/javax/vecmath/Vector2d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 2-element vector that is represented by double-precision floating + * A 2-element vector that is represented by double-precision floating * point x,y coordinates. * */ @@ -87,7 +87,7 @@ public class Vector2d extends Tuple2d implements java.io.Serializable { /** * Constructs and initializes a Vector2d from the specified Tuple2d. * @param t1 the Tuple2d containing the initialization x y data - */ + */ public Vector2d(Tuple2d t1) { super(t1); @@ -97,7 +97,7 @@ public class Vector2d extends Tuple2d implements java.io.Serializable { /** * Constructs and initializes a Vector2d from the specified Tuple2f. * @param t1 the Tuple2f containing the initialization x y data - */ + */ public Vector2d(Tuple2f t1) { super(t1); @@ -123,19 +123,19 @@ public class Vector2d extends Tuple2d implements java.io.Serializable { } - /** + /** * Returns the length of this vector. * @return the length of this vector - */ + */ public final double length() { return (double) Math.sqrt(this.x*this.x + this.y*this.y); } - /** + /** * Returns the squared length of this vector. * @return the squared length of this vector - */ + */ public final double lengthSquared() { return (this.x*this.x + this.y*this.y); @@ -144,7 +144,7 @@ public class Vector2d extends Tuple2d implements java.io.Serializable { /** * Sets the value of this vector to the normalization of vector v1. * @param v1 the un-normalized vector - */ + */ public final void normalize(Vector2d v1) { double norm; @@ -156,7 +156,7 @@ public class Vector2d extends Tuple2d implements java.io.Serializable { /** * Normalizes this vector in place. - */ + */ public final void normalize() { double norm; diff --git a/src/javax/vecmath/Vector2f.java b/src/javax/vecmath/Vector2f.java index 28b8db7..d9e5a65 100644 --- a/src/javax/vecmath/Vector2f.java +++ b/src/javax/vecmath/Vector2f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 2-element vector that is represented by single-precision floating + * A 2-element vector that is represented by single-precision floating * point x,y coordinates. * */ @@ -87,7 +87,7 @@ public class Vector2f extends Tuple2f implements java.io.Serializable { /** * Constructs and initializes a Vector2f from the specified Tuple2f. * @param t1 the Tuple2f containing the initialization x y data - */ + */ public Vector2f(Tuple2f t1) { super(t1); @@ -97,7 +97,7 @@ public class Vector2f extends Tuple2f implements java.io.Serializable { /** * Constructs and initializes a Vector2f from the specified Tuple2d. * @param t1 the Tuple2d containing the initialization x y data - */ + */ public Vector2f(Tuple2d t1) { super(t1); @@ -124,19 +124,19 @@ public class Vector2f extends Tuple2f implements java.io.Serializable { } - /** + /** * Returns the length of this vector. * @return the length of this vector - */ + */ public final float length() { return (float) Math.sqrt(this.x*this.x + this.y*this.y); } - /** + /** * Returns the squared length of this vector. * @return the squared length of this vector - */ + */ public final float lengthSquared() { return (this.x*this.x + this.y*this.y); @@ -145,7 +145,7 @@ public class Vector2f extends Tuple2f implements java.io.Serializable { /** * Sets the value of this vector to the normalization of vector v1. * @param v1 the un-normalized vector - */ + */ public final void normalize(Vector2f v1) { float norm; @@ -157,7 +157,7 @@ public class Vector2f extends Tuple2f implements java.io.Serializable { /** * Normalizes this vector in place. - */ + */ public final void normalize() { float norm; diff --git a/src/javax/vecmath/Vector3d.java b/src/javax/vecmath/Vector3d.java index 9f1aa51..cda329d 100644 --- a/src/javax/vecmath/Vector3d.java +++ b/src/javax/vecmath/Vector3d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 3-element vector that is represented by double-precision floating point + * A 3-element vector that is represented by double-precision floating point * x,y,z coordinates. If this value represents a normal, then it should * be normalized. * @@ -89,8 +89,8 @@ public class Vector3d extends Tuple3d implements java.io.Serializable { /** * Constructs and initializes a Vector3d from the specified Tuple3f. * @param t1 the Tuple3f containing the initialization x y z data - */ - public Vector3d(Tuple3f t1) + */ + public Vector3d(Tuple3f t1) { super(t1); } @@ -98,11 +98,11 @@ public class Vector3d extends Tuple3d implements java.io.Serializable { /** * Constructs and initializes a Vector3d from the specified Tuple3d. - * @param t1 the Tuple3d containing the initialization x y z data - */ - public Vector3d(Tuple3d t1) + * @param t1 the Tuple3d containing the initialization x y z data + */ + public Vector3d(Tuple3d t1) { - super(t1); + super(t1); } @@ -121,7 +121,7 @@ public class Vector3d extends Tuple3d implements java.io.Serializable { * @param v2 the second vector */ public final void cross(Vector3d v1, Vector3d v2) - { + { double x,y; x = v1.y*v2.z - v1.z*v2.y; @@ -192,19 +192,19 @@ public class Vector3d extends Tuple3d implements java.io.Serializable { } - /** + /** * Returns the angle in radians between this vector and the vector - * parameter; the return value is constrained to the range [0,PI]. - * @param v1 the other vector - * @return the angle in radians in the range [0,PI] - */ - public final double angle(Vector3d v1) - { + * parameter; the return value is constrained to the range [0,PI]. + * @param v1 the other vector + * @return the angle in radians in the range [0,PI] + */ + public final double angle(Vector3d v1) + { double vDot = this.dot(v1) / ( this.length()*v1.length() ); if( vDot < -1.0) vDot = -1.0; if( vDot > 1.0) vDot = 1.0; return((double) (Math.acos( vDot ))); - } - + } + } diff --git a/src/javax/vecmath/Vector3f.java b/src/javax/vecmath/Vector3f.java index 15ebf8d..71b801e 100644 --- a/src/javax/vecmath/Vector3f.java +++ b/src/javax/vecmath/Vector3f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 3-element vector that is represented by single-precision floating point + * A 3-element vector that is represented by single-precision floating point * x,y,z coordinates. If this value represents a normal, then it should * be normalized. * @@ -89,7 +89,7 @@ public class Vector3f extends Tuple3f implements java.io.Serializable { /** * Constructs and initializes a Vector3f from the specified Tuple3f. * @param t1 the Tuple3f containing the initialization x y z data - */ + */ public Vector3f(Tuple3f t1) { super(t1); } @@ -98,7 +98,7 @@ public class Vector3f extends Tuple3f implements java.io.Serializable { /** * Constructs and initializes a Vector3f from the specified Tuple3d. * @param t1 the Tuple3d containing the initialization x y z data - */ + */ public Vector3f(Tuple3d t1) { super(t1); } @@ -188,18 +188,18 @@ public class Vector3f extends Tuple3f implements java.io.Serializable { } - /** + /** * Returns the angle in radians between this vector and the vector - * parameter; the return value is constrained to the range [0,PI]. - * @param v1 the other vector - * @return the angle in radians in the range [0,PI] - */ - public final float angle(Vector3f v1) - { + * parameter; the return value is constrained to the range [0,PI]. + * @param v1 the other vector + * @return the angle in radians in the range [0,PI] + */ + public final float angle(Vector3f v1) + { double vDot = this.dot(v1) / ( this.length()*v1.length() ); if( vDot < -1.0) vDot = -1.0; if( vDot > 1.0) vDot = 1.0; return((float) (Math.acos( vDot ))); - } + } } diff --git a/src/javax/vecmath/Vector4d.java b/src/javax/vecmath/Vector4d.java index f486e1e..e42f0ee 100644 --- a/src/javax/vecmath/Vector4d.java +++ b/src/javax/vecmath/Vector4d.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4-element vector represented by double-precision floating point + * A 4-element vector represented by double-precision floating point * x,y,z,w coordinates. * */ @@ -86,19 +86,19 @@ public class Vector4d extends Tuple4d implements java.io.Serializable { /** * Constructs and initializes a Vector4d from the specified Tuple4f. * @param t1 the Tuple4f containing the initialization x y z w data - */ - public Vector4d(Tuple4f t1) + */ + public Vector4d(Tuple4f t1) { super(t1); } /** * Constructs and initializes a Vector4d from the specified Tuple4d. - * @param t1 the Tuple4d containing the initialization x y z w data - */ - public Vector4d(Tuple4d t1) + * @param t1 the Tuple4d containing the initialization x y z w data + */ + public Vector4d(Tuple4d t1) { - super(t1); + super(t1); } @@ -124,7 +124,7 @@ public class Vector4d extends Tuple4d implements java.io.Serializable { super(); } - + /** * Sets the x,y,z components of this vector to the corresponding * components of tuple t1. The w component of this vector @@ -206,19 +206,19 @@ public class Vector4d extends Tuple4d implements java.io.Serializable { } - /** - * Returns the (4-space) angle in radians between this vector and - * the vector parameter; the return value is constrained to the - * range [0,PI]. - * @param v1 the other vector - * @return the angle in radians in the range [0,PI] - */ - public final double angle(Vector4d v1) - { + /** + * Returns the (4-space) angle in radians between this vector and + * the vector parameter; the return value is constrained to the + * range [0,PI]. + * @param v1 the other vector + * @return the angle in radians in the range [0,PI] + */ + public final double angle(Vector4d v1) + { double vDot = this.dot(v1) / ( this.length()*v1.length() ); if( vDot < -1.0) vDot = -1.0; if( vDot > 1.0) vDot = 1.0; return((double) (Math.acos( vDot ))); - } + } } diff --git a/src/javax/vecmath/Vector4f.java b/src/javax/vecmath/Vector4f.java index 2e5388e..eaa5d04 100644 --- a/src/javax/vecmath/Vector4f.java +++ b/src/javax/vecmath/Vector4f.java @@ -34,7 +34,7 @@ package javax.vecmath; import java.lang.Math; /** - * A 4-element vector represented by single-precision floating point x,y,z,w + * A 4-element vector represented by single-precision floating point x,y,z,w * coordinates. * */ @@ -57,7 +57,7 @@ public class Vector4f extends Tuple4f implements java.io.Serializable { /** - * Constructs and initializes a Vector4f from the array of length 4. + * Constructs and initializes a Vector4f from the array of length 4. * @param v the array of length 4 containing xyzw in order */ public Vector4f(float[] v) @@ -89,8 +89,8 @@ public class Vector4f extends Tuple4f implements java.io.Serializable { /** * Constructs and initializes a Vector4f from the specified Tuple4f. * @param t1 the Tuple4f containing the initialization x y z w data - */ - public Vector4f(Tuple4f t1) + */ + public Vector4f(Tuple4f t1) { super(t1); } @@ -98,11 +98,11 @@ public class Vector4f extends Tuple4f implements java.io.Serializable { /** * Constructs and initializes a Vector4f from the specified Tuple4d. - * @param t1 the Tuple4d containing the initialization x y z w data - */ - public Vector4f(Tuple4d t1) + * @param t1 the Tuple4d containing the initialization x y z w data + */ + public Vector4f(Tuple4d t1) { - super(t1); + super(t1); } @@ -210,19 +210,19 @@ public class Vector4f extends Tuple4f implements java.io.Serializable { } - /** - * Returns the (4-space) angle in radians between this vector and - * the vector parameter; the return value is constrained to the - * range [0,PI]. - * @param v1 the other vector - * @return the angle in radians in the range [0,PI] - */ - public final float angle(Vector4f v1) - { + /** + * Returns the (4-space) angle in radians between this vector and + * the vector parameter; the return value is constrained to the + * range [0,PI]. + * @param v1 the other vector + * @return the angle in radians in the range [0,PI] + */ + public final float angle(Vector4f v1) + { double vDot = this.dot(v1) / ( this.length()*v1.length() ); if( vDot < -1.0) vDot = -1.0; if( vDot > 1.0) vDot = 1.0; return((float) (Math.acos( vDot ))); - } + } } |