View Javadoc
1   /*
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
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
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.
16   */
17  package org.apache.commons.geometry.euclidean.threed.rotation;
18  
19  import org.apache.commons.geometry.euclidean.EuclideanTransform;
20  import org.apache.commons.geometry.euclidean.threed.Vector3D;
21  
22  /** Interface representing a generic rotation in 3-dimensional Euclidean
23   * space.
24   */
25  public interface Rotation3D extends EuclideanTransform<Vector3D> {
26  
27      /** Apply this rotation to the given argument. Since rotations do
28       * not affect vector magnitudes, this method can be applied to
29       * both points and vectors.
30       * @param vec the point or vector to rotate
31       * @return a new instance representing the rotated point or vector
32       */
33      @Override
34      Vector3D apply(Vector3D vec);
35  
36      /** Get the inverse rotation.
37       * @return the inverse rotation.
38       */
39      @Override
40      Rotation3D inverse();
41  
42      /** Get the axis of rotation as a normalized {@link Vector3D}.
43       *
44       * <p>All 3-dimensional rotations and sequences of rotations can be reduced
45       * to a single rotation around one axis. This method returns that axis.
46       *
47       * @return the axis of rotation
48       * @see #getAngle()
49       */
50      Vector3D getAxis();
51  
52      /** Get the angle of rotation in radians.
53       *
54       * <p>All 3-dimensional rotations and sequences of rotations can be reduced
55       * to a single rotation around one axis. This method returns the angle of
56       * rotation around that axis.
57       *
58       * @return angle of rotation in radians.
59       * @see #getAxis()
60       */
61      double getAngle();
62  }