ParticleAPI 3.0.0 Performant particle system API in C++ for interactive graphics

Public Member Functions | Public Attributes | List of all members
PDUnion Struct Reference

A CSG union of multiple domains. More...

`#include <pDomain.h>`

Inheritance diagram for PDUnion:

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

## Public Attributes
std::vector< std::shared_ptr< pDomain > > | Doms
float | TotalSize
Public Attributes inherited from pDomain
pDomainType_E | Which

## Detailed Description

A CSG union of multiple domains.

A point is within this domain if it is within any subdomain. Generate returns a point from any subdomain. Within returns true if pos is within any subdomain.

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. Points are 0D.

## Constructor & Destructor Documentation

## ◆ PDUnion() [1/5]

PDUnion | ( |  | ) |
| inline

Use this one to create an empty PDUnion then call .insert() to add each item to it.

## ◆ PDUnion() [2/5]

PDUnion | ( | const pDomain & | A,
|  | const pDomain & | B
| ) |  |
| inline

## ◆ PDUnion() [3/5]

PDUnion | ( | const pDomain & | A,
|  | const pDomain & | B,
|  | const pDomain & | C
| ) |  |
| inline

## ◆ PDUnion() [4/5]

PDUnion | ( | const std::vector< std::shared_ptr< pDomain > > & | DomList | ) |
| inline

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

Note that the Generate() function goes faster if you supply DomList with the largest domains first.

## ◆ PDUnion() [5/5]

PDUnion | ( | const PDUnion & | P | ) |
| inline

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

## Member Function Documentation

## ◆ copy()

std::shared_ptr< pDomain > copy | ( |  | ) | const
| inlinevirtual

Implements pDomain.

## ◆ Generate()

pVec Generate | ( |  | ) | const
| inlinevirtual

Generate a point in any subdomain, chosen by the ratio of their sizes.

Implements pDomain.

## ◆ insert()

void insert | ( | const pDomain & | A | ) |
| inline

Insert another domain into this PDUnion.

## ◆ Size()

float Size | ( |  | ) | const
| inlinevirtual

Returns the size of the domain (length, area, or volume).

Implements pDomain.

## ◆ Within()

bool Within | ( | const pVec & | pos | ) | const
| inlinevirtual

Returns true if pos is within any of the domains.

Implements pDomain.

## Member Data Documentation

## ◆ Doms

std::vector<std::shared_ptr<pDomain> > Doms

## ◆ TotalSize

float TotalSize

The documentation for this struct was generated from the following file:

- pDomain.h