#include <Tri.h>
Collaboration diagram for gmtl::Tri:
Public Methods | |
Tri () | |
Constructs a new triangle with all vertices at the origin. More... | |
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. More... | |
Tri (const Tri< DATA_TYPE > &tri) | |
Constructs a duplicate of the given triangle. More... | |
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. More... | |
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. More... | |
Point< DATA_TYPE, 3 > & | operator[] (int idx) |
const Point< DATA_TYPE, 3 > & | operator[] (int idx) const |
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 52 of file Tri.h.
|
Constructs a new triangle with all vertices at the origin.
Definition at line 58 of file Tri.h.
00058 {} |
|
Constructs a new triangle with the given points. The points must be passed in in CCW order.
Definition at line 70 of file Tri.h.
00072 { 00073 mVerts[0] = p1; 00074 mVerts[1] = p2; 00075 mVerts[2] = p3; 00076 } |
|
Constructs a duplicate of the given triangle.
Definition at line 83 of file Tri.h.
00084 { 00085 mVerts[0] = tri[0]; 00086 mVerts[1] = tri[1]; 00087 mVerts[2] = tri[2]; 00088 } |
|
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.
Definition at line 121 of file Tri.h. References gmtlASSERT.
00122 { 00123 gmtlASSERT( (0 <= idx) && (idx <= 2) ); 00124 int idx2 = ( idx == 2 ) ? 0 : idx + 1; 00125 return (mVerts[idx2] - mVerts[idx]); 00126 } |
|
Definition at line 104 of file Tri.h. References gmtlASSERT.
00105 { 00106 gmtlASSERT( (0 <= idx) && (idx <= 2) ); 00107 return mVerts[idx]; 00108 } |
|
Definition at line 99 of file Tri.h. References gmtlASSERT.
00100 { 00101 gmtlASSERT( (0 <= idx) && (idx <= 2) ); 00102 return mVerts[idx]; 00103 } |
|
Set the triangle with the given points. The points must be passed in in CCW order.
Definition at line 138 of file Tri.h.
00140 { 00141 mVerts[0] = p1; 00142 mVerts[1] = p2; 00143 mVerts[2] = p3; 00144 } |