doml.intersection_d

Contains intersection and distance tests for some 2D and 3D geometric primitives.

@author Kai Burjack

Members

Static functions

distancePointLine
double distancePointLine(double pointX, double pointY, double a, double b, double c)

Determine the signed distance of the given point <code>(pointX, pointY)</code> to the line specified via its general plane equation <i>a*x + b*y + c = 0</i>. <p> Reference: <a href="http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html">http://mathworld.wolfram.com</a>

distancePointLine
double distancePointLine(double pointX, double pointY, double x0, double y0, double x1, double y1)

Determine the signed distance of the given point <code>(pointX, pointY)</code> to the line defined by the two points <code>(x0, y0)</code> and <code>(x1, y1)</code>. <p> Reference: <a href="http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html">http://mathworld.wolfram.com</a>

distancePointLine
double distancePointLine(double pX, double pY, double pZ, double x0, double y0, double z0, double x1, double y1, double z1)

Compute the distance of the given point <code>(pX, pY, pZ)</code> to the line defined by the two points <code>(x0, y0, z0)</code> and <code>(x1, y1, z1)</code>. <p> Reference: <a href="http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html">http://mathworld.wolfram.com</a>

distancePointPlane
double distancePointPlane(double pointX, double pointY, double pointZ, double a, double b, double c, double d)

Determine the signed distance of the given point <code>(pointX, pointY, pointZ)</code> to the plane specified via its general plane equation <i>a*x + b*y + c*z + d = 0</i>.

distancePointPlane
double distancePointPlane(double pointX, double pointY, double pointZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z)

Determine the signed distance of the given point <code>(pointX, pointY, pointZ)</code> to the plane of the triangle specified by its three points <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>. <p> If the point lies on the front-facing side of the triangle's plane, that is, if the triangle has counter-clockwise winding order as seen from the point, then this method returns a positive number.

findClosestPointOnLineSegment
Vector3d findClosestPointOnLineSegment(double aX, double aY, double aZ, double bX, double bY, double bZ, double pX, double pY, double pZ, Vector3d result)

Find the point on the given line segment which is closest to the specified point <code>(pX, pY, pZ)</code>, and store the result in <code>result</code>.

findClosestPointOnPlane
Vector3d findClosestPointOnPlane(double aX, double aY, double aZ, double nX, double nY, double nZ, double pX, double pY, double pZ, Vector3d result)

Find the point on the given plane which is closest to the specified point <code>(pX, pY, pZ)</code> and store the result in <code>result</code>.

findClosestPointOnRectangle
Vector3d findClosestPointOnRectangle(double aX, double aY, double aZ, double bX, double bY, double bZ, double cX, double cY, double cZ, double pX, double pY, double pZ, Vector3d res)

Find the point on a given rectangle, specified via three of its corners, which is closest to the specified point <code>(pX, pY, pZ)</code> and store the result into <code>res</code>. <p> Reference: Book "Real-Time Collision Detection" chapter 5.1.4.2 "Closest Point on 3D Rectangle to Point"

findClosestPointOnTriangle
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)

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"

findClosestPointOnTriangle
int findClosestPointOnTriangle(Vector3d v0, Vector3d v1, Vector3d v2, Vector3d p, Vector3d result)

Determine the closest point on the triangle with the vertices <code>v0</code>, <code>v1</code>, <code>v2</code> between that triangle and the given point <code>p</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"

findClosestPointOnTriangle
int findClosestPointOnTriangle(double v0X, double v0Y, double v1X, double v1Y, double v2X, double v2Y, double pX, double pY, Vector2d result)

Determine the closest point on the triangle with the given vertices <code>(v0X, v0Y)</code>, <code>(v1X, v1Y)</code>, <code>(v2X, v2Y)</code> between that triangle and the given point <code>(pX, pY)</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"

findClosestPointOnTriangle
int findClosestPointOnTriangle(Vector2d v0, Vector2d v1, Vector2d v2, Vector2d p, Vector2d result)

Determine the closest point on the triangle with the vertices <code>v0</code>, <code>v1</code>, <code>v2</code> between that triangle and the given point <code>p</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"

findClosestPointsLineSegmentTriangle
double findClosestPointsLineSegmentTriangle(double aX, double aY, double aZ, double bX, double bY, double bZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, Vector3d lineSegmentResult, Vector3d triangleResult)

Find the closest points on a line segment and a triangle. <p> Reference: Book "Real-Time Collision Detection" chapter 5.1.10 "Closest Points of a Line Segment and a Triangle"

findClosestPointsLineSegments
double findClosestPointsLineSegments(double a0X, double a0Y, double a0Z, double a1X, double a1Y, double a1Z, double b0X, double b0Y, double b0Z, double b1X, double b1Y, double b1Z, Vector3d resultA, Vector3d resultB)

Find the closest points on the two line segments, store the point on the first line segment in <code>resultA</code> and the point on the second line segment in <code>resultB</code>, and return the square distance between both points. <p> Reference: Book "Real-Time Collision Detection" chapter 5.1.9 "Closest Points of Two Line Segments"

intersectCircleCircle
bool intersectCircleCircle(double aX, double aY, double radiusSquaredA, double bX, double bY, double radiusSquaredB, Vector3d intersectionCenterAndHL)

Test whether the one circle with center <code>(aX, aY)</code> and square radius <code>radiusSquaredA</code> intersects the other circle with center <code>(bX, bY)</code> and square radius <code>radiusSquaredB</code>, and store the center of the line segment of intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component. <p> This method returns <code>false</code> when one circle contains the other circle. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

intersectCircleCircle
bool intersectCircleCircle(Vector2d centerA, double radiusSquaredA, Vector2d centerB, double radiusSquaredB, Vector3d intersectionCenterAndHL)

Test whether the one circle with center <code>centerA</code> and square radius <code>radiusSquaredA</code> intersects the other circle with center <code>centerB</code> and square radius <code>radiusSquaredB</code>, and store the center of the line segment of intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component. <p> This method returns <code>false</code> when one circle contains the other circle. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

intersectLineCircle
bool intersectLineCircle(double a, double b, double c, double centerX, double centerY, double radius, Vector3d intersectionCenterAndHL)

Test whether the line with the general line equation <i>a*x + b*y + c = 0</i> intersects the circle with center <code>(centerX, centerY)</code> and <code>radius</code>, and store the center of the line segment of intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component. <p> Reference: <a href="http://math.stackexchange.com/questions/943383/determine-circle-of-intersection-of-plane-and-sphere">http://math.stackexchange.com</a>

intersectLineCircle
bool intersectLineCircle(double x0, double y0, double x1, double y1, double centerX, double centerY, double radius, Vector3d intersectionCenterAndHL)

Test whether the line defined by the two points <code>(x0, y0)</code> and <code>(x1, y1)</code> intersects the circle with center <code>(centerX, centerY)</code> and <code>radius</code>, and store the center of the line segment of intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component. <p> Reference: <a href="http://math.stackexchange.com/questions/943383/determine-circle-of-intersection-of-plane-and-sphere">http://math.stackexchange.com</a>

intersectLineLine
bool intersectLineLine(double ps1x, double ps1y, double pe1x, double pe1y, double ps2x, double ps2y, double pe2x, double pe2y, Vector2d p)

Determine whether the two lines, specified via two points lying on each line, intersect each other, and store the point of intersection into the given vector <code>p</code>.

intersectLineSegmentAab
int intersectLineSegmentAab(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, Vector2d result)

Determine whether the undirected line segment with the end points <code>(p0X, p0Y, p0Z)</code> and <code>(p1X, p1Y, p1Z)</code> intersects the axis-aligned box given as its minimum corner <code>(minX, minY, minZ)</code> and maximum corner <code>(maxX, maxY, maxZ)</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection. <p> This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>

intersectLineSegmentAab
int intersectLineSegmentAab(Vector3d p0, Vector3d p1, Vector3d min, Vector3d max, Vector2d result)

Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection. <p> This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>

intersectLineSegmentAar
int intersectLineSegmentAar(double p0X, double p0Y, double p1X, double p1Y, double minX, double minY, double maxX, double maxY, Vector2d result)

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>

intersectLineSegmentAar
int intersectLineSegmentAar(Vector2d p0, Vector2d p1, Vector2d min, Vector2d max, Vector2d result)

Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</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>

intersectLineSegmentPlane
bool intersectLineSegmentPlane(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z, double a, double b, double c, double d, Vector3d intersectionPoint)

Determine whether the line segment with the end points <code>(p0X, p0Y, p0Z)</code> and <code>(p1X, p1Y, p1Z)</code> intersects the plane given as the general plane equation <i>a*x + b*y + c*z + d = 0</i>, and return the point of intersection.

intersectLineSegmentTriangle
bool intersectLineSegmentTriangle(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon, Vector3d intersectionPoint)

Determine whether the line segment with the end points <code>(p0X, p0Y, p0Z)</code> and <code>(p1X, p1Y, p1Z)</code> intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>, regardless of the winding order of the triangle or the direction of the line segment between its two end points, and return the point of intersection. <p> Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a>

intersectLineSegmentTriangle
bool intersectLineSegmentTriangle(Vector3d p0, Vector3d p1, Vector3d v0, Vector3d v1, Vector3d v2, double epsilon, Vector3d intersectionPoint)

Determine whether the line segment with the end points <code>p0</code> and <code>p1</code> intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>, regardless of the winding order of the triangle or the direction of the line segment between its two end points, and return the point of intersection. <p> Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a>

intersectPlaneSphere
bool intersectPlaneSphere(double a, double b, double c, double d, double centerX, double centerY, double centerZ, double radius, Vector4d intersectionCenterAndRadius)

Test whether the plane with the general plane equation <i>a*x + b*y + c*z + d = 0</i> intersects the sphere with center <code>(centerX, centerY, centerZ)</code> and <code>radius</code>, and store the center of the circle of intersection in the <code>(x, y, z)</code> components of the supplied vector and the radius of that circle in the w component. <p> Reference: <a href="http://math.stackexchange.com/questions/943383/determine-circle-of-intersection-of-plane-and-sphere">http://math.stackexchange.com</a>

intersectPlaneSweptSphere
bool intersectPlaneSweptSphere(double a, double b, double c, double d, double cX, double cY, double cZ, double radius, double vX, double vY, double vZ, Vector4d pointAndTime)

Test whether the plane with the general plane equation <i>a*x + b*y + c*z + d = 0</i> intersects the moving sphere with center <code>(cX, cY, cZ)</code>, <code>radius</code> and velocity <code>(vX, vY, vZ)</code>, and store the point of intersection in the <code>(x, y, z)</code> components of the supplied vector and the time of intersection in the w component. <p> The normal vector <code>(a, b, c)</code> of the plane equation needs to be normalized. <p> Reference: Book "Real-Time Collision Detection" chapter 5.5.3 "Intersecting Moving Sphere Against Plane"

intersectPolygonRay
int intersectPolygonRay(Vector2d[] vertices, double originX, double originY, double dirX, double dirY, Vector2d p)

Determine whether the polygon specified by the given sequence of <code>vertices</code> 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.

intersectPolygonRay
int intersectPolygonRay(double[] verticesXY, double originX, double originY, double dirX, double dirY, Vector2d p)

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.

intersectRayAab
bool intersectRayAab(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, Vector2d result)

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the axis-aligned box given as its minimum corner <code>(minX, minY, minZ)</code> and maximum corner <code>(maxX, maxY, maxZ)</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection. <p> This method returns <code>true</code> for a ray whose origin lies inside the axis-aligned box. <p> If many boxes need to be tested against the same ray, then the {@link RayAabIntersection} class is likely more efficient. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>

intersectRayAab
bool intersectRayAab(Vector3d origin, Vector3d dir, Vector3d min, Vector3d max, Vector2d result)

Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned box specified as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection.. <p> This method returns <code>true</code> for a ray whose origin lies inside the axis-aligned box. <p> If many boxes need to be tested against the same ray, then the {@link RayAabIntersection} class is likely more efficient. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>

intersectRayAar
int intersectRayAar(double originX, double originY, double dirX, double dirY, double minX, double minY, double maxX, double maxY, Vector2d result)

Determine whether the given ray with the origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the axis-aligned rectangle given as its minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection as well as the side of the axis-aligned rectangle the ray intersects. <p> This method also detects an intersection for a ray whose origin 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>

intersectRayAar
int intersectRayAar(Vector2d origin, Vector2d dir, Vector2d min, Vector2d max, Vector2d result)

Determine whether the given ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection as well as the side of the axis-aligned rectangle the ray intersects. <p> This method also detects an intersection for a ray whose origin 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>

intersectRayCircle
bool intersectRayCircle(double originX, double originY, double dirX, double dirY, double centerX, double centerY, double radiusSquared, Vector2d result)

Test whether the given ray with the origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the given circle with center <code>(centerX, centerY)</code> and square radius <code>radiusSquared</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the circle. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

intersectRayCircle
bool intersectRayCircle(Vector2d origin, Vector2d dir, Vector2d center, double radiusSquared, Vector2d result)

Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the circle with the given <code>center</code> and square radius <code>radiusSquared</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the circle. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

intersectRayLine
double intersectRayLine(double originX, double originY, double dirX, double dirY, double pointX, double pointY, double normalX, double normalY, double epsilon)

Test whether the ray with given origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the line containing the given point <code>(pointX, pointY)</code> and having the normal <code>(normalX, normalY)</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point. <p> This method returns <code>-1.0</code> if the ray does not intersect the line, because it is either parallel to the line or its direction points away from the line or the ray's origin is on the <i>negative</i> side of the line (i.e. the line's normal points away from the ray's origin).

intersectRayLine
double intersectRayLine(Vector2d origin, Vector2d dir, Vector2d point, Vector2d normal, double epsilon)

Test whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the line containing the given <code>point</code> and having the given <code>normal</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point. <p> This method returns <code>-1.0</code> if the ray does not intersect the line, because it is either parallel to the line or its direction points away from the line or the ray's origin is on the <i>negative</i> side of the line (i.e. the line's normal points away from the ray's origin).

intersectRayLineSegment
double intersectRayLineSegment(double originX, double originY, double dirX, double dirY, double aX, double aY, double bX, double bY)

Determine whether the ray with given origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the undirected line segment given by the two end points <code>(aX, bY)</code> and <code>(bX, bY)</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if any. <p> This method returns <code>-1.0</code> if the ray does not intersect the line segment.

intersectRayLineSegment
double intersectRayLineSegment(Vector2d origin, Vector2d dir, Vector2d a, Vector2d b)

Determine whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the undirected line segment given by the two end points <code>a</code> and <code>b</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if any. <p> This method returns <code>-1.0</code> if the ray does not intersect the line segment.

intersectRayPlane
double intersectRayPlane(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double pointX, double pointY, double pointZ, double normalX, double normalY, double normalZ, double epsilon)

Test whether the ray with given origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the plane containing the given point <code>(pointX, pointY, pointZ)</code> and having the normal <code>(normalX, normalY, normalZ)</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point. <p> This method returns <code>-1.0</code> if the ray does not intersect the plane, because it is either parallel to the plane or its direction points away from the plane or the ray's origin is on the <i>negative</i> side of the plane (i.e. the plane's normal points away from the ray's origin). <p> Reference: <a href="https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm">https://www.siggraph.org/</a>

intersectRayPlane
double intersectRayPlane(Vector3d origin, Vector3d dir, Vector3d point, Vector3d normal, double epsilon)

Test whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the plane containing the given <code>point</code> and having the given <code>normal</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point. <p> This method returns <code>-1.0</code> if the ray does not intersect the plane, because it is either parallel to the plane or its direction points away from the plane or the ray's origin is on the <i>negative</i> side of the plane (i.e. the plane's normal points away from the ray's origin). <p> Reference: <a href="https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm">https://www.siggraph.org/</a>

intersectRayPlane
double intersectRayPlane(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double a, double b, double c, double d, double epsilon)

Test whether the ray with given origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the plane given as the general plane equation <i>a*x + b*y + c*z + d = 0</i>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point. <p> This method returns <code>-1.0</code> if the ray does not intersect the plane, because it is either parallel to the plane or its direction points away from the plane or the ray's origin is on the <i>negative</i> side of the plane (i.e. the plane's normal points away from the ray's origin). <p> Reference: <a href="https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm">https://www.siggraph.org/</a>

intersectRaySphere
bool intersectRaySphere(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double centerX, double centerY, double centerZ, double radiusSquared, Vector2d result)

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and normalized direction <code>(dirX, dirY, dirZ)</code> intersects the given sphere with center <code>(centerX, centerY, centerZ)</code> and square radius <code>radiusSquared</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

intersectRaySphere
bool intersectRaySphere(Vector3d origin, Vector3d dir, Vector3d center, double radiusSquared, Vector2d result)

Test whether the ray with the given <code>origin</code> and normalized direction <code>dir</code> intersects the sphere with the given <code>center</code> and square radius <code>radiusSquared</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near and far) of intersections into the given <code>result</code> vector. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

intersectRayTriangle
double intersectRayTriangle(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon)

Determine whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code> and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the point of intersection. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test does not take into account the winding order of the triangle, so a ray will intersect a front-facing triangle as well as a back-facing triangle.

intersectRayTriangle
double intersectRayTriangle(Vector3d origin, Vector3d dir, Vector3d v0, Vector3d v1, Vector3d v2, double epsilon)

Determine whether the ray with the given <code>origin</code> and the given <code>dir</code> intersects the triangle consisting of the three vertices <code>v0</code>, <code>v1</code> and <code>v2</code> and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the point of intersection. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test does not take into account the winding order of the triangle, so a ray will intersect a front-facing triangle as well as a back-facing triangle.

intersectRayTriangleFront
double intersectRayTriangleFront(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon)

Determine whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the frontface of the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code> and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the point of intersection. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test implements backface culling, that is, it will return <code>false</code> when the triangle is in clockwise winding order assuming a <i>right-handed</i> coordinate system when seen along the ray's direction, even if the ray intersects the triangle. This is in compliance with how OpenGL handles backface culling with default frontface/backface settings.

intersectRayTriangleFront
double intersectRayTriangleFront(Vector3d origin, Vector3d dir, Vector3d v0, Vector3d v1, Vector3d v2, double epsilon)

Determine whether the ray with the given <code>origin</code> and the given <code>dir</code> intersects the frontface of the triangle consisting of the three vertices <code>v0</code>, <code>v1</code> and <code>v2</code> and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the point of intersection. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test implements backface culling, that is, it will return <code>false</code> when the triangle is in clockwise winding order assuming a <i>right-handed</i> coordinate system when seen along the ray's direction, even if the ray intersects the triangle. This is in compliance with how OpenGL handles backface culling with default frontface/backface settings.

intersectSphereSphere
bool intersectSphereSphere(double aX, double aY, double aZ, double radiusSquaredA, double bX, double bY, double bZ, double radiusSquaredB, Vector4d centerAndRadiusOfIntersectionCircle)

Test whether the one sphere with center <code>(aX, aY, aZ)</code> and square radius <code>radiusSquaredA</code> intersects the other sphere with center <code>(bX, bY, bZ)</code> and square radius <code>radiusSquaredB</code>, and store the center of the circle of intersection in the <code>(x, y, z)</code> components of the supplied vector and the radius of that circle in the w component. <p> The normal vector of the circle of intersection can simply be obtained by subtracting the center of either sphere from the other. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

intersectSphereSphere
bool intersectSphereSphere(Vector3d centerA, double radiusSquaredA, Vector3d centerB, double radiusSquaredB, Vector4d centerAndRadiusOfIntersectionCircle)

Test whether the one sphere with center <code>centerA</code> and square radius <code>radiusSquaredA</code> intersects the other sphere with center <code>centerB</code> and square radius <code>radiusSquaredB</code>, and store the center of the circle of intersection in the <code>(x, y, z)</code> components of the supplied vector and the radius of that circle in the w component. <p> The normal vector of the circle of intersection can simply be obtained by subtracting the center of either sphere from the other. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

intersectSphereTriangle
int intersectSphereTriangle(double sX, double sY, double sZ, double sR, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, Vector3d result)

Test whether the given sphere with center <code>(sX, sY, sZ)</code> intersects the triangle given by its three vertices, and if they intersect store the point of intersection into <code>result</code>. <p> This method also returns whether the point of intersection is on one of the triangle's vertices, edges or on the face. <p> Reference: Book "Real-Time Collision Detection" chapter 5.2.7 "Testing Sphere Against Triangle"

intersectSweptSphereTriangle
int intersectSweptSphereTriangle(double centerX, double centerY, double centerZ, double radius, double velX, double velY, double velZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon, double maxT, Vector4d pointAndTime)

Determine the point of intersection between a sphere with the given center <code>(centerX, centerY, centerZ)</code> and <code>radius</code> moving with the given velocity <code>(velX, velY, velZ)</code> and the triangle specified via its three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code>, <code>(v2X, v2Y, v2Z)</code>. <p> The vertices of the triangle must be specified in counter-clockwise winding order. <p> An intersection is only considered if the time of intersection is smaller than the given <code>maxT</code> value. <p> Reference: <a href="http://www.peroxide.dk/papers/collision/collision.pdf">Improved Collision detection and Response</a>

testAabAab
bool testAabAab(double minXA, double minYA, double minZA, double maxXA, double maxYA, double maxZA, double minXB, double minYB, double minZB, double maxXB, double maxYB, double maxZB)

Test whether the axis-aligned box with minimum corner <code>(minXA, minYA, minZA)</code> and maximum corner <code>(maxXA, maxYA, maxZA)</code> intersects the axis-aligned box with minimum corner <code>(minXB, minYB, minZB)</code> and maximum corner <code>(maxXB, maxYB, maxZB)</code>.

testAabAab
bool testAabAab(Vector3d minA, Vector3d maxA, Vector3d minB, Vector3d maxB)

Test whether the axis-aligned box with minimum corner <code>minA</code> and maximum corner <code>maxA</code> intersects the axis-aligned box with minimum corner <code>minB</code> and maximum corner <code>maxB</code>.

testAabPlane
bool testAabPlane(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, double a, double b, double c, double d)

Test whether the axis-aligned box with minimum corner <code>(minX, minY, minZ)</code> and maximum corner <code>(maxX, maxY, maxZ)</code> intersects the plane with the general equation <i>a*x + b*y + c*z + d = 0</i>. <p> Reference: <a href="http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes-ii/">http://www.lighthouse3d.com</a> ("Geometric Approach - Testing Boxes II")

testAabPlane
bool testAabPlane(Vector3d min, Vector3d max, double a, double b, double c, double d)

Test whether the axis-aligned box with minimum corner <code>min</code> and maximum corner <code>max</code> intersects the plane with the general equation <i>a*x + b*y + c*z + d = 0</i>. <p> Reference: <a href="http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes-ii/">http://www.lighthouse3d.com</a> ("Geometric Approach - Testing Boxes II")

testAabSphere
bool testAabSphere(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, double centerX, double centerY, double centerZ, double radiusSquared)

Test whether the axis-aligned box with minimum corner <code>(minX, minY, minZ)</code> and maximum corner <code>(maxX, maxY, maxZ)</code> intersects the sphere with the given center <code>(centerX, centerY, centerZ)</code> and square radius <code>radiusSquared</code>. <p> Reference: <a href="http://stackoverflow.com/questions/4578967/cube-sphere-intersection-test#answer-4579069">http://stackoverflow.com</a>

testAabSphere
bool testAabSphere(Vector3d min, Vector3d max, Vector3d center, double radiusSquared)

Test whether the axis-aligned box with minimum corner <code>min</code> and maximum corner <code>max</code> intersects the sphere with the given <code>center</code> and square radius <code>radiusSquared</code>. <p> Reference: <a href="http://stackoverflow.com/questions/4578967/cube-sphere-intersection-test#answer-4579069">http://stackoverflow.com</a>

testAarAar
bool testAarAar(double minXA, double minYA, double maxXA, double maxYA, double minXB, double minYB, double maxXB, double maxYB)

Test whether the axis-aligned rectangle with minimum corner <code>(minXA, minYA)</code> and maximum corner <code>(maxXA, maxYA)</code> intersects the axis-aligned rectangle with minimum corner <code>(minXB, minYB)</code> and maximum corner <code>(maxXB, maxYB)</code>.

testAarAar
bool testAarAar(Vector2d minA, Vector2d maxA, Vector2d minB, Vector2d maxB)

Test whether the axis-aligned rectangle with minimum corner <code>minA</code> and maximum corner <code>maxA</code> intersects the axis-aligned rectangle with minimum corner <code>minB</code> and maximum corner <code>maxB</code>.

testAarCircle
bool testAarCircle(double minX, double minY, double maxX, double maxY, double centerX, double centerY, double radiusSquared)

Test whether the axis-aligned rectangle with minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code> intersects the circle with the given center <code>(centerX, centerY)</code> and square radius <code>radiusSquared</code>. <p> Reference: <a href="http://stackoverflow.com/questions/4578967/cube-sphere-intersection-test#answer-4579069">http://stackoverflow.com</a>

testAarCircle
bool testAarCircle(Vector2d min, Vector2d max, Vector2d center, double radiusSquared)

Test whether the axis-aligned rectangle with minimum corner <code>min</code> and maximum corner <code>max</code> intersects the circle with the given <code>center</code> and square radius <code>radiusSquared</code>. <p> Reference: <a href="http://stackoverflow.com/questions/4578967/cube-sphere-intersection-test#answer-4579069">http://stackoverflow.com</a>

testAarLine
bool testAarLine(double minX, double minY, double maxX, double maxY, double a, double b, double c)

Test whether the axis-aligned rectangle with minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code> intersects the line with the general equation <i>a*x + b*y + c = 0</i>. <p> Reference: <a href="http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes-ii/">http://www.lighthouse3d.com</a> ("Geometric Approach - Testing Boxes II")

testAarLine
bool testAarLine(Vector2d min, Vector2d max, double a, double b, double c)

Test whether the axis-aligned rectangle with minimum corner <code>min</code> and maximum corner <code>max</code> intersects the line with the general equation <i>a*x + b*y + c = 0</i>. <p> Reference: <a href="http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes-ii/">http://www.lighthouse3d.com</a> ("Geometric Approach - Testing Boxes II")

testAarLine
bool testAarLine(double minX, double minY, double maxX, double maxY, double x0, double y0, double x1, double y1)

Test whether the axis-aligned rectangle with minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code> intersects the line defined by the two points <code>(x0, y0)</code> and <code>(x1, y1)</code>. <p> Reference: <a href="http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes-ii/">http://www.lighthouse3d.com</a> ("Geometric Approach - Testing Boxes II")

testCircleCircle
bool testCircleCircle(double aX, double aY, double rA, double bX, double bY, double rB)

Test whether the one circle with center <code>(aX, aY)</code> and radius <code>rA</code> intersects the other circle with center <code>(bX, bY)</code> and radius <code>rB</code>. <p> This method returns <code>true</code> when one circle contains the other circle. <p> Reference: <a href="http://math.stackexchange.com/questions/275514/two-circles-overlap">http://math.stackexchange.com/</a>

testCircleCircle
bool testCircleCircle(Vector2d centerA, double radiusSquaredA, Vector2d centerB, double radiusSquaredB)

Test whether the one circle with center <code>centerA</code> and square radius <code>radiusSquaredA</code> intersects the other circle with center <code>centerB</code> and square radius <code>radiusSquaredB</code>. <p> This method returns <code>true</code> when one circle contains the other circle. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

testCircleTriangle
bool testCircleTriangle(double centerX, double centerY, double radiusSquared, double v0X, double v0Y, double v1X, double v1Y, double v2X, double v2Y)

Test whether the circle with center <code>(centerX, centerY)</code> and square radius <code>radiusSquared</code> intersects the triangle with counter-clockwise vertices <code>(v0X, v0Y)</code>, <code>(v1X, v1Y)</code>, <code>(v2X, v2Y)</code>. <p> The vertices of the triangle must be specified in counter-clockwise order. <p> Reference: <a href="http://www.phatcode.net/articles.php?id=459">http://www.phatcode.net/</a>

testCircleTriangle
bool testCircleTriangle(Vector2d center, double radiusSquared, Vector2d v0, Vector2d v1, Vector2d v2)

Test whether the circle with given <code>center</code> and square radius <code>radiusSquared</code> intersects the triangle with counter-clockwise vertices <code>v0</code>, <code>v1</code>, <code>v2</code>. <p> The vertices of the triangle must be specified in counter-clockwise order. <p> Reference: <a href="http://www.phatcode.net/articles.php?id=459">http://www.phatcode.net/</a>

testLineCircle
bool testLineCircle(double a, double b, double c, double centerX, double centerY, double radius)

Test whether the line with the general line equation <i>a*x + b*y + c = 0</i> intersects the circle with center <code>(centerX, centerY)</code> and <code>radius</code>. <p> Reference: <a href="http://math.stackexchange.com/questions/943383/determine-circle-of-intersection-of-plane-and-sphere">http://math.stackexchange.com</a>

testLineSegmentSphere
bool testLineSegmentSphere(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z, double centerX, double centerY, double centerZ, double radiusSquared)

Test whether the line segment with the end points <code>(p0X, p0Y, p0Z)</code> and <code>(p1X, p1Y, p1Z)</code> intersects the given sphere with center <code>(centerX, centerY, centerZ)</code> and square radius <code>radiusSquared</code>. <p> Reference: <a href="http://paulbourke.net/geometry/circlesphere/index.html#linesphere">http://paulbourke.net/</a>

testLineSegmentSphere
bool testLineSegmentSphere(Vector3d p0, Vector3d p1, Vector3d center, double radiusSquared)

Test whether the line segment with the end points <code>p0</code> and <code>p1</code> intersects the given sphere with center <code>center</code> and square radius <code>radiusSquared</code>. <p> Reference: <a href="http://paulbourke.net/geometry/circlesphere/index.html#linesphere">http://paulbourke.net/</a>

testLineSegmentTriangle
bool testLineSegmentTriangle(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon)

Test whether the line segment with the end points <code>(p0X, p0Y, p0Z)</code> and <code>(p1X, p1Y, p1Z)</code> intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>, regardless of the winding order of the triangle or the direction of the line segment between its two end points. <p> Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a>

testLineSegmentTriangle
bool testLineSegmentTriangle(Vector3d p0, Vector3d p1, Vector3d v0, Vector3d v1, Vector3d v2, double epsilon)

Test whether the line segment with the end points <code>p0</code> and <code>p1</code> intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>, regardless of the winding order of the triangle or the direction of the line segment between its two end points. <p> Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a>

testMovingCircleCircle
bool testMovingCircleCircle(double aX, double aY, double maX, double maY, double aR, double bX, double bY, double bR)

Test whether a given circle with center <code>(aX, aY)</code> and radius <code>aR</code> and travelled distance vector <code>(maX, maY)</code> intersects a given static circle with center <code>(bX, bY)</code> and radius <code>bR</code>. <p> Note that the case of two moving circles can always be reduced to this case by expressing the moved distance of one of the circles relative to the other. <p> Reference: <a href="https://www.gamasutra.com/view/feature/131424/pool_hall_lessons_fast_accurate_.php?page=2">https://www.gamasutra.com</a>

testMovingCircleCircle
bool testMovingCircleCircle(Vector2d centerA, Vector2d moveA, double aR, Vector2d centerB, double bR)

Test whether a given circle with center <code>centerA</code> and radius <code>aR</code> and travelled distance vector <code>moveA</code> intersects a given static circle with center <code>centerB</code> and radius <code>bR</code>. <p> Note that the case of two moving circles can always be reduced to this case by expressing the moved distance of one of the circles relative to the other. <p> Reference: <a href="https://www.gamasutra.com/view/feature/131424/pool_hall_lessons_fast_accurate_.php?page=2">https://www.gamasutra.com</a>

testObOb
bool testObOb(Vector3d b0c, Vector3d b0uX, Vector3d b0uY, Vector3d b0uZ, Vector3d b0hs, Vector3d b1c, Vector3d b1uX, Vector3d b1uY, Vector3d b1uZ, Vector3d b1hs)

Test whether two oriented boxes given via their center position, orientation and half-size, intersect. <p> The orientation of a box is given as three unit vectors spanning the local orthonormal basis of the box. <p> The size is given as the half-size along each of the unit vectors defining the orthonormal basis. <p> Reference: Book "Real-Time Collision Detection" chapter 4.4.1 "OBB-OBB Intersection"

testObOb
bool testObOb(double b0cX, double b0cY, double b0cZ, double b0uXx, double b0uXy, double b0uXz, double b0uYx, double b0uYy, double b0uYz, double b0uZx, double b0uZy, double b0uZz, double b0hsX, double b0hsY, double b0hsZ, double b1cX, double b1cY, double b1cZ, double b1uXx, double b1uXy, double b1uXz, double b1uYx, double b1uYy, double b1uYz, double b1uZx, double b1uZy, double b1uZz, double b1hsX, double b1hsY, double b1hsZ)

Test whether two oriented boxes given via their center position, orientation and half-size, intersect. <p> The orientation of a box is given as three unit vectors spanning the local orthonormal basis of the box. <p> The size is given as the half-size along each of the unit vectors defining the orthonormal basis. <p> Reference: Book "Real-Time Collision Detection" chapter 4.4.1 "OBB-OBB Intersection"

testPlaneSphere
bool testPlaneSphere(double a, double b, double c, double d, double centerX, double centerY, double centerZ, double radius)

Test whether the plane with the general plane equation <i>a*x + b*y + c*z + d = 0</i> intersects the sphere with center <code>(centerX, centerY, centerZ)</code> and <code>radius</code>. <p> Reference: <a href="http://math.stackexchange.com/questions/943383/determine-circle-of-intersection-of-plane-and-sphere">http://math.stackexchange.com</a>

testPlaneSweptSphere
bool testPlaneSweptSphere(double a, double b, double c, double d, double t0X, double t0Y, double t0Z, double r, double t1X, double t1Y, double t1Z)

Test whether the plane with the general plane equation <i>a*x + b*y + c*z + d = 0</i> intersects the sphere moving from center position <code>(t0X, t0Y, t0Z)</code> to <code>(t1X, t1Y, t1Z)</code> and having the given <code>radius</code>. <p> The normal vector <code>(a, b, c)</code> of the plane equation needs to be normalized. <p> Reference: Book "Real-Time Collision Detection" chapter 5.5.3 "Intersecting Moving Sphere Against Plane"

testPointAar
bool testPointAar(double pX, double pY, double minX, double minY, double maxX, double maxY)

Test whether the given point <code>(pX, pY)</code> lies inside the axis-aligned rectangle with the minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code>.

testPointCircle
bool testPointCircle(double pX, double pY, double centerX, double centerY, double radiusSquared)

Test whether the point <code>(pX, pY)</code> lies inside the circle with center <code>(centerX, centerY)</code> and square radius <code>radiusSquared</code>.

testPointInTriangle
bool testPointInTriangle(double pX, double pY, double pZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z)

Test whether the projection of the given point <code>(pX, pY, pZ)</code> lies inside of the triangle defined by the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>. <p> Reference: <a href="http://www.peroxide.dk/papers/collision/collision.pdf">Improved Collision detection and Response</a>

testPointTriangle
bool testPointTriangle(double pX, double pY, double v0X, double v0Y, double v1X, double v1Y, double v2X, double v2Y)

Test whether the given point <code>(pX, pY)</code> lies inside the triangle with the vertices <code>(v0X, v0Y)</code>, <code>(v1X, v1Y)</code>, <code>(v2X, v2Y)</code>.

testPointTriangle
bool testPointTriangle(Vector2d point, Vector2d v0, Vector2d v1, Vector2d v2)

Test whether the given <code>point</code> lies inside the triangle with the vertices <code>v0</code>, <code>v1</code>, <code>v2</code>.

testPolygonPolygon
bool testPolygonPolygon(Vector2d[] v1s, Vector2d[] v2s)

Test if the two convex polygons, given via their vertices, intersect.

testRayAab
bool testRayAab(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double minX, double minY, double minZ, double maxX, double maxY, double maxZ)

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the axis-aligned box given as its minimum corner <code>(minX, minY, minZ)</code> and maximum corner <code>(maxX, maxY, maxZ)</code>. <p> This method returns <code>true</code> for a ray whose origin lies inside the axis-aligned box. <p> If many boxes need to be tested against the same ray, then the {@link RayAabIntersection} class is likely more efficient. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>

testRayAab
bool testRayAab(Vector3d origin, Vector3d dir, Vector3d min, Vector3d max)

Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the axis-aligned box specified as its minimum corner <code>min</code> and maximum corner <code>max</code>. <p> This method returns <code>true</code> for a ray whose origin lies inside the axis-aligned box. <p> If many boxes need to be tested against the same ray, then the {@link RayAabIntersection} class is likely more efficient. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>

testRayAar
bool testRayAar(double originX, double originY, double dirX, double dirY, double minX, double minY, double maxX, double maxY)

Test whether the given ray with the origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the given axis-aligned rectangle given as its minimum corner <code>(minX, minY)</code> and maximum corner <code>(maxX, maxY)</code>. <p> This method returns <code>true</code> for a ray whose origin 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>

testRayAar
bool testRayAar(Vector2d origin, Vector2d dir, Vector2d min, Vector2d max)

Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the given axis-aligned rectangle specified as its minimum corner <code>min</code> and maximum corner <code>max</code>. <p> This method returns <code>true</code> for a ray whose origin 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>

testRayCircle
bool testRayCircle(double originX, double originY, double dirX, double dirY, double centerX, double centerY, double radiusSquared)

Test whether the given ray with the origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the given circle with center <code>(centerX, centerY)</code> and square radius <code>radiusSquared</code>. <p> This method returns <code>true</code> for a ray whose origin lies inside the circle. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

testRayCircle
bool testRayCircle(Vector2d origin, Vector2d dir, Vector2d center, double radiusSquared)

Test whether the ray with the given <code>origin</code> and direction <code>dir</code> intersects the circle with the given <code>center</code> and square radius. <p> This method returns <code>true</code> for a ray whose origin lies inside the circle. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

testRaySphere
bool testRaySphere(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double centerX, double centerY, double centerZ, double radiusSquared)

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and normalized direction <code>(dirX, dirY, dirZ)</code> intersects the given sphere with center <code>(centerX, centerY, centerZ)</code> and square radius <code>radiusSquared</code>. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

testRaySphere
bool testRaySphere(Vector3d origin, Vector3d dir, Vector3d center, double radiusSquared)

Test whether the ray with the given <code>origin</code> and normalized direction <code>dir</code> intersects the sphere with the given <code>center</code> and square radius. <p> This method returns <code>true</code> for a ray whose origin lies inside the sphere. <p> Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>

testRayTriangle
bool testRayTriangle(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon)

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test does not take into account the winding order of the triangle, so a ray will intersect a front-facing triangle as well as a back-facing triangle.

testRayTriangle
bool testRayTriangle(Vector3d origin, Vector3d dir, Vector3d v0, Vector3d v1, Vector3d v2, double epsilon)

Test whether the ray with the given <code>origin</code> and the given <code>dir</code> intersects the frontface of the triangle consisting of the three vertices <code>v0</code>, <code>v1</code> and <code>v2</code>. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test does not take into account the winding order of the triangle, so a ray will intersect a front-facing triangle as well as a back-facing triangle.

testRayTriangleFront
bool testRayTriangleFront(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, double v0X, double v0Y, double v0Z, double v1X, double v1Y, double v1Z, double v2X, double v2Y, double v2Z, double epsilon)

Test whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code> intersects the frontface of the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test implements backface culling, that is, it will return <code>false</code> when the triangle is in clockwise winding order assuming a <i>right-handed</i> coordinate system when seen along the ray's direction, even if the ray intersects the triangle. This is in compliance with how OpenGL handles backface culling with default frontface/backface settings.

testRayTriangleFront
bool testRayTriangleFront(Vector3d origin, Vector3d dir, Vector3d v0, Vector3d v1, Vector3d v2, double epsilon)

Test whether the ray with the given <code>origin</code> and the given <code>dir</code> intersects the frontface of the triangle consisting of the three vertices <code>v0</code>, <code>v1</code> and <code>v2</code>. <p> This is an implementation of the <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf"> Fast, Minimum Storage Ray/Triangle Intersection</a> method. <p> This test implements backface culling, that is, it will return <code>false</code> when the triangle is in clockwise winding order assuming a <i>right-handed</i> coordinate system when seen along the ray's direction, even if the ray intersects the triangle. This is in compliance with how OpenGL handles backface culling with default frontface/backface settings.

testSphereSphere
bool testSphereSphere(double aX, double aY, double aZ, double radiusSquaredA, double bX, double bY, double bZ, double radiusSquaredB)

Test whether the one sphere with center <code>(aX, aY, aZ)</code> and square radius <code>radiusSquaredA</code> intersects the other sphere with center <code>(bX, bY, bZ)</code> and square radius <code>radiusSquaredB</code>. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

testSphereSphere
bool testSphereSphere(Vector3d centerA, double radiusSquaredA, Vector3d centerB, double radiusSquaredB)

Test whether the one sphere with center <code>centerA</code> and square radius <code>radiusSquaredA</code> intersects the other sphere with center <code>centerB</code> and square radius <code>radiusSquaredB</code>. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>

Static variables

AAR_SIDE_MAXX
int AAR_SIDE_MAXX;

Return value of {@link #intersectRayAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectRayAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the ray intersects the side of the axis-aligned rectangle with the maximum x coordinate.

AAR_SIDE_MAXY
int AAR_SIDE_MAXY;

Return value of {@link #intersectRayAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectRayAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the ray intersects the side of the axis-aligned rectangle with the maximum y coordinate.

AAR_SIDE_MINX
int AAR_SIDE_MINX;

Return value of {@link #intersectRayAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectRayAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the ray intersects the side of the axis-aligned rectangle with the minimum x coordinate.

AAR_SIDE_MINY
int AAR_SIDE_MINY;

Return value of {@link #intersectRayAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectRayAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the ray intersects the side of the axis-aligned rectangle with the minimum y coordinate.

INSIDE
int INSIDE;

Return value of {@link #intersectLineSegmentAab(double, double, double, double, double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAab(Vector3d, Vector3d, Vector3d, Vector3d, Vector2d)} to indicate that the line segment lies completely inside of the axis-aligned box; or return value of {@link #intersectLineSegmentAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the line segment lies completely inside of the axis-aligned rectangle.

ONE_INTERSECTION
int ONE_INTERSECTION;

Return value of {@link #intersectLineSegmentAab(double, double, double, double, double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAab(Vector3d, Vector3d, Vector3d, Vector3d, Vector2d)} to indicate that one end point of the line segment lies inside of the axis-aligned box; or return value of {@link #intersectLineSegmentAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that one end point of the line segment lies inside of the axis-aligned rectangle.

OUTSIDE
int OUTSIDE;

Return value of {@link #intersectLineSegmentAab(double, double, double, double, double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAab(Vector3d, Vector3d, Vector3d, Vector3d, Vector2d)} to indicate that the line segment does not intersect the axis-aligned box; or return value of {@link #intersectLineSegmentAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the line segment does not intersect the axis-aligned rectangle.

POINT_ON_TRIANGLE_EDGE_01
int POINT_ON_TRIANGLE_EDGE_01;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point lies on the edge between the first and second vertex of the triangle.

POINT_ON_TRIANGLE_EDGE_12
int POINT_ON_TRIANGLE_EDGE_12;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point lies on the edge between the second and third vertex of the triangle.

POINT_ON_TRIANGLE_EDGE_20
int POINT_ON_TRIANGLE_EDGE_20;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point lies on the edge between the third and first vertex of the triangle.

POINT_ON_TRIANGLE_FACE
int POINT_ON_TRIANGLE_FACE;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point lies on the face of the triangle.

POINT_ON_TRIANGLE_VERTEX_0
int POINT_ON_TRIANGLE_VERTEX_0;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point is the first vertex of the triangle.

POINT_ON_TRIANGLE_VERTEX_1
int POINT_ON_TRIANGLE_VERTEX_1;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point is the second vertex of the triangle.

POINT_ON_TRIANGLE_VERTEX_2
int POINT_ON_TRIANGLE_VERTEX_2;

Return value of {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, double, double, double, double, Vector3d)}, {@link #findClosestPointOnTriangle(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)}, {@link #findClosestPointOnTriangle(double, double, double, double, double, double, double, double, Vector2d)} and {@link #findClosestPointOnTriangle(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} or {@link #intersectSweptSphereTriangle} to signal that the closest point is the third vertex of the triangle.

TWO_INTERSECTION
int TWO_INTERSECTION;

Return value of {@link #intersectLineSegmentAab(double, double, double, double, double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAab(Vector3d, Vector3d, Vector3d, Vector3d, Vector2d)} to indicate that the line segment intersects two sides of the axis-aligned box or lies on an edge or a side of the box; or return value of {@link #intersectLineSegmentAar(double, double, double, double, double, double, double, double, Vector2d)} and {@link #intersectLineSegmentAar(Vector2d, Vector2d, Vector2d, Vector2d, Vector2d)} to indicate that the line segment intersects two edges of the axis-aligned rectangle or lies on an edge of the rectangle.

Meta