Here you will find each function for collision detection, distance computation and intersection tests. More...
Functions | |
SP_EXPORT dim::vector3df | getClosestPoint (const dim::triangle3df &Triangle, const dim::vector3df &Point) |
SP_EXPORT bool | getClosestPointStraight (const dim::triangle3df &Triangle, const dim::vector3df &Point, dim::vector3df &PointOnTriangle) |
SP_EXPORT dim::vector3df | getClosestPoint (const dim::aabbox3df &Box, const dim::vector3df &Point) |
SP_EXPORT dim::vector3df | getClosestPoint (const dim::aabbox3df &Box, const dim::vector3df &Point, dim::vector3df &Normal) |
SP_EXPORT dim::vector3df | getClosestPoint (const dim::obbox3df &Box, const dim::vector3df &Point) |
SP_EXPORT dim::line3df | getClosestLine (const dim::triangle3df &Triangle, const dim::line3df &Line) |
SP_EXPORT bool | getClosestLineStraight (const dim::triangle3df &Triangle, const dim::line3df &Line, dim::line3df &LineToTriangle) |
SP_EXPORT dim::line3df | getClosestLine (const dim::quadrangle3df &Quadrangle, const dim::line3df &Line) |
SP_EXPORT dim::line3df | getClosestLine (const dim::aabbox3df &Box, const dim::line3df &Line) |
SP_EXPORT f32 | getPointBoxDistanceSq (const dim::obbox3df &Box, const dim::vector3df &Point) |
Computes the squared distance between the given box and point. | |
SP_EXPORT f32 | getLineBoxDistanceSq (const dim::aabbox3df &Box, const dim::line3df &Line) |
SP_EXPORT f32 | getLineLineDistanceSq (const dim::line3df &LineA, const dim::line3df &LineB, dim::vector3df &PointP, dim::vector3df &PointQ) |
SP_EXPORT bool | getLineLineIntersection (const dim::line3df &LineA, const dim::line3df &LineB, dim::vector3df &Intersection) |
SP_EXPORT dim::point2df | get2DLineLineIntersectionStraight (const dim::point2df &A, const dim::point2df &B, const dim::point2df &C, const dim::point2df &D) |
SP_EXPORT bool | checkLineTriangleIntersection (const dim::triangle3df &Triangle, const dim::line3df &Line, dim::vector3df &Intersection) |
SP_EXPORT bool | checkLineSphereIntersection (const dim::line3df &Line, const dim::vector3df &SpherePosition, const f32 SphereRadius, dim::vector3df &Intersection, bool MakeRayTest) |
SP_EXPORT bool | checkLineBoxIntersection (const dim::line3df &Line, const dim::aabbox3df &Box, dim::vector3df &Intersection, bool MakeRayTest) |
SP_EXPORT bool | checkTriangleTriangleIntersection (const dim::triangle3df &TriangleA, const dim::triangle3df &TriangleB, dim::line3df &Intersection) |
SP_EXPORT bool | checkLineBoxOverlap (const dim::line3df &Line, const dim::aabbox3df &Box) |
Returns true if an intersection between "Line" and "Box" has been detected. | |
SP_EXPORT bool | checkPlaneBoxOverlap (const dim::plane3df &Plane, const dim::aabbox3df &Box) |
Returns true if an intersection between "Plane" and "Box" has been detected. | |
SP_EXPORT bool | checkTriangleBoxOverlap (const dim::triangle3df &Triangle, const dim::aabbox3df &Box) |
Returns true if an intersection between "Triangle" and "Box" has been detected. | |
SP_EXPORT bool | checkOBBoxOBBoxOverlap (const dim::obbox3df &BoxA, const dim::obbox3df &BoxB) |
bool | checkPyramidPyramidOverlap (const dim::vector3df &OriginA, const scene::ViewFrustum &FrustumA, const dim::vector3df &OriginB, const scene::ViewFrustum &FrustumB) |
f32 | getPointBoxDistance (const dim::obbox3df &Box, const dim::vector3df &Point) |
Computes the distance between the given box and point. | |
f32 | getLineBoxDistance (const dim::aabbox3df &Box, const dim::line3df &Line) |
Computes the distance between the given box and line. | |
f32 | getLineLineDistance (const dim::line3df &LineA, const dim::line3df &LineB, dim::vector3df &PointP, dim::vector3df &PointQ) |
Returns the square root of the result of the getLineLineDistanceSq function. | |
template<typename T , typename C > | |
bool | getLinePlaneIntersection (const dim::plane3d< T > &Plane, const C &LineStart, const C &LineEnd, C &Intersection) |
template<typename T , typename C > | |
bool | clipPolygon (const dim::polygon< C > &Poly, const dim::plane3d< T > &Plane, dim::polygon< C > &FrontPoly, dim::polygon< C > &BackPoly) |
Here you will find each function for collision detection, distance computation and intersection tests.
SP_EXPORT bool sp::math::CollisionLibrary::checkLineBoxIntersection | ( | const dim::line3df & | Line, | |
const dim::aabbox3df & | Box, | |||
dim::vector3df & | Intersection, | |||
bool | MakeRayTest = false | |||
) |
Tests if a line intersects with an axis aligned bounding box.
[in] | Line | 3D line for the test. |
[in] | Box | 3D AABB (Axis Aligned Bounding Box) for the test. In this case you can not transform the box (e.g. for rotations). Make an inverse transformation to the line. |
[out] | Intersection | Resulting 3D intersection point. |
[in] | MakeRayTest | Specifies whether the line is to be interpreted as a line or a ray. By default false. If the line is interpreted as a ray, the length of the line is ignored. |
SP_EXPORT bool sp::math::CollisionLibrary::checkLineBoxOverlap | ( | const dim::line3df & | Line, | |
const dim::aabbox3df & | Box | |||
) |
Returns true if an intersection between "Line" and "Box" has been detected.
SP_EXPORT bool sp::math::CollisionLibrary::checkLineSphereIntersection | ( | const dim::line3df & | Line, | |
const dim::vector3df & | SpherePosition, | |||
const f32 | SphereRadius, | |||
dim::vector3df & | Intersection, | |||
bool | MakeRayTest = false | |||
) |
Tests if a line intersects with a sphere.
[in] | Line | 3D line for the test. |
[in] | SpherePosition | Sphere's 3D position. |
[in] | SphereRadius | Sphere's radius. |
[out] | Intersection | Resulting 3D intersection point. |
[in] | MakeRayTest | Specifies whether the line is to be interpreted as a line or a ray. By default false. |
SP_EXPORT bool sp::math::CollisionLibrary::checkLineTriangleIntersection | ( | const dim::triangle3df & | Triangle, | |
const dim::line3df & | Line, | |||
dim::vector3df & | Intersection | |||
) |
Tests if a lines intersects with a triangle.
Triangle,: | 3D triangle for the test. | |
Line,: | 3D line for the test. | |
Intersection,: | Resulting 3D intersection point. |
SP_EXPORT bool sp::math::CollisionLibrary::checkOBBoxOBBoxOverlap | ( | const dim::obbox3df & | BoxA, | |
const dim::obbox3df & | BoxB | |||
) |
SP_EXPORT bool sp::math::CollisionLibrary::checkPlaneBoxOverlap | ( | const dim::plane3df & | Plane, | |
const dim::aabbox3df & | Box | |||
) |
Returns true if an intersection between "Plane" and "Box" has been detected.
bool sp::math::CollisionLibrary::checkPyramidPyramidOverlap | ( | const dim::vector3df & | OriginA, | |
const scene::ViewFrustum & | FrustumA, | |||
const dim::vector3df & | OriginB, | |||
const scene::ViewFrustum & | FrustumB | |||
) |
Returns true if the two view frustums overlap each other. In this case the two view frustums are aproximated as pyramids for performance optimzation.
SP_EXPORT bool sp::math::CollisionLibrary::checkTriangleBoxOverlap | ( | const dim::triangle3df & | Triangle, | |
const dim::aabbox3df & | Box | |||
) |
Returns true if an intersection between "Triangle" and "Box" has been detected.
SP_EXPORT bool sp::math::CollisionLibrary::checkTriangleTriangleIntersection | ( | const dim::triangle3df & | TriangleA, | |
const dim::triangle3df & | TriangleB, | |||
dim::line3df & | Intersection | |||
) |
Tests if a triangle intersects with an other triangle.
TriangleA,: | First 3D triangle for the test. | |
TriangleB,: | Second 3D triangle for the test. | |
Intersection,: | Resulting 3D line (or rather "intersection cut"). |
bool sp::math::CollisionLibrary::clipPolygon | ( | const dim::polygon< C > & | Poly, | |
const dim::plane3d< T > & | Plane, | |||
dim::polygon< C > & | FrontPoly, | |||
dim::polygon< C > & | BackPoly | |||
) |
Clips the given polygon with the given plane.
T | Specifies the data type (float, double, int etc.). | |
C | Specifies the class type (point2d, vector3d etc.). Requires that the class implements a function called "vector3d<T> getCoord() const". |
[in] | Poly | Specifies the polygon which is to be clipped. |
[in] | Plane | Specifies the clipping plane. |
[out] | FrontPoly | Specifies the output polygon which is in front of the clipping plane. |
[out] | BackPoly | Specifies the output polygon which is behind the clipping plane. |
SP_EXPORT dim::point2df sp::math::CollisionLibrary::get2DLineLineIntersectionStraight | ( | const dim::point2df & | A, | |
const dim::point2df & | B, | |||
const dim::point2df & | C, | |||
const dim::point2df & | D | |||
) |
Computes the intersection of two lines (or rather rays because an intersection will always be detected).
A,: | Start point of the first lines. | |
B,: | End point of the first lines. | |
C,: | Start point of the second lines. | |
D,: | End point of the second lines. |
SP_EXPORT dim::line3df sp::math::CollisionLibrary::getClosestLine | ( | const dim::quadrangle3df & | Quadrangle, | |
const dim::line3df & | Line | |||
) |
Computes the closest line from the given quadrangle and line.
Quadrangle,: | 3D quadrangle for the computation. | |
Line,: | 3D line to which the clsoest point is to be computed. |
SP_EXPORT dim::line3df sp::math::CollisionLibrary::getClosestLine | ( | const dim::aabbox3df & | Box, | |
const dim::line3df & | Line | |||
) |
Computes the closest line from the given axis-aligned bounding box and line.
[in] | Box | Specifies the AABB. |
[in] | Line | Specifies the 3D line. |
SP_EXPORT dim::line3df sp::math::CollisionLibrary::getClosestLine | ( | const dim::triangle3df & | Triangle, | |
const dim::line3df & | Line | |||
) |
Computes the closest line between the given triangle and line.
Triangle,: | 3D triangle for the computation. | |
Line,: | 3D line to which the closest point is to be computed. |
SP_EXPORT bool sp::math::CollisionLibrary::getClosestLineStraight | ( | const dim::triangle3df & | Triangle, | |
const dim::line3df & | Line, | |||
dim::line3df & | LineToTriangle | |||
) |
Computes the closest line between the given triangle and line.
Triangle,: | 3D triangle for the computation. | |
Line,: | 3D line to which the closest point is to be computed. | |
LineToTriangle,: | Resulting 3D line. |
SP_EXPORT dim::vector3df sp::math::CollisionLibrary::getClosestPoint | ( | const dim::aabbox3df & | Box, | |
const dim::vector3df & | Point | |||
) |
Computes the closest point from an other point to a box.
Box,: | 3D AABB (Axis-Aliend-Bounding-Box) for the computation. | |
Point,: | 3D point to which the closest point shall be computed. |
SP_EXPORT dim::vector3df sp::math::CollisionLibrary::getClosestPoint | ( | const dim::triangle3df & | Triangle, | |
const dim::vector3df & | Point | |||
) |
Computes the closest point onto given triangle from an other point to this trianlge.
Triangle,: | 3D triangle for the computation. | |
Point,: | 3D point to which the closest point is to be computed. |
SP_EXPORT dim::vector3df sp::math::CollisionLibrary::getClosestPoint | ( | const dim::aabbox3df & | Box, | |
const dim::vector3df & | Point, | |||
dim::vector3df & | Normal | |||
) |
Same like the function above but computes additional the normalized normal vector by "Point" and the resulting 3D point.
SP_EXPORT dim::vector3df sp::math::CollisionLibrary::getClosestPoint | ( | const dim::obbox3df & | Box, | |
const dim::vector3df & | Point | |||
) |
Computes the closest point from an other point to a box.
Box,: | 3D OBB (Oriented-Bounding-Box) for the computation. | |
Point,: | 3D point to which the closest point shall be computed. |
SP_EXPORT bool sp::math::CollisionLibrary::getClosestPointStraight | ( | const dim::triangle3df & | Triangle, | |
const dim::vector3df & | Point, | |||
dim::vector3df & | PointOnTriangle | |||
) |
Computes the closest point from an other point to a triangle if this computed point lies onto the triangle.
PointOnTriangle,: | Resulting 3D point. |
f32 sp::math::CollisionLibrary::getLineBoxDistance | ( | const dim::aabbox3df & | Box, | |
const dim::line3df & | Line | |||
) | [inline] |
Computes the distance between the given box and line.
SP_EXPORT f32 sp::math::CollisionLibrary::getLineBoxDistanceSq | ( | const dim::aabbox3df & | Box, | |
const dim::line3df & | Line | |||
) |
Computes the squared distance between the given box and line.
f32 sp::math::CollisionLibrary::getLineLineDistance | ( | const dim::line3df & | LineA, | |
const dim::line3df & | LineB, | |||
dim::vector3df & | PointP, | |||
dim::vector3df & | PointQ | |||
) | [inline] |
Returns the square root of the result of the getLineLineDistanceSq function.
SP_EXPORT f32 sp::math::CollisionLibrary::getLineLineDistanceSq | ( | const dim::line3df & | LineA, | |
const dim::line3df & | LineB, | |||
dim::vector3df & | PointP, | |||
dim::vector3df & | PointQ | |||
) |
Computes the squared distance between two lines. If you want to have the real distance take the square-root of the return value.
LineA,: | First line. | |
LineB,: | Second line. | |
PointP,: | First point of the closest distance (or rather line). | |
PointQ,: | Second point of the closest distance (or rather line). |
SP_EXPORT bool sp::math::CollisionLibrary::getLineLineIntersection | ( | const dim::line3df & | LineA, | |
const dim::line3df & | LineB, | |||
dim::vector3df & | Intersection | |||
) |
Tests if the two lines are intersecting.
LinesA,: | First line. | |
LinesB,: | Second line. | |
Intersection,: | Resulting intersection point of the two lines if an intersection has been deteced. |
bool sp::math::CollisionLibrary::getLinePlaneIntersection | ( | const dim::plane3d< T > & | Plane, | |
const C & | LineStart, | |||
const C & | LineEnd, | |||
C & | Intersection | |||
) |
f32 sp::math::CollisionLibrary::getPointBoxDistance | ( | const dim::obbox3df & | Box, | |
const dim::vector3df & | Point | |||
) | [inline] |
Computes the distance between the given box and point.
SP_EXPORT f32 sp::math::CollisionLibrary::getPointBoxDistanceSq | ( | const dim::obbox3df & | Box, | |
const dim::vector3df & | Point | |||
) |
Computes the squared distance between the given box and point.