Class ClosestPoint2D_F64

java.lang.Object
georegression.metric.ClosestPoint2D_F64

public class ClosestPoint2D_F64 extends Object
Functions related to finding the closest point(s) on one shape from another shape.
  • 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

      public 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]

      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

      public 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]

      Parameters:
      line - The line along which the closest point is being found. Not modified.
      scale - Scale factor. used to avoid numerical issues
      p - A point. Not modified.
      Returns:
      Distance as a function of 't'
    • closestPointT

      public 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]

      Parameters:
      line - The line along which the closest point is being found. Not modified.
      x - Point's x-coordinate
      y - Point's y-coordinate
      Returns:
      Distance as a function of 't'
    • closestPointT

      public 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]

      Parameters:
      line - The line along which the closest point is being found. Not modified.
      scale - Scale factor. used to avoid numerical issues
      x - Point's x-coordinate
      y - 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 segment
      p - 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

      public static Point2D_F64 closestPoint(EllipseRotated_F64 ellipse, Point2D_F64 p)
      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 calling ClosestPointEllipseAngle_F64 directly instead.
      Parameters:
      ellipse - Ellipse
      p - Point
      Returns:
      Closest point on the ellipse