Class Angle
- java.lang.Object
-
- org.eclipse.gef.geometry.euclidean.Angle
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class Angle extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
An
Angle
object abstracts the angle's unit. It provides a simple interface to construct it from degrees or radians. Additionally, some useful calculations are implemented. But for sine/cosine/tangent calculations you may use the Math package.Every
Angle
object is normalized. That means, you will never encounter anAngle
object beyond 360/2pi or below 0/0 (degrees/radians).- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Angle
clone()
Overridden with public visibility as proposed inCloneable
.double
deg()
Returns the value of thisAngle
object in degrees.boolean
equals(java.lang.Object otherObj)
static Angle
fromDeg(double degrees)
Constructs a newAngle
object representing the given value.static Angle
fromRad(double radians)
Constructs a newAngle
object representing the given value.Angle
getAdded(Angle other)
Angle
getCopy()
Creates and returns a copy of thisAngle
.Angle
getDeltaCCW(Angle other)
Angle
getDeltaCW(Angle other)
Angle
getMultiplied(double factor)
Angle
getOppositeFull()
Angle
getOppositeSemi()
Angle
getReverse()
int
hashCode()
boolean
isClockwise(Angle other)
double
rad()
Returns thisAngle
's value in radians.Angle
setDeg(double degrees)
Sets thisAngle
's value to the passed-in value in degrees.Angle
setRad(double radians)
Sets thisAngle
's value to the passed-in value in radians.java.lang.String
toString()
-
-
-
Method Detail
-
fromDeg
public static Angle fromDeg(double degrees)
Constructs a newAngle
object representing the given value. The value is interpreted as being in degrees.- Parameters:
degrees
- the angle in degrees- Returns:
- an
Angle
object representing the passed-in angle given in degrees
-
fromRad
public static Angle fromRad(double radians)
Constructs a newAngle
object representing the given value. The value is interpreted as being in radians.- Parameters:
radians
- the angle in radians- Returns:
- an
Angle
object representing the passed-in angle given in radians
-
clone
public Angle clone()
Overridden with public visibility as proposed inCloneable
.- Overrides:
clone
in classjava.lang.Object
-
deg
public double deg()
Returns the value of thisAngle
object in degrees.- Returns:
- this
Angle
's value in degrees.
-
equals
public boolean equals(java.lang.Object otherObj)
- Overrides:
equals
in classjava.lang.Object
-
getCopy
public Angle getCopy()
Creates and returns a copy of thisAngle
.- Returns:
- a copy of this
Angle
-
getMultiplied
public Angle getMultiplied(double factor)
-
getOppositeFull
public Angle getOppositeFull()
-
getOppositeSemi
public Angle getOppositeSemi()
-
getReverse
public Angle getReverse()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
isClockwise
public boolean isClockwise(Angle other)
- Parameters:
other
- the other angle to compare to- Returns:
- true if the a clockwise rotation to the other angle is less than 180deg
-
rad
public double rad()
Returns thisAngle
's value in radians.- Returns:
- This
Angle
's value in radians.
-
setDeg
public Angle setDeg(double degrees)
Sets thisAngle
's value to the passed-in value in degrees.- Parameters:
degrees
- the angle's value in degrees- Returns:
this
for convenience
-
setRad
public Angle setRad(double radians)
Sets thisAngle
's value to the passed-in value in radians.- Parameters:
radians
- the angle's value in radians- Returns:
this
for convenience
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-