001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.geometry.euclidean.threed.rotation;
018
019import org.apache.commons.geometry.euclidean.EuclideanTransform;
020import org.apache.commons.geometry.euclidean.threed.Vector3D;
021
022/** Interface representing a generic rotation in 3-dimensional Euclidean
023 * space.
024 */
025public interface Rotation3D extends EuclideanTransform<Vector3D> {
026
027    /** Apply this rotation to the given argument. Since rotations do
028     * not affect vector magnitudes, this method can be applied to
029     * both points and vectors.
030     * @param vec the point or vector to rotate
031     * @return a new instance representing the rotated point or vector
032     */
033    @Override
034    Vector3D apply(Vector3D vec);
035
036    /** Get the inverse rotation.
037     * @return the inverse rotation.
038     */
039    @Override
040    Rotation3D inverse();
041
042    /** Get the axis of rotation as a normalized {@link Vector3D}.
043     *
044     * <p>All 3-dimensional rotations and sequences of rotations can be reduced
045     * to a single rotation around one axis. This method returns that axis.
046     *
047     * @return the axis of rotation
048     * @see #getAngle()
049     */
050    Vector3D getAxis();
051
052    /** Get the angle of rotation in radians.
053     *
054     * <p>All 3-dimensional rotations and sequences of rotations can be reduced
055     * to a single rotation around one axis. This method returns the angle of
056     * rotation around that axis.
057     *
058     * @return angle of rotation in radians.
059     * @see #getAxis()
060     */
061    double getAngle();
062}