Go to the source code of this file.
Functions | |
double | Clamp (double n, double min, double max) |
position | closestPtTriangle (const Triangle &t, const position &p) |
double | gmax (double d1, double d2, double d3) |
double | gmin (double d1, double d2, double d3) |
int | project6 (const vec3 &ax, const vec3 &p1, const vec3 &p2, const vec3 &p3, const vec3 &q1, const vec3 &q2, const vec3 &q3) |
double | segmSegmDistanceSq (const position &p1, const position &q1, const position &p2, const position &q2, position &c1, position &c2) |
bool | triangleIntersection (const Triangle &t1, const Triangle &t2) |
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. | |
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. |
Triangle functions to be inlined during release compilation. Do not put any of the necessary includes here, put them in both triangle.h and triangle.cpp instead.
Definition in file triangle_inl.h.
double Clamp | ( | double | n, | |
double | min, | |||
double | max | |||
) | [inline] |
Definition at line 199 of file triangle_inl.h.
Code from REAL-TIME COLLISION DETECTION by Christer Ericson, published by Elsevier.
Definition at line 148 of file triangle_inl.h.
double gmax | ( | double | d1, | |
double | d2, | |||
double | d3 | |||
) | [inline] |
Definition at line 32 of file triangle_inl.h.
double gmin | ( | double | d1, | |
double | d2, | |||
double | d3 | |||
) | [inline] |
Definition at line 40 of file triangle_inl.h.
int project6 | ( | const vec3 & | ax, | |
const vec3 & | p1, | |||
const vec3 & | p2, | |||
const vec3 & | p3, | |||
const vec3 & | q1, | |||
const vec3 & | q2, | |||
const vec3 & | q3 | |||
) | [inline] |
Definition at line 49 of file triangle_inl.h.
double segmSegmDistanceSq | ( | const position & | p1, | |
const position & | q1, | |||
const position & | p2, | |||
const position & | q2, | |||
position & | c1, | |||
position & | c2 | |||
) | [inline] |
Code from REAL-TIME COLLISION DETECTION by Christer Ericson, published by Elsevier.
Definition at line 208 of file triangle_inl.h.
Definition at line 70 of file triangle_inl.h.
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.