![]() |
Class used to find the intersection between a triangle and a capsule. More...
#include <SurgSim/Math/TriangleCapsuleContactCalculation-inl.h>
Public Member Functions | |
TriangleCapsuleContactCalculation (const Vector3 &tv0, const Vector3 &tv1, const Vector3 &tv2, const Vector3 &tn, const Vector3 &cv0, const Vector3 &cv1, double cr) | |
Constructor. More... | |
bool | isIntersecting () |
void | calculateContact (T *penetrationDepth, Vector3 *penetrationPointTriangle, Vector3 *penetrationPointCapsule, Vector3 *contactNormal, Vector3 *penetrationPointCapsuleAxis) |
Calculate the contact info. More... | |
Private Types | |
typedef Eigen::Matrix< T, 3, 1, MOpt > | Vector3 |
typedef Eigen::Matrix< T, 2, 1, MOpt > | Vector2 |
typedef Eigen::Transform< T, 3, Eigen::Isometry > | RigidTransform3 |
Private Member Functions | |
bool | axisAwayFromTriangle () |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, but the capsule axis does not intersect the triangle. More... | |
bool | axisPerpendicularToTriangle () |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, and the capsule axis is perpendicular to the triangle. More... | |
bool | axisTouchingTriangle () |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, and the capsule axis just touches the triangle. More... | |
bool | axisThroughTriangle () |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, and the capsule axis goes through the triangle. More... | |
double | farthestIntersectionLineCylinder (const Vector3 &lineStart, const Vector3 &lineDir, Vector3 *point=nullptr) |
double | farthestIntersectionLineCapsule (const Vector3 &lineStart, const Vector &lineDir, Vector3 *point, Vector3 *pointOnCapsuleAxis) |
size_t | clipSegmentAgainstTriangle (Vector3 *segmentStart, Vector3 *segmentEnd, Vector3 *v, Vector3 *planeN, double *planeD) |
Private Attributes | |
double | m_distance |
Distance between triangle and capsule. More... | |
RigidTransform3 | m_cTransform |
The transform of the capsule. More... | |
SurgSim::DataStructures::OptionalValue< RigidTransform3 > | m_cInverseTransform |
The inverse transform of the capsule. More... | |
T | m_epsilon |
epsilon More... | |
Vector3 | m_tv0 |
Vector3 | m_tv1 |
Vector3 | m_tv2 |
Vector3 | m_tn |
Vector3 | m_cvTop |
Capsule ends, axis , radius and length. More... | |
Vector3 | m_cvBottom |
Capsule ends, axis , radius and length. More... | |
Vector3 | m_cAxis |
Capsule ends, axis , radius and length. More... | |
double | m_cr |
Capsule ends, axis , radius and length. More... | |
double | m_cLength |
Capsule ends, axis , radius and length. More... | |
T | m_penetrationDepth |
Vector3 | m_penetrationPointTriangle |
Vector3 | m_penetrationPointCapsule |
Vector3 | m_contactNormal |
Vector3 | m_penetrationPointCapsuleAxis |
Class used to find the intersection between a triangle and a capsule.
T | Accuracy of the calculation, can usually be inferred. |
MOpt | Eigen Matrix options, can usually be inferred. |
|
private |
|
private |
|
private |
|
inline |
Constructor.
tv0,tv1,tv2 | Vertices of the triangle. |
tn | Normal of the triangle, should be normalized. |
cv0,cv1 | Ends of the capsule axis. |
cr | Capsule radius. |
|
inlineprivate |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, but the capsule axis does not intersect the triangle.
|
inlineprivate |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, and the capsule axis is perpendicular to the triangle.
|
inlineprivate |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, and the capsule axis goes through the triangle.
|
inlineprivate |
This function handles the contact data calculation for the case where there is an intersection between the capsule and the triangle, and the capsule axis just touches the triangle.
|
inline |
Calculate the contact info.
[out] | penetrationDepth | The depth of penetration. |
[out] | penetrationPointTriangle | The contact point on triangle. |
[out] | penetrationPointCapsule | The contact point on capsule. |
[out] | contactNormal | The contact normal that points from capsule to triangle. |
[out] | penetrationPointCapsuleAxis | The point on the capsule axis closest to the triangle. |
|
inlineprivate |
segmentStart | [in,out] The start of the line segment |
segmentEnd | [in,out] The end of the line segment |
v | The vertices of the triangle. |
planeN | Normals of the triangle and each of the edge planes. |
planeD | d from plane equation for the plane of the triangle and each of the edge planes. |
|
inlineprivate |
lineStart | The start of the line segment |
lineDir | The direction of the line segment |
point | [in,out] The point which is to be clipped. |
pointOnCapsuleAxis | [out] The recalculated point on the capsule axis. |
|
inlineprivate |
lineStart | The origin of the line |
lineDir | Unit directional vector of the line |
point | [out] The point of intersection. |
|
inline |
|
private |
Capsule ends, axis , radius and length.
|
private |
The inverse transform of the capsule.
|
private |
Capsule ends, axis , radius and length.
|
private |
Contact info
|
private |
Capsule ends, axis , radius and length.
|
private |
The transform of the capsule.
|
private |
Capsule ends, axis , radius and length.
|
private |
Capsule ends, axis , radius and length.
|
private |
Distance between triangle and capsule.
|
private |
epsilon
|
private |
Contact info
|
private |
Contact info
|
private |
Contact info
|
private |
Contact info
|
private |
Triangle vertices and normal.
|
private |
Triangle vertices and normal.
|
private |
Triangle vertices and normal.
|
private |
Triangle vertices and normal.