intersectPolygonRay

Determine whether the polygon specified by the given sequence of <code>(x, y)</code> coordinate pairs intersects with the ray with given origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code>, and store the point of intersection into the given vector <code>p</code>. <p> If the polygon intersects the ray, this method returns the index of the polygon edge intersecting the ray, that is, the index of the first vertex of the directed line segment. The second vertex is always that index + 1, modulus the number of polygon vertices.

@param verticesXY the sequence of <code>(x, y)</code> coordinate pairs of all vertices of the polygon @param originX the x coordinate of the ray's origin @param originY the y coordinate of the ray's origin @param dirX the x coordinate of the ray's direction @param dirY the y coordinate of the ray's direction @param p will hold the point of intersection @return the index of the first vertex of the polygon edge that intersects the ray; or <code>-1</code> if the ray does not intersect the polygon

  1. int intersectPolygonRay(double[] verticesXY, double originX, double originY, double dirX, double dirY, Vector2d p)
    public static
    int
    intersectPolygonRay
    (
    double[] verticesXY
    ,
    double originX
    ,
    double originY
    ,
    double dirX
    ,
    double dirY
    ,)
  2. int intersectPolygonRay(Vector2d[] vertices, double originX, double originY, double dirX, double dirY, Vector2d p)

Meta