Added a conversion from RotationDS to Rotation.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1447753 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc277966a7
commit
8dd9f830ad
|
@ -786,6 +786,13 @@ public class RotationDS implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
/** 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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue