intersectLineSegmentAar
- int intersectLineSegmentAar(double p0X, double p0Y, double p1X, double p1Y, double minX, double minY, double maxX, double maxY, Vector2d result)
public static
int
intersectLineSegmentAar
- int intersectLineSegmentAar(Vector2d p0, Vector2d p1, Vector2d min, Vector2d max, Vector2d result)
doml intersection_d
static functionsstatic variables
Determine whether the undirected line segment with the end points <code>(p0X, p0Y)</code> and <code>(p1X, p1Y)</code> intersects the axis-aligned rectangle given as its minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection into <code>result</code>. <p> This method also detects an intersection of a line segment whose either end point lies inside the axis-aligned rectangle. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@see #intersectLineSegmentAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)
@param p0X the x coordinate of the line segment's first end point @param p0Y the y coordinate of the line segment's first end point @param p1X the x coordinate of the line segment's second end point @param p1Y the y coordinate of the line segment's second end point @param minX the x coordinate of the minimum corner of the axis-aligned rectangle @param minY the y coordinate of the minimum corner of the axis-aligned rectangle @param maxX the x coordinate of the maximum corner of the axis-aligned rectangle @param maxY the y coordinate of the maximum corner of the axis-aligned rectangle @param result a vector which will hold the values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection @return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned rectangle; or {@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned rectangle; or {@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned rectangle; or {@link #TWO_INTERSECTION} if the line segment intersects two edges of the axis-aligned rectangle or lies on one edge of the rectangle