Package georegression.metric
Class ClosestPoint2D_F64
java.lang.Object
georegression.metric.ClosestPoint2D_F64
Functions related to finding the closest point(s) on one shape from another shape.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Point2D_F64
closestPoint
(EllipseRotated_F64 ellipse, Point2D_F64 p) Computes the closest point on an ellipse to the provided point.static Point2D_F64
closestPoint
(LineGeneral2D_F64 line, Point2D_F64 p, @Nullable Point2D_F64 output) Finds the closest point on 'line' to the specified point.static Point2D_F64
closestPoint
(LineParametric2D_F64 line, Point2D_F64 p, @Nullable Point2D_F64 output) Finds the closest point on 'line' to the specified point.static Point2D_F64
closestPoint
(LineSegment2D_F64 line, Point2D_F64 p, @Nullable Point2D_F64 output) Finds the closest point on the line segment to the provided point 'p'.static double
closestPointT
(LineParametric2D_F64 line, double x, double y) Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX, slopeY]static double
closestPointT
(LineParametric2D_F64 line, double x, double y, double scale) Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX, slopeY]static double
closestPointT
(LineParametric2D_F64 line, Point2D_F64 p) Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX, slopeY]static double
closestPointT
(LineParametric2D_F64 line, Point2D_F64 p, double scale) Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX/scale, slopeY/scale]
-
Constructor Details
-
ClosestPoint2D_F64
public ClosestPoint2D_F64()
-
-
Method Details
-
closestPoint
public static Point2D_F64 closestPoint(LineGeneral2D_F64 line, Point2D_F64 p, @Nullable @Nullable Point2D_F64 output) Finds the closest point on 'line' to the specified point.
- Parameters:
line
- Line along which the closest point is to be found.p
- Point.output
- Where the solution is stored. If null a new instance is created. Modified.- Returns:
- Closest point on the line.
-
closestPoint
public static Point2D_F64 closestPoint(LineParametric2D_F64 line, Point2D_F64 p, @Nullable @Nullable Point2D_F64 output) Finds the closest point on 'line' to the specified point.
- Parameters:
line
- Line along which the closest point is being found.p
- Point.output
- Where the solution is stored. If null a new instance is created. Modified.- Returns:
- Closest point on the line.
-
closestPointT
Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX, slopeY]- Parameters:
line
- The line along which the closest point is being found. Not modified.p
- A point. Not modified.- Returns:
- Distance as a function of 't'
-
closestPointT
Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX/scale, slopeY/scale]- Parameters:
line
- The line along which the closest point is being found. Not modified.scale
- Scale factor. used to avoid numerical issuesp
- A point. Not modified.- Returns:
- Distance as a function of 't'
-
closestPointT
Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX, slopeY]- Parameters:
line
- The line along which the closest point is being found. Not modified.x
- Point's x-coordinatey
- Point's y-coordinate- Returns:
- Distance as a function of 't'
-
closestPointT
Computes the closest point along the line as a function of 't':
[x, y] = [x_0, y_0] + t·[slopeX, slopeY]- Parameters:
line
- The line along which the closest point is being found. Not modified.scale
- Scale factor. used to avoid numerical issuesx
- Point's x-coordinatey
- Point's y-coordinate- Returns:
- Distance as a function of 't'
-
closestPoint
public static Point2D_F64 closestPoint(LineSegment2D_F64 line, Point2D_F64 p, @Nullable @Nullable Point2D_F64 output) Finds the closest point on the line segment to the provided point 'p'.- Parameters:
line
- Line segmentp
- Point`output
- Optional storage for the closet point on the line to p. If null a new instance is created.- Returns:
- Closest point on the line to the point
-
closestPoint
Computes the closest point on an ellipse to the provided point. If there are multiple solutions then one is arbitrarily chosen. NOTE: When optimizing consider callingClosestPointEllipseAngle_F64
directly instead.- Parameters:
ellipse
- Ellipsep
- Point- Returns:
- Closest point on the ellipse
-