PDUnion Class Reference

A CSG union of multiple domains. More...

#include <pDomain.h>

Inheritance diagram for PDUnion:

pDomain

List of all members.

Public Member Functions

 PDUnion ()
 Use this one to create an empty PDUnion then call .insert() to add each item to it.
 PDUnion (const pDomain &A, const pDomain &B)
 PDUnion (const pDomain &A, const pDomain &B, const pDomain &C)
 PDUnion (const std::vector< pDomain * > &DomList)
 Makes a copy of all the subdomains and point to the copies.
 PDUnion (const PDUnion &P)
void insert (const pDomain &A)
 Insert another domain into this PDUnion.
bool Within (const pVec &pos) const
 Returns true if pos is within any of the domains.
pVec Generate () const
 Generate a point in any subdomain, chosen by the ratio of their sizes.
float Size () const
 Returns the size of the domain (length, area, or volume).
pDomaincopy () const

Public Attributes

std::vector< pDomain * > Doms
float TotalSize


Detailed Description

A CSG union of multiple domains.

A point is within this domain if it is within domain A OR B. Generate returns a point from either domain. Within returns true if pos is within A or within B.

All domains have a Size() that is used to apportion probability between the domains in the union. Sizes of domains of the same dimensionality are commensurate but sizes of differing dimensionality are not. Thus, to properly distribute probability of Generate() choosing each domain, it is wise to only combine domains that have the same dimensionality. Note that thin shelled cylinders, cones, and spheres, where InnerRadius==OuterRadius, are considered 2D, not 3D. Thin shelled discs (circles) are considered 1D.


Constructor & Destructor Documentation

PDUnion ( const std::vector< pDomain * > &  DomList  )  [inline]

Makes a copy of all the subdomains and point to the copies.

Note that the Generate() function gets a performance boost if you supply DomList with the largest domains first.


Generated on Tue Dec 30 11:28:40 2008 for ParticleAPI by  doxygen 1.5.8