PDDisc Class Reference

#include <pDomain.h>

Inheritance diagram for PDDisc:

Inheritance graph
[legend]
Collaboration diagram for PDDisc:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PDDisc (const pVec &ctr0, const pVec nrm0, const float radOut0, const float radIn0=0.0f)
 ~PDDisc ()
bool Within (const pVec &pos) const
pVec Generate () const
pDomaincopy () const

Public Attributes

pVec p
pVec nrm
pVec u
pVec v
float radIn
float radOut
float radInSqr
float radOutSqr
float dif
float D


Detailed Description

Definition at line 571 of file pDomain.h.


Constructor & Destructor Documentation

PDDisc::PDDisc ( const pVec ctr0,
const pVec  nrm0,
const float  radOut0,
const float  radIn0 = 0.0f 
) [inline]

Definition at line 578 of file pDomain.h.

References D, dif, fabsf(), fsqr(), pVec::normalize(), nrm, p, radIn, radInSqr, radOut, radOutSqr, u, and v.

Referenced by copy().

00579     {
00580         p = ctr0;
00581         nrm = nrm0;
00582         nrm.normalize();
00583 
00584         if(radOut0 > radIn0) {
00585             radOut = radOut0; radIn = radIn0;
00586         } else {
00587             radOut = radIn0; radIn = radOut0;
00588         }
00589         dif = radOut - radIn;
00590         radInSqr = fsqr(radIn);
00591         radOutSqr = fsqr(radOut);
00592 
00593         // Find a vector orthogonal to n.
00594         pVec basis(1.0f, 0.0f, 0.0f);
00595         if (fabsf(basis * nrm) > 0.999f)
00596             basis = pVec(0.0f, 1.0f, 0.0f);
00597 
00598         // Project away N component, normalize and cross to get
00599         // second orthonormal vector.
00600         u = basis - nrm * (basis * nrm);
00601         u.normalize();
00602         v = Cross(nrm, u);
00603         D = -(p * nrm);
00604     }

Here is the call graph for this function:

Here is the caller graph for this function:

PDDisc::~PDDisc (  )  [inline]

Definition at line 606 of file pDomain.h.

00607     {
00608     }


Member Function Documentation

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

Implements pDomain.

Definition at line 610 of file pDomain.h.

00611     {
00612         return false;
00613     }

pVec PDDisc::Generate (  )  const [inline, virtual]

Implements pDomain.

Definition at line 615 of file pDomain.h.

References cosf(), dif, M_PI, p, pos, pRandf, radIn, sinf(), u, v, and x.

00616     {
00617         // Might be faster to generate a point in a square and reject if outside the circle
00618         float theta = pRandf() * 2.0f * float(M_PI); // Angle around normal
00619         // Distance from center
00620         float r = radIn + pRandf() * dif;
00621 
00622         float x = r * cosf(theta); // Weighting of each frame vector
00623         float y = r * sinf(theta);
00624 
00625         pVec pos = p + u * x + v * y;
00626         return pos;
00627     }

Here is the call graph for this function:

pDomain* PDDisc::copy (  )  const [inline, virtual]

Implements pDomain.

Definition at line 629 of file pDomain.h.

References PDDisc().

00630     {
00631         PDDisc *P = new PDDisc(*this);
00632         return P;
00633     }

Here is the call graph for this function:


Member Data Documentation

pVec PDDisc::p

Definition at line 574 of file pDomain.h.

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

pVec PDDisc::nrm

Definition at line 574 of file pDomain.h.

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

pVec PDDisc::u

Definition at line 574 of file pDomain.h.

Referenced by Generate(), and PDDisc().

pVec PDDisc::v

Definition at line 574 of file pDomain.h.

Referenced by Generate(), and PDDisc().

float PDDisc::radIn

Definition at line 575 of file pDomain.h.

Referenced by Generate(), and PDDisc().

float PDDisc::radOut

Definition at line 575 of file pDomain.h.

Referenced by PDDisc().

float PDDisc::radInSqr

Definition at line 575 of file pDomain.h.

Referenced by PDDisc().

float PDDisc::radOutSqr

Definition at line 575 of file pDomain.h.

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

float PDDisc::dif

Definition at line 575 of file pDomain.h.

Referenced by Generate(), and PDDisc().

float PDDisc::D

Definition at line 575 of file pDomain.h.

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


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