Package org.eclipse.gef.geometry.euclidean

# Class Angle

java.lang.Object
org.eclipse.gef.geometry.euclidean.Angle

All Implemented Interfaces:
  `Serializable`, `Cloneable`

public class Angle extends Object implements Cloneable, 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 an `Angle` object beyond 360/2pi or below 0/0 (degrees/radians).

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`Angle()`
Constructs a new `Angle` object initialized with 0deg/0rad.
`Angle(double rad)`
Constructs a new `Angle` object with the given value in radians.

## Method Summary

Modifier and Type
Method
Description
`Angle`
`clone()`
Overridden with public visibility as proposed in `Cloneable`.
`double`
`deg()`
Returns the value of this `Angle` object in degrees.
`boolean`
`equals(Object otherObj)`
`static Angle`
`fromDeg(double degrees)`
Constructs a new `Angle` object representing the given value.
`static Angle`
`fromRad(double radians)`
Constructs a new `Angle` object representing the given value.
`Angle`
`getAdded(Angle other)`
Returns the sum of this and the given other `Angle` object as a new `Angle` object.
`Angle`
`getCopy()`
Creates and returns a copy of this `Angle`.
`Angle`
`getDeltaCCW(Angle other)`
Returns the difference between this `Angle` and another `Angle` in a counter-clockwise direction
`Angle`
`getDeltaCW(Angle other)`
Returns the difference between this `Angle` and another `Angle` in a clockwise direction
`Angle`
`getMultiplied(double factor)`
Returns a new `Angle` object representing this `Angle` multiplied by the given factor.
`Angle`
`getOppositeFull()`
Returns the opposite `Angle` of this `Angle` in a full circle as a new `Angle` object.
`Angle`
`getOppositeSemi()`
Returns the opposite `Angle` of this `Angle` in a semi-circle as a new `Angle` object.
`Angle`
`getReverse()`
Returns the reverse `Angle` of this `Angle` in a full circle as a new `Angle` object.
`int`
`hashCode()`
`boolean`
`isClockwise(Angle other)`
Tests if the other `Angle` is within a half-circle clockwise rotation from this `Angle`
`double`
`rad()`
Returns this `Angle`'s value in radians.
`Angle`
`setDeg(double degrees)`
Sets this `Angle`'s value to the passed-in value in degrees.
`Angle`
`setRad(double radians)`
Sets this `Angle`'s value to the passed-in value in radians.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Angle

public Angle()
Constructs a new `Angle` object initialized with 0deg/0rad.

### Angle

public Angle(double rad)
Constructs a new `Angle` object with the given value in radians.

Parameters:
  `rad` - the angle's value

## Method Details

### fromDeg

public static Angle fromDeg(double degrees)
Constructs a new `Angle` 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 new `Angle` 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 in `Cloneable`.

Overrides:
  `clone` in class `Object`

### deg

public double deg()
Returns the value of this `Angle` object in degrees.

Returns:
  this `Angle`'s value in degrees.

### equals

public boolean equals(Object otherObj)

Overrides:
  `equals` in class `Object`

### getAdded

public Angle getAdded(Angle other)
Returns the sum of this and the given other `Angle` object as a new `Angle` object.

Parameters:
  `other` - the `Angle` to add
Returns:
  the sum of this and the given other `Angle` as a new `Angle` object

### getCopy

public Angle getCopy()
Creates and returns a copy of this `Angle`.

Returns:
  a copy of this `Angle`

### getDeltaCCW

public Angle getDeltaCCW(Angle other)
Returns the difference between this `Angle` and another `Angle` in a counter-clockwise direction

Parameters:
  `other` - the other angle to compare to
Returns:
  the difference between this `Angle` and another `Angle` in a counter-clockwise direction

### getDeltaCW

public Angle getDeltaCW(Angle other)
Returns the difference between this `Angle` and another `Angle` in a clockwise direction

Parameters:
  `other` - the other angle to compare to
Returns:
  the difference between this `Angle` and another `Angle` in a clockwise direction

### getMultiplied

public Angle getMultiplied(double factor)
Returns a new `Angle` object representing this `Angle` multiplied by the given factor.

Parameters:
  `factor` - the multiplication factor
Returns:
  a new `Angle` object representing this `Angle` multiplied by the given factor

### getOppositeFull

public Angle getOppositeFull()
Returns the opposite `Angle` of this `Angle` in a full circle as a new `Angle` object.

Returns:
  the opposite `Angle` of this `Angle` in a full circle as a new `Angle` object

### getOppositeSemi

public Angle getOppositeSemi()
Returns the opposite `Angle` of this `Angle` in a semi-circle as a new `Angle` object.

Returns:
  the opposite `Angle` of this `Angle` in a semi-circle as a new `Angle` object

### getReverse

public Angle getReverse()
Returns the reverse `Angle` of this `Angle` in a full circle as a new `Angle` object.

Returns:
  the reverse `Angle` of this `Angle` in a full circle as a new `Angle` object

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### isClockwise

public boolean isClockwise(Angle other)
Tests if the other `Angle` is within a half-circle clockwise rotation from this `Angle`

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 this `Angle`'s value in radians.

Returns:
  This `Angle`'s value in radians.

### setDeg

public Angle setDeg(double degrees)
Sets this `Angle`'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 this `Angle`'s value to the passed-in value in radians.

Parameters:
  `radians` - the angle's value in radians
Returns:
  `this` for convenience

### toString

public String toString()

Overrides:
  `toString` in class `Object`