findClosestPointOnTriangle

Determine the closest point on the triangle with the given vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code>, <code>(v2X, v2Y, v2Z)</code> between that triangle and the given point <code>(pX, pY, pZ)</code> and store that point into the given <code>result</code>. <p> Additionally, this method returns whether the closest point is a vertex ({@link #POINT_ON_TRIANGLE_VERTEX_0}, {@link #POINT_ON_TRIANGLE_VERTEX_1}, {@link #POINT_ON_TRIANGLE_VERTEX_2}) of the triangle, lies on an edge ({@link #POINT_ON_TRIANGLE_EDGE_01}, {@link #POINT_ON_TRIANGLE_EDGE_12}, {@link #POINT_ON_TRIANGLE_EDGE_20}) or on the {@link #POINT_ON_TRIANGLE_FACE face} of the triangle. <p> Reference: Book "Real-Time Collision Detection" chapter 5.1.5 "Closest Point on Triangle to Point"

@param v0X the x coordinate of the first vertex of the triangle @param v0Y the y coordinate of the first vertex of the triangle @param v0Z the z coordinate of the first vertex of the triangle @param v1X the x coordinate of the second vertex of the triangle @param v1Y the y coordinate of the second vertex of the triangle @param v1Z the z coordinate of the second vertex of the triangle @param v2X the x coordinate of the third vertex of the triangle @param v2Y the y coordinate of the third vertex of the triangle @param v2Z the z coordinate of the third vertex of the triangle @param pX the x coordinate of the point @param pY the y coordinate of the point @param pZ the y coordinate of the point @param result will hold the closest point @return one of {@link #POINT_ON_TRIANGLE_VERTEX_0}, {@link #POINT_ON_TRIANGLE_VERTEX_1}, {@link #POINT_ON_TRIANGLE_VERTEX_2}, {@link #POINT_ON_TRIANGLE_EDGE_01}, {@link #POINT_ON_TRIANGLE_EDGE_12}, {@link #POINT_ON_TRIANGLE_EDGE_20} or {@link #POINT_ON_TRIANGLE_FACE}

  1. int findClosestPointOnTriangle(double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double pX, double pY, double pZ, Vector3d result)
    public static
    int
    findClosestPointOnTriangle
    (
    double v0X
    ,
    double v0Y
    ,
    double v0Z
    ,
    double v1X
    ,
    double v1Y
    ,
    double v1Z
    ,
    double v2X
    ,
    double v2Y
    ,
    double v2Z
    ,
    double pX
    ,
    double pY
    ,
    double pZ
    ,)
  2. int findClosestPointOnTriangle(Vector3d v0, Vector3d v1, Vector3d v2, Vector3d p, Vector3d result)
  3. int findClosestPointOnTriangle(double v0X, double v0Y, double v1X, double v1Y, double v2X, double v2Y, double pX, double pY, Vector2d result)
  4. int findClosestPointOnTriangle(Vector2d v0, Vector2d v1, Vector2d v2, Vector2d p, Vector2d result)

Meta