Class Rotation2D

java.lang.Object
net.algart.math.geom.Rotation2D
All Implemented Interfaces:
Cloneable

public final class Rotation2D extends Object implements Cloneable

2D rotation by some angle: an immutable object representing some rotation angle Δφ. Positive Δφ corresponds to anticlockwise rotation.

This class is immutable and thread-safe: there are no ways to modify settings of the created instance.

Author:
Daniel Alievsky
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns this instance (possible solution as this class is immutable).
    boolean
    Indicates whether some other rotation is equal to this one, i.e. if the angle returned by getRotationAngle() is the same for both rotations.
    double
    Returns cosine of the current rotation angle.
    static Rotation2D
    Returns a rotation by Δφ = 0.
    static Rotation2D
    getInstance(double dfi)
    Creates a rotation by Δφ = dfi argument (in radians).
    double
    Returns the current rotation angle (in radians).
    double
    Returns sine of the current rotation angle.
    int
    Returns the hash code for this rotation.
    static double
    normalizeAngle(double fi)
    Returns the "normalized" equivalent of the passed angle φ: the such angle φ0, that 0<=φ0<2π and φ=φ0+2kπ for some integer k=...,-2,-1,0,1,2,...
    static double
    Returns the "normalized" equivalent of the passed angle φ: the such angle φ0, that 0<=φ0<π and φ=φ0+kπ for some integer k=...,-2,-1,0,1,2,....
    Returns some string representation of this object.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • getInstance

      public static Rotation2D getInstance()
      Returns a rotation by Δφ = 0.
    • getInstance

      public static Rotation2D getInstance(double dfi)
      Creates a rotation by Δφ = dfi argument (in radians).
    • getRotationAngle

      public double getRotationAngle()
      Returns the current rotation angle (in radians).
    • getCosine

      public double getCosine()
      Returns cosine of the current rotation angle.
    • getSine

      public double getSine()
      Returns sine of the current rotation angle.
    • toString

      public String toString()
      Returns some string representation of this object.
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Returns the hash code for this rotation.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Indicates whether some other rotation is equal to this one, i.e. if the angle returned by getRotationAngle() is the same for both rotations.

      Note: if the difference between rotations is 2kπ, the rotations are not considered to be equal.

      Overrides:
      equals in class Object
    • clone

      public Object clone()
      Returns this instance (possible solution as this class is immutable).
      Overrides:
      clone in class Object
    • normalizeAngle

      public static double normalizeAngle(double fi)
      Returns the "normalized" equivalent of the passed angle φ: the such angle φ0, that 0<=φ0<2π and φ=φ0+2kπ for some integer k=...,-2,-1,0,1,2,...
    • normalizeAngleLessPI

      public static double normalizeAngleLessPI(double fi)
      Returns the "normalized" equivalent of the passed angle φ: the such angle φ0, that 0<=φ0<π and φ=φ0+kπ for some integer k=...,-2,-1,0,1,2,....