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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Overridden with public visibility as proposed inCloneable.doubledeg()Returns the value of thisAngleobject in degrees.booleanstatic AnglefromDeg(double degrees) Constructs a newAngleobject representing the given value.static AnglefromRad(double radians) Constructs a newAngleobject representing the given value.getCopy()Creates and returns a copy of thisAngle.getDeltaCCW(Angle other) getDeltaCW(Angle other) getMultiplied(double factor) inthashCode()booleanisClockwise(Angle other) doublerad()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 newAngleobject representing the given value. The value is interpreted as being in degrees.- Parameters:
degrees- the angle in degrees- Returns:
- an
Angleobject representing the passed-in angle given in degrees
-
fromRad
Constructs a newAngleobject representing the given value. The value is interpreted as being in radians.- Parameters:
radians- the angle in radians- Returns:
- an
Angleobject representing the passed-in angle given in radians
-
clone
Overridden with public visibility as proposed inCloneable. -
deg
public double deg()Returns the value of thisAngleobject 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:
thisfor convenience
-
setRad
Sets thisAngle's value to the passed-in value in radians.- Parameters:
radians- the angle's value in radians- Returns:
thisfor convenience
-
toString
-