Package com.actelion.research.util
Class Angle
- java.lang.Object
-
- com.actelion.research.util.Angle
-
public class Angle extends java.lang.Object
This class provides various operations on angles, while making sure that the values is always in the rangle from -pi >= v > pi.
-
-
Field Summary
Fields Modifier and Type Field Description double
TWO_PI
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double value)
void
add(Angle a)
static Angle
arccos(double x)
static Angle
arcsin(double x)
static Angle
arctan(double y, double x)
double
cos()
static double
difference(double a2, double a1)
Determines the normalized difference between a2 and a1, i.e.static double
difference(Angle a2, Angle a1)
Determines the normalized difference between a2 and a1, i.e.double
getValue()
boolean
isGreaterThan(Angle a)
Determines whether this angle is on the greater value side of angle a, i.e.boolean
isSmallerThan(Angle a)
Determines whether this angle is on the smaller value side of angle a, i.e.static double
mean(Angle a1, Angle a2)
Determines the mean angle between a1 and a2 on that side of the circle where a1 and a2 have the shorter connection.void
normalize()
void
setValue(double value)
double
sin()
void
subtract(double value)
void
subtract(Angle a)
double
tan()
double
toDegrees()
java.lang.String
toString()
-
-
-
Field Detail
-
TWO_PI
public final double TWO_PI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Angle
public Angle()
-
Angle
public Angle(Angle a)
-
Angle
public Angle(double value)
-
-
Method Detail
-
normalize
public void normalize()
-
toDegrees
public double toDegrees()
-
getValue
public double getValue()
-
setValue
public void setValue(double value)
-
cos
public double cos()
-
sin
public double sin()
-
tan
public double tan()
-
arcsin
public static Angle arcsin(double x)
-
arccos
public static Angle arccos(double x)
-
arctan
public static Angle arctan(double y, double x)
-
mean
public static double mean(Angle a1, Angle a2)
Determines the mean angle between a1 and a2 on that side of the circle where a1 and a2 have the shorter connection.- Parameters:
a1
-a2
-- Returns:
-
difference
public static double difference(double a2, double a1)
Determines the normalized difference between a2 and a1, i.e. the difference on that side where a1 and a2 are closer.- Parameters:
a2
-a1
-- Returns:
- signed value between -pi and +pi
-
difference
public static double difference(Angle a2, Angle a1)
Determines the normalized difference between a2 and a1, i.e. the difference on that side where a1 and a2 are closer.- Parameters:
a2
-a1
-- Returns:
- signed value between -pi and +pi
-
add
public void add(double value)
-
add
public void add(Angle a)
-
subtract
public void subtract(double value)
-
subtract
public void subtract(Angle a)
-
isSmallerThan
public boolean isSmallerThan(Angle a)
Determines whether this angle is on the smaller value side of angle a, i.e. whether it is reached faster, when walking the circle towards lower numbers.- Parameters:
a
-- Returns:
-
isGreaterThan
public boolean isGreaterThan(Angle a)
Determines whether this angle is on the greater value side of angle a, i.e. whether it is reached faster, when walking the circle towards higher numbers.- Parameters:
a
-- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-