Skip navigation links
AlgART Home
net.algart.math.geom

## Class Rotation2D

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

```public final class Rotation2D
extends java.lang.Object
implements java.lang.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.

Since:
JDK 1.0
Version:
1.0
Author:
Daniel Alievsky
• ### Method Summary

All Methods
Modifier and Type Method and Description
`java.lang.Object` `clone()`
Returns this instance (possible solution as this class is immutable).
`boolean` `equals(java.lang.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.
`double` `getCosine()`
Returns cosine of the current rotation angle.
`static Rotation2D` `getInstance()`
Returns a rotation by Δφ = 0.
`static Rotation2D` `getInstance(double dfi)`
Creates a rotation by Δφ = dfi argument (in radians).
`double` `getRotationAngle()`
Returns the current rotation angle (in radians).
`double` `getSine()`
Returns sine of the current rotation angle.
`int` `hashCode()`
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` `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,....
`java.lang.String` `toString()`
Returns some string representation of this object.
• ### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Method Detail

• #### 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 java.lang.String toString()`
Returns some string representation of this object.
Overrides:
`toString` in class `java.lang.Object`
• #### hashCode

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

`public boolean equals(java.lang.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 `java.lang.Object`
• #### clone

`public java.lang.Object clone()`
Returns this instance (possible solution as this class is immutable).
Overrides:
`clone` in class `java.lang.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,....