Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SurgSim::Math::TriangleHelper< T, MOpt > Class Template Reference

A helper class for a triangle, used for the following two purposes: More...

#include <SurgSim/Math/TriangleTriangleContactCalculation-inl.h>

Public Member Functions

 TriangleHelper (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, const Vector3 &n)
 Constructor using the triangle data to initialize. More...
 
void findDeepestPenetrationWithTriangle (const TriangleHelper &triangle, T *penetrationDepth, Vector3 *penetrationPoint0, Vector3 *penetrationPoint1)
 Given a triangle, find the deepest vertex in the swept volume of that triangle. More...
 

Private Types

typedef Eigen::Matrix< T, 3, 1, MOpt > Vector3
 
typedef boost::container::static_vector< Vector3, CAPACITYVertices
 

Private Member Functions

void getPrismPlane (size_t index, Vector3 *planeNormal, T *planeD) const
 Get the bounding plane of the swept volume of this triangle. More...
 
void clipAgainstPlane (const Vector3 &planeN, T planeD)
 Clip the polygon given a plane. More...
 
void findDeepestVertexUnderPlane (const Vector3 &planeN, T planeD, T *depth, Vector3 *point) const
 Find the deepest vertex of this polygon under the plane. More...
 

Private Attributes

const Vector3m_vertices [3]
 Original vertices of the triangle. More...
 
const Vector3m_normal
 Normal of the triangle. More...
 
m_planeD
 d from the plane equation (n.x + d = 0) for the plane of this triangle. More...
 
Vertices m_clippedVerticesBuffer [2]
 The buffers for the clipped vertices of the triangle. More...
 
size_t m_receiverBufferIndex
 

Static Private Attributes

static const size_t CAPACITY = 10
 

Detailed Description

template<class T, int MOpt>
class SurgSim::Math::TriangleHelper< T, MOpt >

A helper class for a triangle, used for the following two purposes:

Member Typedef Documentation

template<class T, int MOpt>
typedef Eigen::Matrix<T, 3, 1, MOpt> SurgSim::Math::TriangleHelper< T, MOpt >::Vector3
private
template<class T, int MOpt>
typedef boost::container::static_vector<Vector3, CAPACITY> SurgSim::Math::TriangleHelper< T, MOpt >::Vertices
private

Constructor & Destructor Documentation

template<class T, int MOpt>
SurgSim::Math::TriangleHelper< T, MOpt >::TriangleHelper ( const Vector3 v0,
const Vector3 v1,
const Vector3 v2,
const Vector3 n 
)
inline

Constructor using the triangle data to initialize.

Parameters
v0,v1,v2The vertices of the triangle.
nThe normal of the triangle.

Member Function Documentation

template<class T, int MOpt>
void SurgSim::Math::TriangleHelper< T, MOpt >::clipAgainstPlane ( const Vector3 planeN,
planeD 
)
inlineprivate

Clip the polygon given a plane.

Any part of the polygon above this plane is clipped.

Note
This may alter the number of vertices in this polygon.
Parameters
planeNThe normal of the clipping plane.
planeDThe d from plane eqn (nx + d) of the clipping plane.
template<class T, int MOpt>
void SurgSim::Math::TriangleHelper< T, MOpt >::findDeepestPenetrationWithTriangle ( const TriangleHelper< T, MOpt > &  triangle,
T *  penetrationDepth,
Vector3 penetrationPoint0,
Vector3 penetrationPoint1 
)
inline

Given a triangle, find the deepest vertex in the swept volume of that triangle.

Parameters
triangleThe triangle against which the penetration is checked.
[out]penetrationDepthThe depth of the deepest point in this triangle to the triangle sent in.
[out]penetrationPoint0The penetration point on this triangle.
[out]penetrationPoint1The penetration point on the triangle sent in.
template<class T, int MOpt>
void SurgSim::Math::TriangleHelper< T, MOpt >::findDeepestVertexUnderPlane ( const Vector3 planeN,
planeD,
T *  depth,
Vector3 point 
) const
inlineprivate

Find the deepest vertex of this polygon under the plane.

Note
Asserts if there are no vertices in the polygon.
Parameters
planeNThe normal of the plane.
planeDThe distance from origin of the plane.
[out]depthThe depth of the deepest point in the polygon from the given plane.
[out]pointThe deepest point in the polgon from the given plane.
template<class T, int MOpt>
void SurgSim::Math::TriangleHelper< T, MOpt >::getPrismPlane ( size_t  index,
Vector3 planeNormal,
T *  planeD 
) const
inlineprivate

Get the bounding plane of the swept volume of this triangle.

The swept volume of a triangle is an infinitely long prism.

Parameters
indexThere are three prism sides, the index indicates which one is to be calculated.
planeNormalThe outward facing normal of the prism plane.
planeDd from the plane equation (n.x + d = 0) of the prism plane.

Member Data Documentation

template<class T, int MOpt>
const size_t SurgSim::Math::TriangleHelper< T, MOpt >::CAPACITY = 10
staticprivate
template<class T, int MOpt>
Vertices SurgSim::Math::TriangleHelper< T, MOpt >::m_clippedVerticesBuffer[2]
private

The buffers for the clipped vertices of the triangle.

template<class T, int MOpt>
const Vector3& SurgSim::Math::TriangleHelper< T, MOpt >::m_normal
private

Normal of the triangle.

template<class T, int MOpt>
T SurgSim::Math::TriangleHelper< T, MOpt >::m_planeD
private

d from the plane equation (n.x + d = 0) for the plane of this triangle.

template<class T, int MOpt>
size_t SurgSim::Math::TriangleHelper< T, MOpt >::m_receiverBufferIndex
private
template<class T, int MOpt>
const Vector3* SurgSim::Math::TriangleHelper< T, MOpt >::m_vertices[3]
private

Original vertices of the triangle.


The documentation for this class was generated from the following file: