Matrix4 { public Matrix4 transposeMatrix(Matrix4 matrix) { if (matrix == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "Matrix4", "transposeMatrix", "missingMatrix")); } this.m[0] = matrix.m[0]; this.m[1] = matrix.m[4]; this.m[2] = matrix.m[8]; this.m[3] = matrix.m[12]; this.m[4] = matrix.m[1]; this.m[5] = matrix.m[5]; this.m[6] = matrix.m[9]; this.m[7] = matrix.m[13]; this.m[8] = matrix.m[2]; this.m[9] = matrix.m[6]; this.m[10] = matrix.m[10]; this.m[11] = matrix.m[14]; this.m[12] = matrix.m[3]; this.m[13] = matrix.m[7]; this.m[14] = matrix.m[11]; this.m[15] = matrix.m[15]; return this; } Matrix4();  Matrix4(double m11, double m12, double m13, double m14,
                   double m21, double m22, double m23, double m24,
                   double m31, double m32, double m33, double m34,
                   double m41, double m42, double m43, double m44);  Matrix4(Matrix4 matrix); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Matrix4 set(double m11, double m12, double m13, double m14,
                       double m21, double m22, double m23, double m24,
                       double m31, double m32, double m33, double m34,
                       double m41, double m42, double m43, double m44); Matrix4 set(Matrix4 matrix); Matrix4 setTranslation(double x, double y, double z); Matrix4 setRotation(double x, double y, double z, double angleDegrees); Matrix4 setScale(double xScale, double yScale, double zScale); Matrix4 setToIdentity(); Matrix4 setToTranslation(double x, double y, double z); Matrix4 setToRotation(double x, double y, double z, double angleDegrees); Matrix4 setToScale(double xScale, double yScale, double zScale); Matrix4 setToMultiply(Matrix4 a, Matrix4 b); Matrix4 setToInfiniteProjection(double viewportWidth, double viewportHeight, double fovyDegrees,
                                           double nearDistance); Matrix4 setToPerspectiveProjection(double viewportWidth, double viewportHeight, double fovyDegrees,
                                              double nearDistance, double farDistance); Matrix4 setToScreenProjection(double viewportWidth, double viewportHeight); Matrix4 setToCovarianceOfPoints(float[] array, int count, int stride); Matrix4 multiplyByTranslation(double x, double y, double z); Matrix4 multiplyByRotation(double x, double y, double z, double angleDegrees); Matrix4 multiplyByScale(double xScale, double yScale, double zScale); Matrix4 multiplyByMatrix(Matrix4 matrix); Matrix4 multiplyByMatrix(double m11, double m12, double m13, double m14,
                                    double m21, double m22, double m23, double m24,
                                    double m31, double m32, double m33, double m34,
                                    double m41, double m42, double m43, double m44); Matrix4 transpose(); Matrix4 transposeMatrix(Matrix4 matrix); float[] transposeToArray(float[] result, int offset); Matrix4 invert(); Matrix4 invertMatrix(Matrix4 matrix); Matrix4 invertOrthonormal(); Matrix4 invertOrthonormalMatrix(Matrix4 matrix); Matrix4 offsetProjectionDepth(double depthOffset); Vec3 extractEyePoint(Vec3 result); Vec3 extractForwardVector(Vec3 result); double extractHeading(double roll); double extractTilt(); boolean extractEigenvectors(Vec3 result1, Vec3 result2, Vec3 result3); boolean project(double x, double y, double z, Viewport viewport, Vec3 result); boolean unProject(double x, double y, Viewport viewport, Vec3 nearResult, Vec3 farResult); final double[] m; }
@Test public void testTransposeMatrix() throws Exception { Matrix4 m1 = new Matrix4(); Matrix4 m2 = new Matrix4( M_11, M_12, M_13, M_14, M_21, M_22, M_23, M_24, M_31, M_32, M_33, M_34, M_41, M_42, M_43, M_44); Matrix4 m3 = m1.transposeMatrix(m2); assertEquals("m11", M_11, m1.m[0], 0); assertEquals("m12", M_21, m1.m[1], 0); assertEquals("m13", M_31, m1.m[2], 0); assertEquals("m14", M_41, m1.m[3], 0); assertEquals("m21", M_12, m1.m[4], 0); assertEquals("m22", M_22, m1.m[5], 0); assertEquals("m23", M_32, m1.m[6], 0); assertEquals("m24", M_42, m1.m[7], 0); assertEquals("m31", M_13, m1.m[8], 0); assertEquals("m32", M_23, m1.m[9], 0); assertEquals("m33", M_33, m1.m[10], 0); assertEquals("m34", M_43, m1.m[11], 0); assertEquals("m41", M_14, m1.m[12], 0); assertEquals("m42", M_24, m1.m[13], 0); assertEquals("m43", M_34, m1.m[14], 0); assertEquals("m44", M_44, m1.m[15], 0); assertSame("fluent api result", m3, m1); }