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.SerializableAn
Angleobject 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
Angleobject is normalized. That means, you will never encounter anAngleobject 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 Angleclone()Overridden with public visibility as proposed inCloneable.doubledeg()Returns the value of thisAngleobject in degrees.booleanequals(java.lang.Object otherObj)static AnglefromDeg(double degrees)Constructs a newAngleobject representing the given value.static AnglefromRad(double radians)Constructs a newAngleobject representing the given value.AnglegetAdded(Angle other)AnglegetCopy()Creates and returns a copy of thisAngle.AnglegetDeltaCCW(Angle other)AnglegetDeltaCW(Angle other)AnglegetMultiplied(double factor)AnglegetOppositeFull()AnglegetOppositeSemi()AnglegetReverse()inthashCode()booleanisClockwise(Angle other)doublerad()Returns thisAngle's value in radians.AnglesetDeg(double degrees)Sets thisAngle's value to the passed-in value in degrees.AnglesetRad(double radians)Sets thisAngle's value to the passed-in value in radians.java.lang.StringtoString()
-
-
-
Method Detail
-
fromDeg
public static Angle fromDeg(double degrees)
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
public static Angle fromRad(double radians)
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
public Angle clone()
Overridden with public visibility as proposed inCloneable.- Overrides:
clonein classjava.lang.Object
-
deg
public double deg()
Returns the value of thisAngleobject in degrees.- Returns:
- this
Angle's value in degrees.
-
equals
public boolean equals(java.lang.Object otherObj)
- Overrides:
equalsin 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:
hashCodein 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:
thisfor 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:
thisfor convenience
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-