Author: luc
Date: Tue Feb 19 15:07:04 2013
New Revision: 1447753

URL: http://svn.apache.org/r1447753
Log:
Added a conversion from RotationDS to Rotation.

Modified:
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDS.java
    
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDSTest.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDS.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDS.java?rev=1447753&r1=1447752&r2=1447753&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDS.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDS.java
 Tue Feb 19 15:07:04 2013
@@ -786,6 +786,13 @@ public class RotationDS implements Seria
 
     }
 
+    /** Convert to a constant vector without derivatives.
+     * @return a constant vector
+     */
+    public Rotation toRotation() {
+        return new Rotation(q0.getValue(), q1.getValue(), q2.getValue(), 
q3.getValue(), false);
+    }
+
     /** Apply the rotation to a vector.
      * @param u vector to apply the rotation to
      * @return a new vector which is the image of u by the rotation

Modified: 
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDSTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDSTest.java?rev=1447753&r1=1447752&r2=1447753&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDSTest.java
 (original)
+++ 
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationDSTest.java
 Tue Feb 19 15:07:04 2013
@@ -486,11 +486,7 @@ public class RotationDSTest {
         RotationDS r1       = new RotationDS(createVector(2, -3, 5), 
createAngle(1.7));
         RotationDS r2       = new RotationDS(createVector(-1, 3, 2), 
createAngle(0.3));
         RotationDS r3       = r2.applyTo(r1);
-        RotationDS r3Double = r2.applyTo(new Rotation(r1.getQ0().getValue(),
-                                                      r1.getQ1().getValue(),
-                                                      r1.getQ2().getValue(),
-                                                      r1.getQ3().getValue(),
-                                                      false));
+        RotationDS r3Double = r2.applyTo(r1.toRotation());
 
         for (double x = -0.9; x < 0.9; x += 0.2) {
             for (double y = -0.9; y < 0.9; y += 0.2) {
@@ -510,11 +506,7 @@ public class RotationDSTest {
         RotationDS r1 = new RotationDS(createVector(2, -3, 5), 
createAngle(1.7));
         RotationDS r2 = new RotationDS(createVector(-1, 3, 2), 
createAngle(0.3));
         RotationDS r3 = r2.applyInverseTo(r1);
-        RotationDS r3Double = r2.applyInverseTo(new 
Rotation(r1.getQ0().getValue(),
-                                                             
r1.getQ1().getValue(),
-                                                             
r1.getQ2().getValue(),
-                                                             
r1.getQ3().getValue(),
-                                                             false));
+        RotationDS r3Double = r2.applyInverseTo(r1.toRotation());
 
         for (double x = -0.9; x < 0.9; x += 0.2) {
             for (double y = -0.9; y < 0.9; y += 0.2) {


Reply via email to