Commits

Michael Ludwig  committed 6c21756

Correct formatting errors and minor improvements to math code.

  • Participants
  • Parent commits 43b40bc

Comments (0)

Files changed (4)

File ferox-math/src/main/java/com/ferox/math/Matrix3.java

         
         double s = 2 / d;
         
-        double xs = q.x * s,  ys = q.y * s, zs = q.z * s;
+        double xs = q.x * s,  ys = q.y * s,  zs = q.z * s;
         double wx = q.w * xs, wy = q.w * ys, wz = q.w * zs;
         double xx = q.x * xs, xy = q.x * ys, xz = q.x * zs;
         double yy = q.y * ys, yz = q.y * zs, zz = q.z * zs;
         
-        return set(1f - (yy + zz), xy - wz, xz + wy,
-                   xy + wz, 1f - (xx + zz), yz - wx,
-                   xz - wy, yz + wx, 1f - (xx + yy));
+        return set(1.0 - (yy + zz), xy - wz, xz + wy,
+                   xy + wz, 1.0 - (xx + zz), yz - wx,
+                   xz - wy, yz + wx, 1.0 - (xx + yy));
     }
 
     /**

File ferox-math/src/main/java/com/ferox/math/Matrix4.java

      * @param m33
      */
     public Matrix4(double m00, double m01, double m02, double m03, 
-                    double m10, double m11, double m12, double m13,
-                    double m20, double m21, double m22, double m23, 
-                    double m30, double m31, double m32, double m33) {
+                   double m10, double m11, double m12, double m13,
+                   double m20, double m21, double m22, double m23, 
+                   double m30, double m31, double m32, double m33) {
         set(m00, m01, m02, m03, 
             m10, m11, m12, m13, 
             m20, m21, m22, m23,

File ferox-math/src/main/java/com/ferox/math/Quat4.java

      */
     public Quat4 set(@Const Matrix3 e) {
         double trace = e.trace();
-        if (trace > 0f) {
+        if (trace > 0.0) {
             double s = Math.sqrt(trace + 1.0);
             w = .5 * s;
             s = .5 / s;
             z = s * (e.m10 - e.m01);
         } else {
             // get the column that has the highest diagonal element
-            int i = (e.get(0, 0) < e.get(1, 1) ? (e.get(1, 1) < e.get(2, 2) ? 2 : 1)
-                                               : (e.get(0, 0) < e.get(2, 2) ? 2 : 0));
+            int i = (e.m00 < e.m11 ? (e.m11 < e.m22 ? 2 : 1)
+                                   : (e.m00 < e.m22 ? 2 : 0));
             int j = (i + 1) % 3;
             int k = (i + 2) % 3;
             
-            double s = Math.sqrt(e.get(i, i) - e.get(j, j) - e.get(k, k) + 1f);
+            double s = Math.sqrt(e.get(i, i) - e.get(j, j) - e.get(k, k) + 1.0);
             set(i, .5 * s);
             s = .5 / s;
             

File ferox-math/src/main/java/com/ferox/math/Vector3.java

      * @throws NullPointerException if v is null
      */
     public double distanceSquared(@Const Vector3 v) {
-        double dx = x- v.x;
+        double dx = x - v.x;
         double dy = y - v.y;
         double dz = z - v.z;
         return dx * dx + dy * dy + dz * dz;