#include <pDomain.h>
Public Member Functions | |
PDTriangle (const pVec &p0, const pVec &p1, const pVec &p2) | |
~PDTriangle () | |
bool | Within (const pVec &pos) const |
pVec | Generate () const |
pDomain * | copy () const |
Public Attributes | |
pVec | p |
pVec | u |
pVec | v |
pVec | uNrm |
pVec | vNrm |
pVec | nrm |
float | uLen |
float | vLen |
float | D |
Definition at line 85 of file pDomain.h.
Definition at line 92 of file pDomain.h.
References D, pVec::length(), pVec::normalize(), nrm, p, u, uLen, uNrm, v, vLen, and vNrm.
Referenced by copy().
00093 { 00094 p = p0; 00095 u = p1 - p0; 00096 v = p2 - p0; 00097 00098 // The rest of this is needed for Avoid and Bounce. 00099 uLen = u.length(); 00100 uNrm = u / uLen; 00101 vLen = v.length(); 00102 vNrm = v / vLen; 00103 00104 nrm = Cross(uNrm, vNrm); // This is the non-unit normal. 00105 nrm.normalize(); // Must normalize it. 00106 00107 D = -(p * nrm); 00108 }
bool PDTriangle::Within | ( | const pVec & | pos | ) | const [inline, virtual] |
pVec PDTriangle::Generate | ( | ) | const [inline, virtual] |
Implements pDomain.
Definition at line 119 of file pDomain.h.
References p, pos, pRandf, u, and v.
00120 { 00121 float r1 = pRandf(); 00122 float r2 = pRandf(); 00123 pVec pos; 00124 if(r1 + r2 < 1.0f) 00125 pos = p + u * r1 + v * r2; 00126 else 00127 pos = p + u * (1.0f-r1) + v * (1.0f-r2); 00128 00129 return pos; 00130 }
pDomain* PDTriangle::copy | ( | ) | const [inline, virtual] |
Implements pDomain.
Definition at line 132 of file pDomain.h.
References PDTriangle().
00133 { 00134 PDTriangle *P = new PDTriangle(*this); 00135 return P; 00136 }
Definition at line 88 of file pDomain.h.
Referenced by PABounce::Exec(), PAAvoid::Exec(), Generate(), and PDTriangle().
Definition at line 88 of file pDomain.h.
Referenced by PABounce::Exec(), PAAvoid::Exec(), Generate(), and PDTriangle().
Definition at line 88 of file pDomain.h.
Referenced by PABounce::Exec(), PAAvoid::Exec(), Generate(), and PDTriangle().
Definition at line 88 of file pDomain.h.
Referenced by PABounce::Exec(), PAAvoid::Exec(), and PDTriangle().
float PDTriangle::uLen |
float PDTriangle::vLen |
float PDTriangle::D |
Definition at line 89 of file pDomain.h.
Referenced by PABounce::Exec(), PAAvoid::Exec(), and PDTriangle().