math.geom2d
Class Angle2D
- java.lang.Object
-
- math.geom2d.Angle2D
-
public class Angle2D extends java.lang.ObjectThis class is only devoted to static computations.
-
-
Field Summary
Fields Modifier and Type Field and Description static doubleM_2PIThe constant for 2*PI, equivalent to 360 degrees.static doubleM_3PI_2The constant for 3*PI/2, equivalent to 270 degrees.static doubleM_PIThe constant for PI, equivalent to 180 degrees.static doubleM_PI_2The constant for PI/2, equivalent to 90 degrees.static doubleM_PI_4The constant for 3*PI/4, equivalent to 45 degrees.
-
Constructor Summary
Constructors Constructor and Description Angle2D()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static doubleabsoluteAngle(double x1, double y1, double x2, double y2, double x3, double y3)Returns the absolute angle between the ray formed by (p2, p1) and the ray formed by (p2, p3), where pi = (xi,yi), i=1,2,3.static doubleabsoluteAngle(Point2D p1, Point2D p2, Point2D p3)Returns the absolute angle between the ray formed by (p2, p1) and the ray formed by (p2, p3).static booleanalmostEquals(double angle1, double angle2, double eps)Checks whether two angles are equal, with respect to the given error bound.static doubleangle(double x1, double y1, double x2, double y2, double x3, double y3)Returns the oriented angle between the ray formed by (p2, p1) and the ray formed by (p2, p3), where pi = (xi,yi), i=1,2,3.static doubleangle(LinearShape2D obj1, LinearShape2D obj2)Returns the oriented angle between two (directed) straight objects.static doubleangle(Point2D p1, Point2D p2, Point2D p3)Returns the oriented angle between the ray formed by (p2, p1) and the ray formed by (p2, p3).static doubleangle(Vector2D vect1, Vector2D vect2)Returns the oriented angle between two vectors.static booleancontainsAngle(double startAngle, double endAngle, double angle)Tests if an angle belongs to an angular interval, defined by two limit angle, counted Counter-clockwise.static booleancontainsAngle(double startAngle, double endAngle, double angle, boolean direct)Tests if an angle belongs to an angular interval, defined by two limit angles, and an orientation flag.static booleanequals(double angle1, double angle2)Checks whether two angles are equal, given a default threshold value.static doubleformatAngle(double angle)Formats an angle between 0 and 2*PI.static doublehorizontalAngle(double x, double y)Returns the horizontal angle formed by the line joining the origin and the point with given coordinate.static doublehorizontalAngle(double x1, double y1, double x2, double y2)Returns the horizontal angle formed by the line joining the two given points.static doublehorizontalAngle(LinearShape2D object)Returns the horizontal angle formed by the line joining the two given points.static doublehorizontalAngle(Point2D point)Returns the horizontal angle formed by the line joining the origin and the given point.static doublehorizontalAngle(Point2D p1, Point2D p2)Returns the horizontal angle formed by the line joining the two given points.static doublehorizontalAngle(Vector2D vect)Returns the horizontal angle formed by the line joining the origin and the point with given coordinate.static doublepseudoAngle(Point2D p1, Point2D p2)Computes the pseudo-angle of a line joining the 2 points.
-
-
-
Field Detail
-
M_PI
public static final double M_PI
The constant for PI, equivalent to 180 degrees.- See Also:
- Constant Field Values
-
M_2PI
public static final double M_2PI
The constant for 2*PI, equivalent to 360 degrees.- See Also:
- Constant Field Values
-
M_PI_2
public static final double M_PI_2
The constant for PI/2, equivalent to 90 degrees.- See Also:
- Constant Field Values
-
M_3PI_2
public static final double M_3PI_2
The constant for 3*PI/2, equivalent to 270 degrees.- See Also:
- Constant Field Values
-
M_PI_4
public static final double M_PI_4
The constant for 3*PI/4, equivalent to 45 degrees.- See Also:
- Constant Field Values
-
-
Method Detail
-
formatAngle
public static double formatAngle(double angle)
Formats an angle between 0 and 2*PI.- Parameters:
angle- the angle before formatting- Returns:
- the same angle, between 0 and 2*PI.
-
horizontalAngle
public static double horizontalAngle(Point2D point)
Returns the horizontal angle formed by the line joining the origin and the given point.
-
horizontalAngle
public static double horizontalAngle(double x, double y)Returns the horizontal angle formed by the line joining the origin and the point with given coordinate.
-
horizontalAngle
public static double horizontalAngle(Vector2D vect)
Returns the horizontal angle formed by the line joining the origin and the point with given coordinate.
-
horizontalAngle
public static double horizontalAngle(LinearShape2D object)
Returns the horizontal angle formed by the line joining the two given points.
-
horizontalAngle
public static double horizontalAngle(Point2D p1, Point2D p2)
Returns the horizontal angle formed by the line joining the two given points.
-
horizontalAngle
public static double horizontalAngle(double x1, double y1, double x2, double y2)Returns the horizontal angle formed by the line joining the two given points.
-
pseudoAngle
public static double pseudoAngle(Point2D p1, Point2D p2)
Computes the pseudo-angle of a line joining the 2 points. The pseudo-angle has same ordering property has natural angle, but is expected to be computed faster. The result is given between 0 and 360.
- Parameters:
p1- the initial pointp2- the final point- Returns:
- the pseudo angle of line joining p1 to p2
-
angle
public static double angle(LinearShape2D obj1, LinearShape2D obj2)
Returns the oriented angle between two (directed) straight objects. Result is given in radians, between 0 and 2*PI.
-
angle
public static double angle(Vector2D vect1, Vector2D vect2)
Returns the oriented angle between two vectors. Result is given in radians, between 0 and 2*PI.
-
angle
public static double angle(Point2D p1, Point2D p2, Point2D p3)
Returns the oriented angle between the ray formed by (p2, p1) and the ray formed by (p2, p3). Result is given in radians, between 0 and 2*PI.
-
angle
public static double angle(double x1, double y1, double x2, double y2, double x3, double y3)Returns the oriented angle between the ray formed by (p2, p1) and the ray formed by (p2, p3), where pi = (xi,yi), i=1,2,3. Result is given in radians, between 0 and 2*PI.
-
absoluteAngle
public static double absoluteAngle(Point2D p1, Point2D p2, Point2D p3)
Returns the absolute angle between the ray formed by (p2, p1) and the ray formed by (p2, p3). Result is given in radians, between 0 and PI.
-
absoluteAngle
public static double absoluteAngle(double x1, double y1, double x2, double y2, double x3, double y3)Returns the absolute angle between the ray formed by (p2, p1) and the ray formed by (p2, p3), where pi = (xi,yi), i=1,2,3. Result is given in radians, between 0 and PI.
-
almostEquals
public static boolean almostEquals(double angle1, double angle2, double eps)Checks whether two angles are equal, with respect to the given error bound.- Parameters:
angle1- first angle to compareangle2- second angle to compareeps- the threshold value for comparison- Returns:
- true if the two angle are equal modulo 2*PI
-
equals
public static boolean equals(double angle1, double angle2)Checks whether two angles are equal, given a default threshold value.- Parameters:
angle1- first angle to compareangle2- second angle to compare- Returns:
- true if the two angle are equal modulo 2*PI
-
containsAngle
public static boolean containsAngle(double startAngle, double endAngle, double angle)Tests if an angle belongs to an angular interval, defined by two limit angle, counted Counter-clockwise.- Parameters:
startAngle- the beginning of the angular domainendAngle- the end of the angular domainangle- the angle to test- Returns:
- true if angle is between the 2 limits
-
containsAngle
public static boolean containsAngle(double startAngle, double endAngle, double angle, boolean direct)Tests if an angle belongs to an angular interval, defined by two limit angles, and an orientation flag.- Parameters:
startAngle- the beginning of the angular domainendAngle- the end of the angular domainangle- the angle to testdirect- is true if angular domain is oriented Counter clockwise, and false if angular domain is oriented clockwise.- Returns:
- true if angle is between the 2 limits
-
-
DMelt 3.0 © DataMelt by jWork.ORG