Class ClosestPoint2D_F32

java.lang.Object
georegression.metric.ClosestPoint2D_F32

@Generated("georegression.metric.ClosestPoint2D_F64") public class ClosestPoint2D_F32 extends Object
Functions related to finding the closest point(s) on one shape from another shape.
  • Constructor Details

    • ClosestPoint2D_F32

      public ClosestPoint2D_F32()
  • Method Details

    • closestPoint

      public static Point2D_F32 closestPoint(LineGeneral2D_F32 line, Point2D_F32 p, @Nullable @Nullable Point2D_F32 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_F32 closestPoint(LineParametric2D_F32 line, Point2D_F32 p, @Nullable @Nullable Point2D_F32 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 float closestPointT(LineParametric2D_F32 line, Point2D_F32 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 float closestPointT(LineParametric2D_F32 line, Point2D_F32 p, float 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 float closestPointT(LineParametric2D_F32 line, float x, float 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 float closestPointT(LineParametric2D_F32 line, float x, float y, float 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_F32 closestPoint(LineSegment2D_F32 line, Point2D_F32 p, @Nullable @Nullable Point2D_F32 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_F32 closestPoint(EllipseRotated_F32 ellipse, Point2D_F32 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_F32 directly instead.
      Parameters:
      ellipse - Ellipse
      p - Point
      Returns:
      Closest point on the ellipse