Class ClosestPoint3D_F64

java.lang.Object
georegression.metric.ClosestPoint3D_F64

public class ClosestPoint3D_F64 extends Object
Functions related to finding the closest point(s) on one shape from another shape.
  • Constructor Details

    • ClosestPoint3D_F64

      public ClosestPoint3D_F64()
  • Method Details

    • closestPoint

      @Nullable public static @Nullable Point3D_F64 closestPoint(LineParametric3D_F64 l0, LineParametric3D_F64 l1, @Nullable @Nullable Point3D_F64 ret)
      Returns the point which minimizes the distance between the two lines in 3D. If the two lines are parallel the result is undefined.
      Parameters:
      l0 - first line. Not modified.
      l1 - second line. Not modified.
      ret - (Optional) Storage for the closest point. If null a new point is declared. Modified.
      Returns:
      Closest point between two lines.
    • closestPoint

      public static Point4D_F64 closestPoint(LineParametric3D_F64 l0, LineParametric3D_F64 l1, @Nullable @Nullable Point4D_F64 ret)
      Returns the homogenous point which minimizes the distance between the two lines in 3D. Since the results are computed in homogenous coordinates an intersection at infinity can be handled.
      Parameters:
      l0 - first line. Not modified.
      l1 - second line. Not modified.
      ret - (Optional) Storage for the closest point. If null a new point is declared. Modified.
      Returns:
      Closest point between two lines in homogenous coordinates
    • closestPoints

      public static boolean closestPoints(LineParametric3D_F64 l0, LineParametric3D_F64 l1, double[] param)

      Finds the closest point on line lo to l1 and on l1 to l0. The solution is returned in 'param' as a value of 't' for each line.

      point on l0 = l0.a + param[0]*l0.slope
      point on l1 = l1.a + param[1]*l1.slope

      Parameters:
      l0 - first line. Not modified.
      l1 - second line. Not modified.
      param - param[0] for line0 location and param[1] for line1 location.
      Returns:
      False if the lines are parallel or true if a solution was found.
    • closestPoint

      public static Point3D_F64 closestPoint(LineParametric3D_F64 line, Point3D_F64 pt, @Nullable @Nullable Point3D_F64 ret)
      Finds the closest point on a line to the specified point.
      Parameters:
      line - Line on which the closest point is being found. Not modified.
      pt - The point whose closest point is being looked for. Not modified.
      ret - Storage for the solution. Can be same as instance as 'pt'. If null is passed in a new point is created. Modified.
    • closestPoint

      public static double closestPoint(LineParametric3D_F64 line, Point3D_F64 pt)
      Finds the closest point on a line to the specified point as a function of distance along the line. The 3D coordinate of the point at 'd', the returned value, is P = (x,y,z) + (slope.x,slope.y,slope.z)*d.
      Parameters:
      line - Line on which the closest point is being found. Not modified.
      pt - The point whose closest point is being looked for. Not modified.
      Returns:
      The location 'd' along the line of the closeset point
    • closestPoint

      public static Point3D_F64 closestPoint(PlaneNormal3D_F64 plane, Point3D_F64 point, @Nullable @Nullable Point3D_F64 found)
      Finds the closest point on the plane to the specified point.
      Parameters:
      plane - The plane
      point - The point
      found - (Optional) Storage for the closest point. If null a new point is declared internally.
      Returns:
      The closest point
    • closestPoint

      public static Point3D_F64 closestPoint(PlaneGeneral3D_F64 plane, Point3D_F64 point, @Nullable @Nullable Point3D_F64 found)
      Finds the closest point on the plane to the specified point.
      Parameters:
      plane - The plane
      point - The point
      found - (Optional) Storage for the closest point. Can be same as instance as 'pt'. If null a new point is declared internally.
      Returns:
      The closest point
    • closestPointOrigin

      public static Point3D_F64 closestPointOrigin(PlaneGeneral3D_F64 plane, @Nullable @Nullable Point3D_F64 found)
      Finds the closest point on the plane to the origin.
      Parameters:
      plane - The plane
      found - (Optional) Storage for the closest point. Can be same as instance as 'pt'. If null a new point is declared internally.
      Returns:
      The closest point
    • closestPoint

      public static Point3D_F64 closestPoint(LineSegment3D_F64 line, Point3D_F64 pt, @Nullable @Nullable Point3D_F64 ret)
      Finds the closest point on a line segment to the specified point.
      Parameters:
      line - Line on which the closest point is being found. Not modified.
      pt - The point whose closest point is being looked for. Not modified.
      ret - (Optional) Storage for the solution. Can be same as instance as 'pt'. If null is passed in a new point is created. Modified.
      Returns:
      The closest point
    • closestPoint

      @Nullable public static @Nullable Point3D_F64 closestPoint(LineSegment3D_F64 l0, LineSegment3D_F64 l1, @Nullable @Nullable Point3D_F64 ret)
      Find the point which minimizes its distance from the two line segments.
      Parameters:
      l0 - First line. Not modified.
      l1 - Second line. Not modified.
      ret - (Optional) Storage for the solution. Can be same as instance as 'pt'. If null is passed in a new point is created. Modified.
      Returns:
      The closest point
    • closestPoint

      public static Point3D_F64 closestPoint(Point3D_F64 vertexA, Point3D_F64 vertexB, Point3D_F64 vertexC, Point3D_F64 point, @Nullable @Nullable Point3D_F64 ret)
      Closest point from a 3D triangle to a point.
      Parameters:
      vertexA - Vertex in a 3D triangle.
      vertexB - Vertex in a 3D triangle.
      vertexC - Vertex in a 3D triangle.
      point - Point for which the closest point on the triangle is found
      ret - (Optional) Storage for the solution. If null is passed in a new point is created. Modified.
      Returns:
      The closest point
      See Also:
    • closestPointT

      public static double closestPointT(LineParametric3D_F64 line, PlaneNormal3D_F64 plane)

      Computes the closest point along the line to the plane as a function of 't':
      [x, y, z] = [x_0, y_0, z_0] + t·[slopeX, slopeY, slopZ]

      If there is no intersection then Double.NaN is returned.
      Parameters:
      line - The line along which the closest point is being found. Not modified.
      plane - Plane being checked for intersection
      Returns:
      Distance as a function of 't'. NaN if there is no intersection.