Package georegression.geometry
Class UtilLine2D_F64
java.lang.Object
georegression.geometry.UtilLine2D_F64
Various functions related to lines
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
Returns the acute angle between the slope of two lines.static double
Returns the acute angle between the slope of two lines and assumes that the lines have been normalized such that A*A + B*B = 1.static double
area2
(Point2D_F64 a, Point2D_F64 b, Point2D_F64 c) Computes a signed area for the 3 point triangle.static LineParametric2D_F64
convert
(LineGeneral2D_F64 src, @Nullable LineParametric2D_F64 ret) Converts a line from general to parametricstatic LinePolar2D_F64
convert
(LineGeneral2D_F64 src, @Nullable LinePolar2D_F64 ret) Converts a line from general to polar.static LineGeneral2D_F64
convert
(LineParametric2D_F64 src, @Nullable LineGeneral2D_F64 ret) Converts a line from parametric to generalstatic LinePolar2D_F64
convert
(LineParametric2D_F64 src, @Nullable LinePolar2D_F64 ret) Converts a line from parametric to polar.static LineGeneral2D_F64
convert
(LinePolar2D_F64 src, @Nullable LineGeneral2D_F64 ret) Converts a line from polar form to general.static LineParametric2D_F64
convert
(LinePolar2D_F64 src, @Nullable LineParametric2D_F64 ret) Converts a line from polar form to parametric.static LineGeneral2D_F64
convert
(LineSegment2D_F64 src, @Nullable LineGeneral2D_F64 ret) Converts a line segment into a general line.static LineParametric2D_F64
convert
(LineSegment2D_F64 src, @Nullable LineParametric2D_F64 ret) Converts a line segment into a parametric line.static LineParametric2D_F64
convert
(Point2D_F64 a, double angle, @Nullable LineParametric2D_F64 ret) Converts a point and angle into a parametric line.static LineGeneral2D_F64
convert
(Point2D_F64 a, Point2D_F64 b, @Nullable LineGeneral2D_F64 ret) Converts a line segment into a general line.static LineParametric2D_F64
convert
(Point2D_F64 a, Point2D_F64 b, @Nullable LineParametric2D_F64 ret) Converts a line segment into a line in parametric format.static boolean
The three points are co-linear.static boolean
The three points are co-linear.static boolean
isColinear
(Point2D_F64 a, Point2D_F64 b, Point2D_F64 c, double tol)
-
Constructor Details
-
UtilLine2D_F64
public UtilLine2D_F64()
-
-
Method Details
-
acuteAngle
Returns the acute angle between the slope of two lines. Lines do not need to ever intersect. Found using the dot product.- Parameters:
a
- (input) lineb
- (input) line- Returns:
- acute angle in radians
-
acuteAngleN
Returns the acute angle between the slope of two lines and assumes that the lines have been normalized such that A*A + B*B = 1. This avoids the need to compute the square root twice. Lines do not need to ever intersect. Found using the dot product.- Parameters:
a
- (input) normalized lineb
- (input) normalized line- Returns:
- acute angle in radians
-
convert
public static LineParametric2D_F64 convert(LinePolar2D_F64 src, @Nullable @Nullable LineParametric2D_F64 ret) Converts a line from polar form to parametric.- Parameters:
src
- (input) line is polar notationret
- (output) line in parametric notation. If null a new instance will be created.- Returns:
- Converted line in parametric notation
-
convert
public static LineGeneral2D_F64 convert(LinePolar2D_F64 src, @Nullable @Nullable LineGeneral2D_F64 ret) Converts a line from polar form to general. After conversion the line will be normalized, e.g. A*A + B*B == 1.- Parameters:
src
- (input) line is polar notationret
- (output) line in general notation. If null a new instance will be created.- Returns:
- Converted line in general notation
-
convert
public static LinePolar2D_F64 convert(LineGeneral2D_F64 src, @Nullable @Nullable LinePolar2D_F64 ret) Converts a line from general to polar.- Parameters:
src
- (input) line is general notationret
- (output) line in polar notation. If null a new instance will be created.- Returns:
- Converted line in polar notation
-
convert
public static LineParametric2D_F64 convert(LineSegment2D_F64 src, @Nullable @Nullable LineParametric2D_F64 ret) Converts a line segment into a parametric line. The start point will be 'src.a' and the direction will be in the direction of 'src.b-src.a'- Parameters:
src
- (input) line segmentret
- (output) line in parametric notation. If null a new instance will be created.- Returns:
- Converted line in parametric notation
-
convert
public static LineGeneral2D_F64 convert(LineSegment2D_F64 src, @Nullable @Nullable LineGeneral2D_F64 ret) Converts a line segment into a general line.- Parameters:
src
- (Input) line segmentret
- (output) line in general notation. If null a new instance will be created.- Returns:
- Line in general notation
-
convert
public static LineGeneral2D_F64 convert(Point2D_F64 a, Point2D_F64 b, @Nullable @Nullable LineGeneral2D_F64 ret) Converts a line segment into a general line. Line segment is defined by two points.- Parameters:
a
- (Input) End point of line segmentb
- (Input) End point of line segmentret
- (output) line in general notation. If null a new instance will be created.- Returns:
- Line in general notation
-
convert
public static LineParametric2D_F64 convert(Point2D_F64 a, Point2D_F64 b, @Nullable @Nullable LineParametric2D_F64 ret) Converts a line segment into a line in parametric format. It will point from a to b. Point a and b must be unique.- Parameters:
a
- (Input) End point of line segmentb
- (Input) End point of line segmentret
- (output) Storage for new line.. If null a new instance will be created.- Returns:
- The resulting line
-
convert
public static LineParametric2D_F64 convert(Point2D_F64 a, double angle, @Nullable @Nullable LineParametric2D_F64 ret) Converts a point and angle into a parametric line.- Parameters:
a
- (Input) Point on the lineangle
- (Input) Orientation describing the line's slope. Radians.ret
- (output) Storage for new line.. If null a new instance will be created.- Returns:
- The resulting line
-
convert
public static LinePolar2D_F64 convert(LineParametric2D_F64 src, @Nullable @Nullable LinePolar2D_F64 ret) Converts a line from parametric to polar.- Parameters:
src
- (Input) line in parametric notationret
- (output) line in polar notation. If null a new instance will be created.- Returns:
- Line in polar notation
-
convert
public static LineGeneral2D_F64 convert(LineParametric2D_F64 src, @Nullable @Nullable LineGeneral2D_F64 ret) Converts a line from parametric to general- Parameters:
src
- (input) line in parametric notation.ret
- (output) line in general notation. If null a new instance will be created.- Returns:
- Converted line in general notation
-
convert
public static LineParametric2D_F64 convert(LineGeneral2D_F64 src, @Nullable @Nullable LineParametric2D_F64 ret) Converts a line from general to parametric- Parameters:
src
- (input) line in general notation.ret
- (output) line in parametric notation. If null a new instance will be created.- Returns:
- Converted line in parametric notation
-
area2
Computes a signed area for the 3 point triangle. Useful when testing the relationship between line segments. See: Computational Geometry in C. 2nd Ed. Section 1.5- Returns:
- a signed area of the triangle
-
isColinear
-
isBetweenColinear
The three points are co-linear. Check to see if 'c' lies on the segment defined by 'a' and 'b', but if 'c' is identical to 'a' or 'b' it is between. -
isBetweenColinearExclusive
The three points are co-linear. Check to see if 'c' lies on the segment defined by 'a' and 'b', but if 'c' is identical to 'a' or 'b' it is not between.
-