#include <CTriangle.h>
Public Member Functions | |
cTriangle (cMesh *a_parent, const unsigned int a_indexVertex0, const unsigned int a_indexVertex1, const unsigned int a_indexVertex2) | |
cTriangle () | |
~cTriangle () | |
void | setVertices (const unsigned int a_indexVertex0, const unsigned int a_indexVertex1, const unsigned int a_indexVertex2) |
cVertex * | getVertex0 () const |
cVertex * | getVertex1 () const |
cVertex * | getVertex2 () const |
cVertex * | getVertex (int vi) const |
unsigned int | getVertexIndex (int vi) const |
unsigned int | getIndexVertex0 () const |
unsigned int | getIndexVertex1 () const |
unsigned int | getIndexVertex2 () const |
unsigned int | getIndex () const |
cMesh * | getParent () const |
void | setParent (cMesh *parent) |
bool | allocated () const |
bool | computeCollision (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings) const |
double | computeArea () |
Public Attributes | |
unsigned int | m_indexVertex0 |
Index number of vertex 0 (defines a location in my owning mesh's vertex array). | |
unsigned int | m_indexVertex1 |
Index number of vertex 1 (defines a location in my owning mesh's vertex array). | |
unsigned int | m_indexVertex2 |
Index number of vertex 2 (defines a location in my owning mesh's vertex array). | |
unsigned int | m_index |
Index number of this triangle (defines a location in my owning mesh's triangle array). | |
cMesh * | m_parent |
The mesh that owns me. | |
bool | m_allocated |
Is this triangle still active? | |
int | m_tag |
For custom use. No specific purpose. | |
std::vector< cTriangle * > * | m_neighbors |
A mesh can be organized into a network of neighboring triangles, which are stored here... |
cTriangle::cTriangle | ( | cMesh * | a_parent, | |
const unsigned int | a_indexVertex0, | |||
const unsigned int | a_indexVertex1, | |||
const unsigned int | a_indexVertex2 | |||
) | [inline] |
Constructor of cTriangle.
a_parent | Parent mesh. | |
a_indexVertex0 | index position of vertex 0. | |
a_indexVertex1 | index position of vertex 1. | |
a_indexVertex2 | index position of vertex 2. |
cTriangle::cTriangle | ( | ) | [inline] |
Default constructor of cTriangle.
cTriangle::~cTriangle | ( | ) | [inline] |
Destructor of cTriangle.
bool cTriangle::allocated | ( | ) | const [inline] |
Is this triangle allocated to an existing mesh?
double cTriangle::computeArea | ( | ) | [inline] |
Compute and return the area of this triangle.
bool cTriangle::computeCollision | ( | cVector3d & | a_segmentPointA, | |
cVector3d & | a_segmentPointB, | |||
cCollisionRecorder & | a_recorder, | |||
cCollisionSettings & | a_settings | |||
) | const [inline] |
Check if a ray intersects this triangle. The ray is described by its origin (a_origin) and its direction (a_direction).
If a collision occurs, this information is stored in the collision recorder a_recorder.
This is one of the most performance-critical routines in CHAI, so we have code here for a couple different approaches that may become useful in different scenarios.
a_segmentPointA | Point from where collision ray starts (in local frame). | |
a_segmentPointB | Direction vector of collision ray (in local frame). | |
a_recorder | Stores collision events | |
a_settings | Settings related to collision detection process. |
unsigned int cTriangle::getIndex | ( | ) | const [inline] |
Read the index of this triangle (defines a location in my owning mesh's triangle array).
unsigned int cTriangle::getIndexVertex0 | ( | ) | const [inline] |
Read index number of vertex 0 (defines a location in my owning mesh's vertex array).
unsigned int cTriangle::getIndexVertex1 | ( | ) | const [inline] |
Read index number of vertex 1 (defines a location in my owning mesh's vertex array).
unsigned int cTriangle::getIndexVertex2 | ( | ) | const [inline] |
Read index number of vertex 2 (defines a location in my owning mesh's vertex array).
cMesh* cTriangle::getParent | ( | ) | const [inline] |
Retrieve a pointer to the mesh that owns this triangle.
cVertex* cTriangle::getVertex | ( | int | vi | ) | const [inline] |
Access a pointer to the specified vertex of this triangle.
vi | The triangle (0, 1, or 2) to access. |
cVertex* cTriangle::getVertex0 | ( | ) | const [inline] |
Read pointer to vertex 0 of triangle.
cVertex* cTriangle::getVertex1 | ( | ) | const [inline] |
Read pointer to vertex 1 of triangle.
cVertex* cTriangle::getVertex2 | ( | ) | const [inline] |
Read pointer to vertex 2 of triangle.
unsigned int cTriangle::getVertexIndex | ( | int | vi | ) | const [inline] |
Access the index of the specified vertex of this triangle.
vi | The triangle (0, 1, or 2) to access. |
void cTriangle::setParent | ( | cMesh * | parent | ) | [inline] |
Set pointer to mesh parent of triangle.
void cTriangle::setVertices | ( | const unsigned int | a_indexVertex0, | |
const unsigned int | a_indexVertex1, | |||
const unsigned int | a_indexVertex2 | |||
) | [inline] |
Set the vertices of the triangle by passing the index numbers of the corresponding vertices.
a_indexVertex0 | index position of vertex 0. | |
a_indexVertex1 | index position of vertex 1. | |
a_indexVertex2 | index position of vertex 2. |