You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/12/11 02:06:53 UTC

[commons-numbers] branch master updated (8b47349 -> 1d872c6)

This is an automated email from the ASF dual-hosted git repository.

erans pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git.


    from 8b47349  Avoid crash of the surefire plugin.
     new 51aa18f  INFRA-17379: Repository moved to "gitbox".
     new 1d872c6  NUMBERS-80: Renamed instance fields.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/numbers/quaternion/Quaternion.java     | 188 ++++++++++-----------
 .../commons/numbers/quaternion/QuaternionTest.java | 134 +++++++--------
 pom.xml                                            |   6 +-
 src/site/site.xml                                  |   2 +-
 src/site/xdoc/developers.xml                       |   6 +-
 5 files changed, 168 insertions(+), 168 deletions(-)


[commons-numbers] 02/02: NUMBERS-80: Renamed instance fields.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 1d872c64a5a410f07cd81e638002092704ff5af6
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Tue Dec 11 02:56:45 2018 +0100

    NUMBERS-80: Renamed instance fields.
---
 .../commons/numbers/quaternion/Quaternion.java     | 188 ++++++++++-----------
 .../commons/numbers/quaternion/QuaternionTest.java | 134 +++++++--------
 2 files changed, 161 insertions(+), 161 deletions(-)

diff --git a/commons-numbers-quaternion/src/main/java/org/apache/commons/numbers/quaternion/Quaternion.java b/commons-numbers-quaternion/src/main/java/org/apache/commons/numbers/quaternion/Quaternion.java
index 240b928..605dadb 100644
--- a/commons-numbers-quaternion/src/main/java/org/apache/commons/numbers/quaternion/Quaternion.java
+++ b/commons-numbers-quaternion/src/main/java/org/apache/commons/numbers/quaternion/Quaternion.java
@@ -52,13 +52,13 @@ public final class Quaternion implements Serializable {
     private static final String FORMAT_SEP = " ";
 
     /** First component (scalar part). */
-    private final double q0;
+    private final double w;
     /** Second component (first vector part). */
-    private final double q1;
+    private final double x;
     /** Third component (second vector part). */
-    private final double q2;
+    private final double y;
     /** Fourth component (third vector part). */
-    private final double q3;
+    private final double z;
 
     /**
      * Builds a quaternion from its components.
@@ -72,10 +72,10 @@ public final class Quaternion implements Serializable {
                        final double b,
                        final double c,
                        final double d) {
-        q0 = a;
-        q1 = b;
-        q2 = c;
-        q3 = d;
+        w = a;
+        x = b;
+        y = c;
+        z = d;
     }
 
     /**
@@ -92,10 +92,10 @@ public final class Quaternion implements Serializable {
             throw new IllegalArgumentException("Size of array must be 3");
         }
 
-        q0 = scalar;
-        q1 = v[0];
-        q2 = v[1];
-        q3 = v[2];
+        w = scalar;
+        x = v[0];
+        y = v[1];
+        z = v[2];
     }
 
     /**
@@ -146,29 +146,29 @@ public final class Quaternion implements Serializable {
      * @return the conjugate of this quaternion object.
      */
     public Quaternion conjugate() {
-        return new Quaternion(q0, -q1, -q2, -q3);
+        return new Quaternion(w, -x, -y, -z);
     }
 
     /**
      * Returns the Hamilton product of two quaternions.
      *
-     * @param q1 First quaternion.
+     * @param x First quaternion.
      * @param q2 Second quaternion.
-     * @return the product {@code q1} and {@code q2}, in that order.
+     * @return the product {@code x} and {@code q2}, in that order.
      */
     public static Quaternion multiply(final Quaternion q1,
                                       final Quaternion q2) {
         // Components of the first quaternion.
-        final double q1a = q1.q0;
-        final double q1b = q1.q1;
-        final double q1c = q1.q2;
-        final double q1d = q1.q3;
+        final double q1a = q1.w;
+        final double q1b = q1.x;
+        final double q1c = q1.y;
+        final double q1d = q1.z;
 
         // Components of the second quaternion.
-        final double q2a = q2.q0;
-        final double q2b = q2.q1;
-        final double q2c = q2.q2;
-        final double q2d = q2.q3;
+        final double q2a = q2.w;
+        final double q2b = q2.x;
+        final double q2c = q2.y;
+        final double q2d = q2.z;
 
         // Components of the product.
         final double w = q1a * q2a - q1b * q2b - q1c * q2c - q1d * q2d;
@@ -198,17 +198,17 @@ public final class Quaternion implements Serializable {
      */
     public static Quaternion add(final Quaternion q1,
                                  final Quaternion q2) {
-        return new Quaternion(q1.q0 + q2.q0,
-                              q1.q1 + q2.q1,
-                              q1.q2 + q2.q2,
-                              q1.q3 + q2.q3);
+        return new Quaternion(q1.w + q2.w,
+                              q1.x + q2.x,
+                              q1.y + q2.y,
+                              q1.z + q2.z);
     }
 
     /**
      * Computes the sum of the instance and another quaternion.
      *
      * @param q Quaternion.
-     * @return the sum of this instance and {@code q}
+     * @return the sum of this instance and {@code q}.
      */
     public Quaternion add(final Quaternion q) {
         return add(this, q);
@@ -223,10 +223,10 @@ public final class Quaternion implements Serializable {
      */
     public static Quaternion subtract(final Quaternion q1,
                                       final Quaternion q2) {
-        return new Quaternion(q1.q0 - q2.q0,
-                              q1.q1 - q2.q1,
-                              q1.q2 - q2.q2,
-                              q1.q3 - q2.q3);
+        return new Quaternion(q1.w - q2.w,
+                              q1.x - q2.x,
+                              q1.y - q2.y,
+                              q1.z - q2.z);
     }
 
     /**
@@ -248,10 +248,10 @@ public final class Quaternion implements Serializable {
      */
     public static double dotProduct(final Quaternion q1,
                                     final Quaternion q2) {
-        return q1.q0 * q2.q0 +
-            q1.q1 * q2.q1 +
-            q1.q2 * q2.q2 +
-            q1.q3 * q2.q3;
+        return q1.w * q2.w +
+            q1.x * q2.x +
+            q1.y * q2.y +
+            q1.z * q2.z;
     }
 
     /**
@@ -279,10 +279,10 @@ public final class Quaternion implements Serializable {
      * @return the square of the norm.
      */
     public double norm2() {
-        return q0 * q0 +
-            q1 * q1 +
-            q2 * q2 +
-            q3 * q3;
+        return w * w +
+            x * x +
+            y * y +
+            z * z;
     }
 
     /**
@@ -312,10 +312,10 @@ public final class Quaternion implements Serializable {
         }
         if (other instanceof Quaternion) {
             final Quaternion q = (Quaternion) other;
-            return ((Double)q0).equals(q.q0) &&
-                    ((Double)q1).equals(q.q1) &&
-                    ((Double)q2).equals(q.q2) &&
-                    ((Double)q3).equals(q.q3);
+            return ((Double) w).equals(q.w) &&
+                ((Double) x).equals(q.x) &&
+                ((Double) y).equals(q.y) &&
+                ((Double) z).equals(q.z);
         }
 
         return false;
@@ -326,7 +326,7 @@ public final class Quaternion implements Serializable {
      */
     @Override
     public int hashCode() {
-        return Arrays.hashCode(new double[] { q0, q1, q2, q3 });
+        return Arrays.hashCode(new double[] { w, x, y, z });
     }
 
     /**
@@ -340,10 +340,10 @@ public final class Quaternion implements Serializable {
      */
     public boolean equals(final Quaternion q,
                           final double eps) {
-        return Precision.equals(q0, q.q0, eps) &&
-            Precision.equals(q1, q.q1, eps) &&
-            Precision.equals(q2, q.q2, eps) &&
-            Precision.equals(q3, q.q3, eps);
+        return Precision.equals(w, q.w, eps) &&
+            Precision.equals(x, q.x, eps) &&
+            Precision.equals(y, q.y, eps) &&
+            Precision.equals(z, q.z, eps);
     }
 
     /**
@@ -366,7 +366,7 @@ public final class Quaternion implements Serializable {
      * @return {@code true} if the scalar part of the quaternion is zero.
      */
     public boolean isPureQuaternion(double eps) {
-        return Math.abs(q0) <= eps;
+        return Math.abs(w) <= eps;
     }
 
     /**
@@ -375,14 +375,14 @@ public final class Quaternion implements Serializable {
      * @return the unit quaternion with positive scalar part.
      */
     public Quaternion positivePolarForm() {
-        if (q0 < 0) {
+        if (w < 0) {
             final Quaternion unitQ = normalize();
             // The quaternion of rotation (normalized quaternion) q and -q
             // are equivalent (i.e. represent the same rotation).
-            return new Quaternion(-unitQ.q0,
-                                  -unitQ.q1,
-                                  -unitQ.q2,
-                                  -unitQ.q3);
+            return new Quaternion(-unitQ.w,
+                                  -unitQ.x,
+                                  -unitQ.y,
+                                  -unitQ.z);
         } else {
             return this.normalize();
         }
@@ -401,10 +401,10 @@ public final class Quaternion implements Serializable {
             throw new IllegalStateException(ZERO_NORM_MSG);
         }
 
-        return new Quaternion(q0 / squareNorm,
-                              -q1 / squareNorm,
-                              -q2 / squareNorm,
-                              -q3 / squareNorm);
+        return new Quaternion(w / squareNorm,
+                              -x / squareNorm,
+                              -y / squareNorm,
+                              -z / squareNorm);
     }
 
     /**
@@ -412,8 +412,8 @@ public final class Quaternion implements Serializable {
      *
      * @return the scalar part.
      */
-    public double getQ0() {
-        return q0;
+    public double getW() {
+        return w;
     }
 
     /**
@@ -422,8 +422,8 @@ public final class Quaternion implements Serializable {
      *
      * @return the first component of the vector part.
      */
-    public double getQ1() {
-        return q1;
+    public double getX() {
+        return x;
     }
 
     /**
@@ -432,8 +432,8 @@ public final class Quaternion implements Serializable {
      *
      * @return the second component of the vector part.
      */
-    public double getQ2() {
-        return q2;
+    public double getY() {
+        return y;
     }
 
     /**
@@ -442,30 +442,30 @@ public final class Quaternion implements Serializable {
      *
      * @return the third component of the vector part.
      */
-    public double getQ3() {
-        return q3;
+    public double getZ() {
+        return z;
     }
 
     /**
      * Gets the scalar part of the quaternion.
      *
      * @return the scalar part.
-     * @see #getQ0()
+     * @see #getW()
      */
     public double getScalarPart() {
-        return q0;
+        return w;
     }
 
     /**
      * Gets the three components of the vector part of the quaternion.
      *
      * @return the vector part.
-     * @see #getQ1()
-     * @see #getQ2()
-     * @see #getQ3()
+     * @see #getX()
+     * @see #getY()
+     * @see #getZ()
      */
     public double[] getVectorPart() {
-        return new double[] { q1, q2, q3 };
+        return new double[] { x, y, z };
     }
 
     /**
@@ -475,10 +475,10 @@ public final class Quaternion implements Serializable {
      * @return a scaled quaternion.
      */
     public Quaternion multiply(final double alpha) {
-        return new Quaternion(alpha * q0,
-                              alpha * q1,
-                              alpha * q2,
-                              alpha * q3);
+        return new Quaternion(alpha * w,
+                              alpha * x,
+                              alpha * y,
+                              alpha * z);
     }
 
     /**
@@ -488,10 +488,10 @@ public final class Quaternion implements Serializable {
      * @return a scaled quaternion.
      */
     public Quaternion divide(final double alpha) {
-        return new Quaternion(q0 / alpha,
-                              q1 / alpha,
-                              q2 / alpha,
-                              q3 / alpha);
+        return new Quaternion(w / alpha,
+                              x / alpha,
+                              y / alpha,
+                              z / alpha);
     }
 
     /**
@@ -520,32 +520,32 @@ public final class Quaternion implements Serializable {
                                                  " (separator is '" + FORMAT_SEP + "')");
         }
 
-        final double q1;
+        final double a;
         try {
-            q1 = Double.parseDouble(elements[0]);
+            a = Double.parseDouble(elements[0]);
         } catch (NumberFormatException ex) {
             throw new QuaternionParsingException("Could not parse scalar part" + elements[0]);
         }
-        final double q2;
+        final double b;
         try {
-            q2 = Double.parseDouble(elements[1]);
+            b = Double.parseDouble(elements[1]);
         } catch (NumberFormatException ex) {
             throw new QuaternionParsingException("Could not parse i part" + elements[1]);
         }
-        final double q3;
+        final double c;
         try {
-            q3 = Double.parseDouble(elements[2]);
+            c = Double.parseDouble(elements[2]);
         } catch (NumberFormatException ex) {
             throw new QuaternionParsingException("Could not parse j part" + elements[2]);
         }
-        final double q4;
+        final double d;
         try {
-            q4 = Double.parseDouble(elements[3]);
+            d = Double.parseDouble(elements[3]);
         } catch (NumberFormatException ex) {
             throw new QuaternionParsingException("Could not parse k part" + elements[3]);
         }
 
-        return of(q1, q2, q3, q4);
+        return of(a, b, c, d);
     }
 
     /**
@@ -555,10 +555,10 @@ public final class Quaternion implements Serializable {
     public String toString() {
         final StringBuilder s = new StringBuilder();
         s.append(FORMAT_START)
-            .append(q0).append(FORMAT_SEP)
-            .append(q1).append(FORMAT_SEP)
-            .append(q2).append(FORMAT_SEP)
-            .append(q3)
+            .append(w).append(FORMAT_SEP)
+            .append(x).append(FORMAT_SEP)
+            .append(y).append(FORMAT_SEP)
+            .append(z)
             .append(FORMAT_END);
 
         return s.toString();
diff --git a/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java b/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
index 9dc3074..d9586da 100644
--- a/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
+++ b/commons-numbers-quaternion/src/test/java/org/apache/commons/numbers/quaternion/QuaternionTest.java
@@ -35,10 +35,10 @@ public class QuaternionTest {
         final double q3 = 0.0005;
         final Quaternion q = Quaternion.of(q0, q1, q2, q3);
 
-        Assert.assertEquals(q0, q.getQ0(), 0);
-        Assert.assertEquals(q1, q.getQ1(), 0);
-        Assert.assertEquals(q2, q.getQ2(), 0);
-        Assert.assertEquals(q3, q.getQ3(), 0);
+        Assert.assertEquals(q0, q.getW(), 0);
+        Assert.assertEquals(q1, q.getX(), 0);
+        Assert.assertEquals(q2, q.getY(), 0);
+        Assert.assertEquals(q3, q.getZ(), 0);
     }
 
     @Test
@@ -90,10 +90,10 @@ public class QuaternionTest {
 
         final Quaternion qConjugate = q.conjugate();
 
-        Assert.assertEquals(q0, qConjugate.getQ0(), 0);
-        Assert.assertEquals(-q1, qConjugate.getQ1(), 0);
-        Assert.assertEquals(-q2, qConjugate.getQ2(), 0);
-        Assert.assertEquals(-q3, qConjugate.getQ3(), 0);
+        Assert.assertEquals(q0, qConjugate.getW(), 0);
+        Assert.assertEquals(-q1, qConjugate.getX(), 0);
+        Assert.assertEquals(-q2, qConjugate.getY(), 0);
+        Assert.assertEquals(-q3, qConjugate.getZ(), 0);
     }
 
     /* TODO remove dependency on Vector3D
@@ -106,10 +106,10 @@ public class QuaternionTest {
         final Quaternion qB = Quaternion.of(6, 2, 1, -9);
         final Quaternion qResult = Quaternion.multiply(qA, qB);
 
-        Assert.assertEquals(44, qResult.getQ0(), EPS);
-        Assert.assertEquals(28, qResult.getQ1(), EPS);
-        Assert.assertEquals(-4.5, qResult.getQ2(), EPS);
-        Assert.assertEquals(21.5, qResult.getQ3(), EPS);
+        Assert.assertEquals(44, qResult.getW(), EPS);
+        Assert.assertEquals(28, qResult.getX(), EPS);
+        Assert.assertEquals(-4.5, qResult.getY(), EPS);
+        Assert.assertEquals(21.5, qResult.getZ(), EPS);
 
         // comparison with the result given by the formula :
         // qResult = (scalarA * scalarB - vectorA . vectorB) + (scalarA * vectorB + scalarB * vectorA + vectorA ^
@@ -135,10 +135,10 @@ public class QuaternionTest {
         final Quaternion conjugateOfProduct = qB.getConjugate().multiply(qA.getConjugate());
         final Quaternion productOfConjugate = (qA.multiply(qB)).getConjugate();
 
-        Assert.assertEquals(conjugateOfProduct.getQ0(), productOfConjugate.getQ0(), EPS);
-        Assert.assertEquals(conjugateOfProduct.getQ1(), productOfConjugate.getQ1(), EPS);
-        Assert.assertEquals(conjugateOfProduct.getQ2(), productOfConjugate.getQ2(), EPS);
-        Assert.assertEquals(conjugateOfProduct.getQ3(), productOfConjugate.getQ3(), EPS);
+        Assert.assertEquals(conjugateOfProduct.getW(), productOfConjugate.getW(), EPS);
+        Assert.assertEquals(conjugateOfProduct.getX(), productOfConjugate.getX(), EPS);
+        Assert.assertEquals(conjugateOfProduct.getY(), productOfConjugate.getY(), EPS);
+        Assert.assertEquals(conjugateOfProduct.getZ(), productOfConjugate.getZ(), EPS);
     }
     */
     /* TODO remove dependency on Vector3D
@@ -151,10 +151,10 @@ public class QuaternionTest {
         final double[] vector = {2.0, 1.0, 3.0};
         final Quaternion qResultQxV = Quaternion.multiply(quaternion, Quaternion.of(vector));
 
-        Assert.assertEquals(-19, qResultQxV.getQ0(), EPS);
-        Assert.assertEquals(3, qResultQxV.getQ1(), EPS);
-        Assert.assertEquals(-13, qResultQxV.getQ2(), EPS);
-        Assert.assertEquals(21, qResultQxV.getQ3(), EPS);
+        Assert.assertEquals(-19, qResultQxV.getW(), EPS);
+        Assert.assertEquals(3, qResultQxV.getX(), EPS);
+        Assert.assertEquals(-13, qResultQxV.getY(), EPS);
+        Assert.assertEquals(21, qResultQxV.getZ(), EPS);
 
         // comparison with the result given by the formula :
         // qResult = (- vectorQ . vector) + (scalarQ * vector + vectorQ ^ vector)
@@ -174,10 +174,10 @@ public class QuaternionTest {
 
         final Quaternion qResultVxQ = Quaternion.multiply(Quaternion.of(vector), quaternion);
 
-        Assert.assertEquals(-19, qResultVxQ.getQ0(), EPS);
-        Assert.assertEquals(13, qResultVxQ.getQ1(), EPS);
-        Assert.assertEquals(21, qResultVxQ.getQ2(), EPS);
-        Assert.assertEquals(3, qResultVxQ.getQ3(), EPS);
+        Assert.assertEquals(-19, qResultVxQ.getW(), EPS);
+        Assert.assertEquals(13, qResultVxQ.getX(), EPS);
+        Assert.assertEquals(21, qResultVxQ.getY(), EPS);
+        Assert.assertEquals(3, qResultVxQ.getZ(), EPS);
 
         final double[] vectorResultVxQ = qResultVxQ.getVectorPart();
 
@@ -221,10 +221,10 @@ public class QuaternionTest {
 
         final Quaternion q = q1.multiply(a);
 
-        Assert.assertEquals(w, q.getQ0(), COMPARISON_EPS);
-        Assert.assertEquals(x, q.getQ1(), COMPARISON_EPS);
-        Assert.assertEquals(y, q.getQ2(), COMPARISON_EPS);
-        Assert.assertEquals(z, q.getQ3(), COMPARISON_EPS);
+        Assert.assertEquals(w, q.getW(), COMPARISON_EPS);
+        Assert.assertEquals(x, q.getX(), COMPARISON_EPS);
+        Assert.assertEquals(y, q.getY(), COMPARISON_EPS);
+        Assert.assertEquals(z, q.getZ(), COMPARISON_EPS);
     }
 
     @Test
@@ -241,15 +241,15 @@ public class QuaternionTest {
         final Quaternion qa = Quaternion.add(q1, q2);
         final Quaternion qb = q1.add(q2);
 
-        Assert.assertEquals(w, qa.getQ0(), EPS);
-        Assert.assertEquals(x, qa.getQ1(), EPS);
-        Assert.assertEquals(y, qa.getQ2(), EPS);
-        Assert.assertEquals(z, qa.getQ3(), EPS);
+        Assert.assertEquals(w, qa.getW(), EPS);
+        Assert.assertEquals(x, qa.getX(), EPS);
+        Assert.assertEquals(y, qa.getY(), EPS);
+        Assert.assertEquals(z, qa.getZ(), EPS);
 
-        Assert.assertEquals(w, qb.getQ0(), EPS);
-        Assert.assertEquals(x, qb.getQ1(), EPS);
-        Assert.assertEquals(y, qb.getQ2(), EPS);
-        Assert.assertEquals(z, qb.getQ3(), EPS);
+        Assert.assertEquals(w, qb.getW(), EPS);
+        Assert.assertEquals(x, qb.getX(), EPS);
+        Assert.assertEquals(y, qb.getY(), EPS);
+        Assert.assertEquals(z, qb.getZ(), EPS);
     }
 
     @Test
@@ -266,15 +266,15 @@ public class QuaternionTest {
         final Quaternion qa = Quaternion.subtract(q1, q2);
         final Quaternion qb = q1.subtract(q2);
 
-        Assert.assertEquals(w, qa.getQ0(), EPS);
-        Assert.assertEquals(x, qa.getQ1(), EPS);
-        Assert.assertEquals(y, qa.getQ2(), EPS);
-        Assert.assertEquals(z, qa.getQ3(), EPS);
+        Assert.assertEquals(w, qa.getW(), EPS);
+        Assert.assertEquals(x, qa.getX(), EPS);
+        Assert.assertEquals(y, qa.getY(), EPS);
+        Assert.assertEquals(z, qa.getZ(), EPS);
 
-        Assert.assertEquals(w, qb.getQ0(), EPS);
-        Assert.assertEquals(x, qb.getQ1(), EPS);
-        Assert.assertEquals(y, qb.getQ2(), EPS);
-        Assert.assertEquals(z, qb.getQ3(), EPS);
+        Assert.assertEquals(w, qb.getW(), EPS);
+        Assert.assertEquals(x, qb.getX(), EPS);
+        Assert.assertEquals(y, qb.getY(), EPS);
+        Assert.assertEquals(z, qb.getZ(), EPS);
 }
 
     @Test
@@ -301,10 +301,10 @@ public class QuaternionTest {
 
         final Quaternion versor = q.normalize();
 
-        Assert.assertEquals(2.0 / 5.0, versor.getQ0(), 0);
-        Assert.assertEquals(1.0 / 5.0, versor.getQ1(), 0);
-        Assert.assertEquals(-4.0 / 5.0, versor.getQ2(), 0);
-        Assert.assertEquals(-2.0 / 5.0, versor.getQ3(), 0);
+        Assert.assertEquals(2.0 / 5.0, versor.getW(), 0);
+        Assert.assertEquals(1.0 / 5.0, versor.getX(), 0);
+        Assert.assertEquals(-4.0 / 5.0, versor.getY(), 0);
+        Assert.assertEquals(-2.0 / 5.0, versor.getZ(), 0);
 
         Assert.assertEquals(1, versor.norm(), 0);
     }
@@ -367,10 +367,10 @@ public class QuaternionTest {
     public final void testQuaternionEquals() {
         final double inc = 1e-5;
         final Quaternion q1 = Quaternion.of(2, 1, -4, -2);
-        final Quaternion q2 = Quaternion.of(q1.getQ0() + inc, q1.getQ1(), q1.getQ2(), q1.getQ3());
-        final Quaternion q3 = Quaternion.of(q1.getQ0(), q1.getQ1() + inc, q1.getQ2(), q1.getQ3());
-        final Quaternion q4 = Quaternion.of(q1.getQ0(), q1.getQ1(), q1.getQ2() + inc, q1.getQ3());
-        final Quaternion q5 = Quaternion.of(q1.getQ0(), q1.getQ1(), q1.getQ2(), q1.getQ3() + inc);
+        final Quaternion q2 = Quaternion.of(q1.getW() + inc, q1.getX(), q1.getY(), q1.getZ());
+        final Quaternion q3 = Quaternion.of(q1.getW(), q1.getX() + inc, q1.getY(), q1.getZ());
+        final Quaternion q4 = Quaternion.of(q1.getW(), q1.getX(), q1.getY() + inc, q1.getZ());
+        final Quaternion q5 = Quaternion.of(q1.getW(), q1.getX(), q1.getY(), q1.getZ() + inc);
 
         Assert.assertFalse(q1.equals(q2, 0.9 * inc));
         Assert.assertFalse(q1.equals(q3, 0.9 * inc));
@@ -455,10 +455,10 @@ public class QuaternionTest {
             final Quaternion qP = q.positivePolarForm();
 
             Assert.assertTrue(qP.isUnitQuaternion(COMPARISON_EPS));
-            Assert.assertTrue(qP.getQ0() >= 0);
+            Assert.assertTrue(qP.getW() >= 0);
 
-            final Rotation rot = new Rotation(q.getQ0(), q.getQ1(), q.getQ2(), q.getQ3(), true);
-            final Rotation rotP = new Rotation(qP.getQ0(), qP.getQ1(), qP.getQ2(), qP.getQ3(), true);
+            final Rotation rot = new Rotation(q.getW(), q.getX(), q.getY(), q.getZ(), true);
+            final Rotation rotP = new Rotation(qP.getW(), qP.getX(), qP.getY(), qP.getZ(), true);
 
             Assert.assertEquals(rot.getAngle(), rotP.getAngle(), COMPARISON_EPS);
             Assert.assertEquals(rot.getAxis(RotationConvention.VECTOR_OPERATOR).getX(),
@@ -478,16 +478,16 @@ public class QuaternionTest {
         final Quaternion q = Quaternion.of(1.5, 4, 2, -2.5);
 
         final Quaternion inverseQ = q.inverse();
-        Assert.assertEquals(1.5 / 28.5, inverseQ.getQ0(), 0);
-        Assert.assertEquals(-4.0 / 28.5, inverseQ.getQ1(), 0);
-        Assert.assertEquals(-2.0 / 28.5, inverseQ.getQ2(), 0);
-        Assert.assertEquals(2.5 / 28.5, inverseQ.getQ3(), 0);
+        Assert.assertEquals(1.5 / 28.5, inverseQ.getW(), 0);
+        Assert.assertEquals(-4.0 / 28.5, inverseQ.getX(), 0);
+        Assert.assertEquals(-2.0 / 28.5, inverseQ.getY(), 0);
+        Assert.assertEquals(2.5 / 28.5, inverseQ.getZ(), 0);
 
         final Quaternion product = Quaternion.multiply(inverseQ, q);
-        Assert.assertEquals(1, product.getQ0(), EPS);
-        Assert.assertEquals(0, product.getQ1(), EPS);
-        Assert.assertEquals(0, product.getQ2(), EPS);
-        Assert.assertEquals(0, product.getQ3(), EPS);
+        Assert.assertEquals(1, product.getW(), EPS);
+        Assert.assertEquals(0, product.getX(), EPS);
+        Assert.assertEquals(0, product.getY(), EPS);
+        Assert.assertEquals(0, product.getZ(), EPS);
 
         final Quaternion qNul = Quaternion.of(0, 0, 0, 0);
         try {
@@ -521,10 +521,10 @@ public class QuaternionTest {
     @Test
     public final void testParseSpecials() {
         Quaternion parsed = Quaternion.parse("[1e-5 Infinity NaN -0xa.cp0]");
-        Assert.assertEquals(1e-5, parsed.getQ0(), EPS);
-        Assert.assertTrue(Double.isInfinite(parsed.getQ1()));
-        Assert.assertTrue(Double.isNaN(parsed.getQ2()));
-        Assert.assertEquals(-0xa.cp0, parsed.getQ3(), EPS);
+        Assert.assertEquals(1e-5, parsed.getW(), EPS);
+        Assert.assertTrue(Double.isInfinite(parsed.getX()));
+        Assert.assertTrue(Double.isNaN(parsed.getY()));
+        Assert.assertEquals(-0xa.cp0, parsed.getZ(), EPS);
     }
 
     @Test(expected = IllegalArgumentException.class)


[commons-numbers] 01/02: INFRA-17379: Repository moved to "gitbox".

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 51aa18f2572bbc88d17abe255ed35028873abf22
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Tue Dec 11 02:40:52 2018 +0100

    INFRA-17379: Repository moved to "gitbox".
---
 pom.xml                      | 6 +++---
 src/site/site.xml            | 2 +-
 src/site/xdoc/developers.xml | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 227311d..29d8de2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,9 +39,9 @@
   </issueManagement>
 
   <scm>
-    <connection>scm:git:http://git-wip-us.apache.org/repos/asf/commons-numbers.git</connection>
-    <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/commons-numbers.git</developerConnection>
-    <url>https://git-wip-us.apache.org/repos/asf?p=commons-numbers.git</url>
+    <connection>scm:git:http://gitbox.apache.org/repos/asf/commons-numbers.git</connection>
+    <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/commons-numbers.git</developerConnection>
+    <url>https://gitbox.apache.org/repos/asf/commons-numbers.git</url>
   </scm>
 
   <distributionManagement>
diff --git a/src/site/site.xml b/src/site/site.xml
index f40c4c9..722e3df 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -28,7 +28,7 @@
       <item name="Downloads" href="http://commons.apache.org/numbers/download_numbers.cgi"/>
       <item name="Issue Tracking" href="/issue-tracking.html"/>
       <item name="Source Repository (current)" 
-         href="http://git-wip-us.apache.org/repos/asf/commons-numbers.git"/>
+         href="http://gitbox.apache.org/repos/asf/commons-numbers.git"/>
       <!-- <item name="Wiki"   -->
       <!--       href="http://wiki.apache.org/commons/Numbers"/> -->
       <item name="Developers Guide" href="/developers.html"/>
diff --git a/src/site/xdoc/developers.xml b/src/site/xdoc/developers.xml
index d62066b..4675e78 100644
--- a/src/site/xdoc/developers.xml
+++ b/src/site/xdoc/developers.xml
@@ -45,11 +45,11 @@
             <li>
               Download the Commons Numbers source code.  Follow the instructions
               under the heading "Repository Checkout" on the
-              <a href="https://git-wip-us.apache.org/">Git at the ASF page</a>.
+              <a href="https://gitbox.apache.org/">Git at the ASF page</a>.
               The git url for the current development sources of Commons Numbers
-              is <source>http://git-wip-us.apache.org/repos/asf/commons-numbers.git</source>
+              is <source>http://gitbox.apache.org/repos/asf/commons-numbers.git</source>
               for anonymous read-only access and
-              <source>https://apacheid@git-wip-us.apache.org/repos/asf/commons-numbers.git</source>
+              <source>https://apacheid@gitbox.apache.org/repos/asf/commons-numbers.git</source>
               (where apacheid should be replaced by each committer Apache ID) for committers
               read-write access.
             </li>