public class Angle extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CLOCKWISE
Constant representing clockwise orientation
|
static int |
COUNTERCLOCKWISE
Constant representing counterclockwise orientation
|
static int |
NONE
Constant representing no orientation
|
static double |
PI_OVER_2
|
static double |
PI_OVER_4
|
static double |
PI_TIMES_2
|
| Constructor and Description |
|---|
Angle()
|
| Modifier and Type | Method and Description |
|---|---|
static double |
angle(Coordinate
Returns the angle that the vector from (0,0) to p, relative to the positive X-axis.
|
static double |
angle(Coordinate
Returns the angle of the vector from p0 to p1, relative to the positive X-axis.
|
static double |
angleBetween(Coordinate
Returns the unoriented smallest angle between two vectors.
|
static double |
angleBetweenOriented(Coordinate
Returns the oriented smallest angle between two vectors.
|
static double |
diff(double ang1, double ang2)
Computes the unoriented smallest difference between two angles.
|
static int |
getTurn(double ang1, double ang2)
Returns whether an angle must turn clockwise or counterclockwise to overlap another angle.
|
static double |
interiorAngle(Coordinate
Computes the interior angle between two segments of a ring.
|
static boolean |
isAcute(Coordinate
Tests whether the angle between p0-p1-p2 is acute.
|
static boolean |
isObtuse(Coordinate
Tests whether the angle between p0-p1-p2 is obtuse.
|
static double |
normalize(double angle)
Computes the normalized value of an angle, which is the equivalent angle in the range ( -Pi, Pi ].
|
static double |
normalizePositive(double angle)
Computes the normalized positive value of an angle, which is the equivalent angle in the range [ 0, 2*Pi ).
|
static double |
toDegrees(double radians)
Converts from radians to degrees.
|
static double |
toRadians(double angleDegrees)
Converts from degrees to radians.
|
public static final double PI_TIMES_2
public static final double PI_OVER_2
public static final double PI_OVER_4
public static final int COUNTERCLOCKWISE
public static final int CLOCKWISE
public static final int NONE
public static double toDegrees(double radians)
radians - an angle in radians
public static double toRadians(double angleDegrees)
angleDegrees - an angle in degrees
public static double angle(Coordinatep0, Coordinate p1)
public static double angle(Coordinatep)
public static boolean isAcute(Coordinatep0, Coordinate p1, Coordinate p2)
Note: this implementation is not precise (determistic) for angles very close to 90 degrees.
p0 - an endpoint of the angle
p1 - the base of the angle
p2 - the other endpoint of the angle
public static boolean isObtuse(Coordinatep0, Coordinate p1, Coordinate p2)
Note: this implementation is not precise (determistic) for angles very close to 90 degrees.
p0 - an endpoint of the angle
p1 - the base of the angle
p2 - the other endpoint of the angle
public static double angleBetween(Coordinatetip1, Coordinate tail, Coordinate tip2)
tip1 - the tip of one vector
tail - the tail of each vector
tip2 - the tip of the other vector
public static double angleBetweenOriented(Coordinatetip1, Coordinate tail, Coordinate tip2)
tip1 - the tip of v1
tail - the tail of each vector
tip2 - the tip of v2
public static double interiorAngle(Coordinatep0, Coordinate p1, Coordinate p2)
p0 - a point of the ring
p1 - the next point of the ring
p2 - the next point of the ring
p1
public static int getTurn(double ang1,
double ang2)
ang1 - an angle (in radians)
ang2 - an angle (in radians)
public static double normalize(double angle)
angle - the angle to normalize
public static double normalizePositive(double angle)
angle - the angle to normalize, in radians
public static double diff(double ang1,
double ang2)
ang1 - the angle of one vector (in [-Pi, Pi] )
ang2 - the angle of the other vector (in range [-Pi, Pi] )