This class defines a triangle as a set of 3 points order in CCW fashion. More...
#include <Tri.h>

Public Member Functions | |
| Tri () | |
| Constructs a new triangle with all vertices at the origin. | |
| Tri (const Point< DATA_TYPE, 3 > &p1, const Point< DATA_TYPE, 3 > &p2, const Point< DATA_TYPE, 3 > &p3) | |
| Constructs a new triangle with the given points. | |
| Tri (const Tri< DATA_TYPE > &tri) | |
| Constructs a duplicate of the given triangle. | |
| Vec< DATA_TYPE, 3 > | edge (int idx) const |
| Gets the nth edge of the triangle where edge0 corresponds to the vector from vertex 0 to 1, edge1 corresponds to the vector from vertex 1 to 2 and edge2 corresponsds to the vector from vertex 2 to vertex 0. | |
| Vec< DATA_TYPE, 3 > | edge (int idx, int idy) const |
| get edge vec from two verts | |
| void | set (const Point< DATA_TYPE, 3 > &p1, const Point< DATA_TYPE, 3 > &p2, const Point< DATA_TYPE, 3 > &p3) |
| Set the triangle with the given points. | |
| Point< DATA_TYPE, 3 > & | operator[] (const unsigned idx) |
| Gets the nth vertex in the triangle. | |
| const Point< DATA_TYPE, 3 > & | operator[] (const unsigned idx) const |
Public Attributes | |
| Point< DATA_TYPE, 3 > | mVerts [3] |
| The vertices of the triangle. | |
This class defines a triangle as a set of 3 points order in CCW fashion.
Triangle points are tri(s,t) = b+s*e0+t*e1 where 0 <= s <= 1, 0 <= t <= 1, and 0 <= s+t <= 1.
Definition at line 23 of file Tri.h.
Gets the nth edge of the triangle where edge0 corresponds to the vector from vertex 0 to 1, edge1 corresponds to the vector from vertex 1 to 2 and edge2 corresponsds to the vector from vertex 2 to vertex 0.
| idx | the ordered edge index |
Definition at line 92 of file Tri.h.
{
gmtlASSERT( (0 <= idx) && (idx <= 2) );
int idx2 = ( idx == 2 ) ? 0 : idx + 1;
return (mVerts[idx2] - mVerts[idx]);
}
| Vec<DATA_TYPE, 3> gmtl::Tri< DATA_TYPE >::edge | ( | int | idx, | |
| int | idy | |||
| ) | const [inline] |
get edge vec from two verts
| idx,idy | the ordered vertex indicies |
Definition at line 106 of file Tri.h.
{
gmtlASSERT( (0 <= idx) && (idx <= 2) );
gmtlASSERT( (0 <= idy) && (idy <= 2) );
return (mVerts[idy] - mVerts[idx]);
}
| const Point<DATA_TYPE, 3>& gmtl::Tri< DATA_TYPE >::operator[] | ( | const unsigned | idx | ) | const [inline] |
Definition at line 75 of file Tri.h.
{
gmtlASSERT( idx <= 2 );
return mVerts[idx];
}
| Point<DATA_TYPE, 3>& gmtl::Tri< DATA_TYPE >::operator[] | ( | const unsigned | idx | ) | [inline] |
Gets the nth vertex in the triangle.
| idx | the index to the vertex in the triangle |
Definition at line 70 of file Tri.h.
{
gmtlASSERT( idx <= 2 );
return mVerts[idx];
}
1.7.1