PDTriangle Class Reference

#include <pDomain.h>

Inheritance diagram for PDTriangle:

Inheritance graph
[legend]
Collaboration diagram for PDTriangle:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PDTriangle (const pVec &p0, const pVec &p1, const pVec &p2)
 ~PDTriangle ()
bool Within (const pVec &pos) const
pVec Generate () const
pDomaincopy () const

Public Attributes

pVec p
pVec u
pVec v
pVec uNrm
pVec vNrm
pVec nrm
float uLen
float vLen
float D


Detailed Description

Definition at line 85 of file pDomain.h.


Constructor & Destructor Documentation

PDTriangle::PDTriangle ( const pVec p0,
const pVec p1,
const pVec p2 
) [inline]

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     }

Here is the call graph for this function:

Here is the caller graph for this function:

PDTriangle::~PDTriangle (  )  [inline]

Definition at line 110 of file pDomain.h.

00111     {
00112     }


Member Function Documentation

bool PDTriangle::Within ( const pVec pos  )  const [inline, virtual]

Implements pDomain.

Definition at line 114 of file pDomain.h.

00115     {
00116         return false;
00117     }

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     }

Here is the call graph for this function:


Member Data Documentation

pVec PDTriangle::p

Definition at line 88 of file pDomain.h.

Referenced by PABounce::Exec(), PAAvoid::Exec(), Generate(), and PDTriangle().

pVec PDTriangle::u

Definition at line 88 of file pDomain.h.

Referenced by PABounce::Exec(), PAAvoid::Exec(), Generate(), and PDTriangle().

pVec PDTriangle::v

Definition at line 88 of file pDomain.h.

Referenced by PABounce::Exec(), PAAvoid::Exec(), Generate(), and PDTriangle().

pVec PDTriangle::uNrm

Definition at line 88 of file pDomain.h.

Referenced by PAAvoid::Exec(), and PDTriangle().

pVec PDTriangle::vNrm

Definition at line 88 of file pDomain.h.

Referenced by PAAvoid::Exec(), and PDTriangle().

pVec PDTriangle::nrm

Definition at line 88 of file pDomain.h.

Referenced by PABounce::Exec(), PAAvoid::Exec(), and PDTriangle().

float PDTriangle::uLen

Definition at line 89 of file pDomain.h.

Referenced by PDTriangle().

float PDTriangle::vLen

Definition at line 89 of file pDomain.h.

Referenced by PDTriangle().

float PDTriangle::D

Definition at line 89 of file pDomain.h.

Referenced by PABounce::Exec(), PAAvoid::Exec(), and PDTriangle().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:52:03 2008 for Armagetron Advanced by  doxygen 1.5.4