2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
18
package org.apache.commons.math.geometry;
21
* This class is a utility representing a rotation order specification
22
* for Cardan or Euler angles specification.
24
* This class cannot be instanciated by the user. He can only use one
25
* of the twelve predefined supported orders as an argument to either
26
* the {@link Rotation#Rotation(RotationOrder,double,double,double)}
27
* constructor or the {@link Rotation#getAngles} method.
29
* @version $Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $
32
public final class RotationOrder {
34
/** Private constructor.
35
* This is a utility class that cannot be instantiated by the user,
36
* so its only constructor is private.
37
* @param name name of the rotation order
38
* @param a1 axis of the first rotation
39
* @param a2 axis of the second rotation
40
* @param a3 axis of the third rotation
42
private RotationOrder(String name,
43
Vector3D a1, Vector3D a2, Vector3D a3) {
50
/** Get a string representation of the instance.
51
* @return a string representation of the instance (in fact, its name)
53
public String toString() {
57
/** Get the axis of the first rotation.
58
* @return axis of the first rotation
60
public Vector3D getA1() {
64
/** Get the axis of the second rotation.
65
* @return axis of the second rotation
67
public Vector3D getA2() {
71
/** Get the axis of the second rotation.
72
* @return axis of the second rotation
74
public Vector3D getA3() {
78
/** Set of Cardan angles.
79
* this ordered set of rotations is around X, then around Y, then
82
public static final RotationOrder XYZ =
83
new RotationOrder("XYZ", Vector3D.plusI, Vector3D.plusJ, Vector3D.plusK);
85
/** Set of Cardan angles.
86
* this ordered set of rotations is around X, then around Z, then
89
public static final RotationOrder XZY =
90
new RotationOrder("XZY", Vector3D.plusI, Vector3D.plusK, Vector3D.plusJ);
92
/** Set of Cardan angles.
93
* this ordered set of rotations is around Y, then around X, then
96
public static final RotationOrder YXZ =
97
new RotationOrder("YXZ", Vector3D.plusJ, Vector3D.plusI, Vector3D.plusK);
99
/** Set of Cardan angles.
100
* this ordered set of rotations is around Y, then around Z, then
103
public static final RotationOrder YZX =
104
new RotationOrder("YZX", Vector3D.plusJ, Vector3D.plusK, Vector3D.plusI);
106
/** Set of Cardan angles.
107
* this ordered set of rotations is around Z, then around X, then
110
public static final RotationOrder ZXY =
111
new RotationOrder("ZXY", Vector3D.plusK, Vector3D.plusI, Vector3D.plusJ);
113
/** Set of Cardan angles.
114
* this ordered set of rotations is around Z, then around Y, then
117
public static final RotationOrder ZYX =
118
new RotationOrder("ZYX", Vector3D.plusK, Vector3D.plusJ, Vector3D.plusI);
120
/** Set of Euler angles.
121
* this ordered set of rotations is around X, then around Y, then
124
public static final RotationOrder XYX =
125
new RotationOrder("XYX", Vector3D.plusI, Vector3D.plusJ, Vector3D.plusI);
127
/** Set of Euler angles.
128
* this ordered set of rotations is around X, then around Z, then
131
public static final RotationOrder XZX =
132
new RotationOrder("XZX", Vector3D.plusI, Vector3D.plusK, Vector3D.plusI);
134
/** Set of Euler angles.
135
* this ordered set of rotations is around Y, then around X, then
138
public static final RotationOrder YXY =
139
new RotationOrder("YXY", Vector3D.plusJ, Vector3D.plusI, Vector3D.plusJ);
141
/** Set of Euler angles.
142
* this ordered set of rotations is around Y, then around Z, then
145
public static final RotationOrder YZY =
146
new RotationOrder("YZY", Vector3D.plusJ, Vector3D.plusK, Vector3D.plusJ);
148
/** Set of Euler angles.
149
* this ordered set of rotations is around Z, then around X, then
152
public static final RotationOrder ZXZ =
153
new RotationOrder("ZXZ", Vector3D.plusK, Vector3D.plusI, Vector3D.plusK);
155
/** Set of Euler angles.
156
* this ordered set of rotations is around Z, then around Y, then
159
public static final RotationOrder ZYZ =
160
new RotationOrder("ZYZ", Vector3D.plusK, Vector3D.plusJ, Vector3D.plusK);
162
/** Name of the rotations order. */
163
private final String name;
165
/** Axis of the first rotation. */
166
private final Vector3D a1;
168
/** Axis of the second rotation. */
169
private final Vector3D a2;
171
/** Axis of the third rotation. */
172
private final Vector3D a3;