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
The value of Pi/2
|
static double |
PI_OVER_4
The value of Pi/4
|
static double |
PI_TIMES_2
The value of 2*Pi
|
| Modifier and Type | Method and Description |
|---|---|
static double |
angle(Coordinate p)
Returns the angle of the vector from (0,0) to p,
relative to the positive X-axis.
|
static double |
angle(Coordinate p0,
Coordinate p1)
Returns the angle of the vector from p0 to p1,
relative to the positive X-axis.
|
static double |
angleBetween(Coordinate tip1,
Coordinate tail,
Coordinate tip2)
Returns the unoriented smallest angle between two vectors.
|
static double |
angleBetweenOriented(Coordinate tip1,
Coordinate tail,
Coordinate tip2)
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 p0,
Coordinate p1,
Coordinate p2)
Computes the interior angle between two segments of a ring.
|
static boolean |
isAcute(Coordinate p0,
Coordinate p1,
Coordinate p2)
Tests whether the angle between p0-p1-p2 is acute.
|
static boolean |
isObtuse(Coordinate p0,
Coordinate p1,
Coordinate p2)
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 radianspublic static double toRadians(double angleDegrees)
angleDegrees - an angle in degreespublic static double angle(Coordinate p0, Coordinate p1)
p0 - the initial point of the vectorp1 - the terminal point of the vectorpublic static double angle(Coordinate p)
p - the terminal point of the vectorpublic static boolean isAcute(Coordinate p0, Coordinate p1, Coordinate p2)
Note: this implementation is not precise (deterministic) for angles very close to 90 degrees.
p0 - an endpoint of the anglep1 - the base of the anglep2 - the other endpoint of the anglepublic static boolean isObtuse(Coordinate p0, Coordinate p1, Coordinate p2)
Note: this implementation is not precise (deterministic) for angles very close to 90 degrees.
p0 - an endpoint of the anglep1 - the base of the anglep2 - the other endpoint of the anglepublic static double angleBetween(Coordinate tip1, Coordinate tail, Coordinate tip2)
tip1 - the tip of one vectortail - the tail of each vectortip2 - the tip of the other vectorpublic static double angleBetweenOriented(Coordinate tip1, Coordinate tail, Coordinate tip2)
tip1 - the tip of v1tail - the tail of each vectortip2 - the tip of v2public static double interiorAngle(Coordinate p0, Coordinate p1, Coordinate p2)
p0 - a point of the ringp1 - the next point of the ringp2 - the next point of the ringp1public 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 normalizepublic static double normalizePositive(double angle)
angle - the angle to normalize, in radianspublic 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] )Copyright © 2020. All rights reserved.