A helper class for a triangle, used for the following two purposes:
More...
#include <SurgSim/Math/TriangleTriangleContactCalculation-inl.h>
template<class T, int MOpt>
class SurgSim::Math::TriangleHelper< T, MOpt >
A helper class for a triangle, used for the following two purposes:
- Clip against a given plane.
- Find the deepest point given a plane. Created as a triangle and can become 4 or more sided polygon when clipped.
- Note
- The vertices are stored in order, so that the edges of the polygon run between adjacent vertices (and from the last vertex to the first).
- Template Parameters
-
T | Accuracy of the calculation. |
MOpt | Eigen Matrix options. |
◆ Vector3
template<class T , int MOpt>
◆ Vertices
template<class T , int MOpt>
◆ TriangleHelper()
template<class T , int MOpt>
Constructor using the triangle data to initialize.
- Parameters
-
v0,v1,v2 | The vertices of the triangle. |
n | The normal of the triangle. |
◆ clipAgainstPlane()
template<class T , int MOpt>
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
-
planeN | The normal of the clipping plane. |
planeD | The d from plane eqn (nx + d) of the clipping plane. |
◆ findDeepestPenetrationWithTriangle()
template<class T , int MOpt>
Given a triangle, find the deepest vertex in the swept volume of that triangle.
- Parameters
-
| triangle | The triangle against which the penetration is checked. |
[out] | penetrationDepth | The depth of the deepest point in this triangle to the triangle sent in. |
[out] | penetrationPoint0 | The penetration point on this triangle. |
[out] | penetrationPoint1 | The penetration point on the triangle sent in. |
◆ findDeepestVertexUnderPlane()
template<class T , int MOpt>
Find the deepest vertex of this polygon under the plane.
- Note
- Asserts if there are no vertices in the polygon.
- Parameters
-
| planeN | The normal of the plane. |
| planeD | The distance from origin of the plane. |
[out] | depth | The depth of the deepest point in the polygon from the given plane. |
[out] | point | The deepest point in the polgon from the given plane. |
◆ getPrismPlane()
template<class T , int MOpt>
Get the bounding plane of the swept volume of this triangle.
The swept volume of a triangle is an infinitely long prism.
- Parameters
-
index | There are three prism sides, the index indicates which one is to be calculated. |
planeNormal | The outward facing normal of the prism plane. |
planeD | d from the plane equation (n.x + d = 0) of the prism plane. |
◆ CAPACITY
template<class T , int MOpt>
◆ m_clippedVerticesBuffer
template<class T , int MOpt>
The buffers for the clipped vertices of the triangle.
◆ m_normal
template<class T , int MOpt>
◆ m_planeD
template<class T , int MOpt>
d from the plane equation (n.x + d = 0) for the plane of this triangle.
◆ m_receiverBufferIndex
template<class T , int MOpt>
◆ m_vertices
template<class T , int MOpt>
Original vertices of the triangle.
The documentation for this class was generated from the following file: