Class Orientation

Object
Orientation
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Orientation2D, Orientation3DEulerAngles, OrientationAxisAngle, OrientationRotationMatrix

public abstract class Orientation extends Object implements Serializable
The orientation (direction) in 2D or 3D Euclidean space.

It presumes the existing entity has a neutral orientation along the x-axis.

All implementations must be immutable classes, whose state cannot be changed.

As an exception, we have internal state to memoize calls to deriveRotationMatrix().

Author:
Owen Feehan
See Also:
  • Constructor Details

    • Orientation

      public Orientation()
  • Method Details

    • getRotationMatrix

      public RotationMatrix getRotationMatrix()
      Derives a RotationMatrix that can be applied to rotate an entity anti-clockwise to the current orientation.

      It presumes the existing entity has a neutral orientation along the x-axis.

      This computation is memoized, upon the first call to this method.

      Returns:
      the rotation-matrix.
    • deriveRotationMatrix

      protected abstract RotationMatrix deriveRotationMatrix()
      Derives a RotationMatrix that can be applied to rotate an entity anti-clockwise to the current orientation.

      It presumes the existing entity has a neutral orientation along the x-axis.

      Returns:
      the rotation-matrix.
    • numberDimensions

      public abstract int numberDimensions()
      The dimensionality of space the orientation is valid for.
      Returns:
      2 or 3.
    • equals

      public abstract boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • negative

      public abstract Orientation negative()
      Derives a new Orientation in the opposite (negative) direction to the current instance.

      A unit step from the origin in the current orientation direction, summed with a unit step in the negative direction, should end in the origin.

      Returns:
      the new Orientation in the negative direction.