#include <vector>
#include "matvec3D.h"
#include "mytools.h"
Go to the source code of this file.
Classes | |
class | Triangle |
Functions | |
INLINE_RELEASE position | closestPtTriangle (const Triangle &t, const position &p) |
INLINE_RELEASE bool | triangleIntersection (const Triangle &t1, const Triangle &t2) |
INLINE_RELEASE int | triangleTriangleContact (const Triangle &t1, const Triangle &t2, double threshSq, std::vector< std::pair< position, position > > *contactPoints) |
Returns all the points on the two triangles separated by less than the threshold. | |
INLINE_RELEASE double | triangleTriangleDistanceSq (const Triangle &t1, const Triangle &t2, position &p1, position &p2) |
Returns the distance between the triangles as well as the two closest points on them. |
Code from REAL-TIME COLLISION DETECTION by Christer Ericson, published by Elsevier.
Definition at line 148 of file triangle_inl.h.
Definition at line 70 of file triangle_inl.h.
INLINE_RELEASE int triangleTriangleContact | ( | const Triangle & | t1, | |
const Triangle & | t2, | |||
double | threshSq, | |||
std::vector< std::pair< position, position > > * | contactPoints | |||
) |
Returns all the points on the two triangles separated by less than the threshold.
Does all 6 vertex-face tests and all 9 edge-edge tests and adds to the report all distinct pairs of resulting points separated by less than the threshold. Returns the number of contact points, 0 if the triangles are not in contact and -1 if the triangles are in collision.
I have not tested all the obscure cases, and it seems that more involved collision detection engines put more intelligence into this. There might be strange (or degenerate) pieces of geometry where this had an unexpected result.
Definition at line 284 of file triangle_inl.h.