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 an Angle object beyond 360/2pi or below 0/0
(degrees/radians).
| Constructor and 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. |
| Modifier and Type | Method and Description |
|---|---|
Angle |
clone()
Overridden with public visibility as proposed in
Cloneable. |
double |
deg()
Returns the value of this
Angle object in degrees. |
boolean |
equals(java.lang.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)
|
Angle |
getCopy()
Creates and returns a copy of this
Angle. |
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 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. |
java.lang.String |
toString() |
public Angle()
Angle object initialized with 0deg/0rad.public Angle(double rad)
Angle object with the given value in radians.rad - the angle's valuepublic static Angle fromDeg(double degrees)
Angle object representing the given value. The
value is interpreted as being in degrees.degrees - the angle in degreesAngle object representing the passed-in angle given in
degreespublic static Angle fromRad(double radians)
Angle object representing the given value. The
value is interpreted as being in radians.radians - the angle in radiansAngle object representing the passed-in angle given in
radianspublic Angle clone()
Cloneable.clone in class java.lang.Objectpublic double deg()
Angle object in degrees.Angle's value in degrees.public boolean equals(java.lang.Object otherObj)
equals in class java.lang.Objectpublic Angle getCopy()
Angle.Anglepublic Angle getMultiplied(double factor)
public Angle getOppositeFull()
public Angle getOppositeSemi()
public Angle getReverse()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean isClockwise(Angle other)
other - the other angle to compare topublic double rad()
Angle's value in radians.Angle's value in radians.public Angle setDeg(double degrees)
Angle's value to the passed-in value in degrees.degrees - the angle's value in degreesthis for conveniencepublic Angle setRad(double radians)
Angle's value to the passed-in value in radians.radians - the angle's value in radiansthis for conveniencepublic java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2014 itemis AG, and others. All rights reserved.