diff options
Diffstat (limited to 'src/javax/vecmath/Matrix4f.java')
-rw-r--r-- | src/javax/vecmath/Matrix4f.java | 782 |
1 files changed, 391 insertions, 391 deletions
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) { |