Class Angle
java.lang.Object
org.eclipse.gef.geometry.euclidean.Angle
- All Implemented Interfaces:
Serializable
,Cloneable
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 an Angle
object beyond 360/2pi or below 0/0
(degrees/radians).
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Overridden with public visibility as proposed inCloneable
.double
deg()
Returns the value of thisAngle
object in degrees.boolean
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.getCopy()
Creates and returns a copy of thisAngle
.getDeltaCCW
(Angle other) getDeltaCW
(Angle other) getMultiplied
(double factor) int
hashCode()
boolean
isClockwise
(Angle other) double
rad()
Returns thisAngle
's value in radians.setDeg
(double degrees) Sets thisAngle
's value to the passed-in value in degrees.setRad
(double radians) Sets thisAngle
's value to the passed-in value in radians.toString()
-
Constructor Details
-
Method Details
-
fromDeg
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
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
Overridden with public visibility as proposed inCloneable
. -
deg
public double deg()Returns the value of thisAngle
object in degrees.- Returns:
- this
Angle
's value in degrees.
-
equals
-
getAdded
-
getCopy
Creates and returns a copy of thisAngle
.- Returns:
- a copy of this
Angle
-
getDeltaCCW
-
getDeltaCW
-
getMultiplied
-
getOppositeFull
-
getOppositeSemi
-
getReverse
-
hashCode
public int hashCode() -
isClockwise
- 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
Sets thisAngle
's value to the passed-in value in degrees.- Parameters:
degrees
- the angle's value in degrees- Returns:
this
for convenience
-
setRad
Sets thisAngle
's value to the passed-in value in radians.- Parameters:
radians
- the angle's value in radians- Returns:
this
for convenience
-
toString
-