public class Angle
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Fields are immutable - the values are fixed at construction. Thus, every calculation will construct a new object.
Modifier and Type | Field and Description |
---|---|
double |
angle
representation in radians
|
static Angle |
EAST
The angle points to the right or east.
|
static Angle |
NORTH
The angle points upward or to the north.
|
static Angle |
SOUTH
The angle points downward or to the south.
|
static Angle |
WEST
The angle points to the left or west.
|
Constructor and Description |
---|
Angle()
Constructs an Angle pointing to 0 degrees.
|
Angle(double value,
java.lang.String units)
Constructs an Angle with the given value.
|
Modifier and Type | Method and Description |
---|---|
Angle |
add(Angle a)
Rotates this Angle in clockwise direction
|
Angle |
angularDistance(Angle a)
Calculates the angular distance of a - this.
|
Angle |
clone() |
static double |
coneAngle(Angle d1,
Angle d2)
calculates the not commutative cone angle between d1 and
d2
The cone is assumed to emanate from d1 in the direction
where d2 lies closest.
|
Angle |
getNegative()
Results in a negated copy of this Angle
Be aware that negation does not necessarily point into the opposite direction
|
Angle |
getNextQuadrant()
Results in an Angle 90° in clockwise direction and normalized.
|
Angle |
getOpposite()
Results in an Angle pointing to the opposite direction.
|
Angle |
getPreviousQuadrant()
Results in an Angle 90° in anticlockwise direction and normalized.
|
double |
getValueAsDegrees()
Gives the value of this Angle in degrees.
|
double |
getValueAsRadians()
Gives the value of this Angle as radians.
|
boolean |
isPositive()
There may be unnormalized Angles.
|
Angle |
mult(double factor)
Multiplies this Angle by a given factor
|
Angle |
normalize()
Angles in degrees smaller than zero or greater than 360° are readjusted into that range.
|
Angle |
sub(Angle a)
Rotates this Angle in anticlockwise direction
|
java.lang.String |
toString()
Gets a string representation in the form "Angle:1.23°"
zurück.
|
public final double angle
public static final Angle EAST
public static final Angle NORTH
public static final Angle SOUTH
public static final Angle WEST
public Angle()
public Angle(double value, java.lang.String units)
new Angle(3.14, "Radians")
new Angle(180, "Degrees")
value
- - value of the angle to constructunits
- - defines how the value is to be treated (degrees or radians)public Angle add(Angle a)
a
- Angle to addpublic Angle angularDistance(Angle a)
a
- public Angle clone()
clone
in class java.lang.Object
public static final double coneAngle(Angle d1, Angle d2)
The cone is assumed to emanate from d1 in the direction where d2 lies closest. A clockwise direction results in a positive angle, a anticlockwise direction in a negative angle. Opposite directions result in the Angle Pi.
Note: calculation will normalize both angles.
This method is a gift from the 2SEPS project.
d1
- d2
- public Angle getNegative()
Be aware that negation does not necessarily point into the opposite direction
public Angle getNextQuadrant()
public Angle getOpposite()
public Angle getPreviousQuadrant()
public double getValueAsDegrees()
public double getValueAsRadians()
public boolean isPositive()
true
, if Angle > 0 false
, if Angle <= 0public Angle mult(double factor)
factor
- scaling factorpublic Angle normalize()
public Angle sub(Angle a)
a
- Angle to subtractpublic java.lang.String toString()
toString
in class java.lang.Object