VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
makVrv::DtGaussShooter Class Reference

A shooter class that shoots particles radially with a Gaussian distribution (selected for speed or lifetime).

This shooter mimics the osgParticle::RadialShooter with the exception that the random selection of speed or lifetime has a normal (or Gaussian) distribution. Setting a speed range for a Gaussian distribution of a property will set the probability of each particle to be within that range to one sigma of the normal distribution. For instance setting a speed range to [0.0, 10.0] will set the probability of 68.3% (one sigma) of the particles to be shot within the zero to ten meters-per-second range. Note that approximately 32% of the particles will be shot outside of the zero to ten range.

Since particle speeds are considered to always move at a positive speed, a caveat to the range is that the Mean of the normal distribution is always set to zero, the Standard Deviation is set to one and the result is multiplied by the maximum range value. The minimum range value is then, in fact, used as a hard boundary. For example, a range from one to ten [1.0, 10.0] will shoot particles where 68.3% are shot at ten meters-per-second or less, 32.7% are faster, but no particle will be moving slower than one meter-per-second.

mean = 0.0; stdDeviation = 1.0; speed = abs(normalDistribution(mean, stdDeviation)) * range.maximum; if (speed < range.minimum) speed = range.minimum;

If the shooter is flagged to have a normal distribution of lifetimes the speed will have a uniform distribution (same as a RadialShooter) over the given speed-range. Distribution over lifetime uses the maximum lifetime defined in the default particle template (found in the particle system), not defined in this shooter.

This shooter also defines a distance (in meters) in each of the three orthogonal directions (X, Y, Z) which are the one-sigma distances for distribution in that direction. For instance a normal distribution over the lifetime of the particle and a one-sigma distance of (10, 15 20) will result in 68.3% (one sigma) of the particles living to within ten meters in the X direction, fifteen meters in the Y direction and twenty meters in the Z direction from their starting point.

Inheritance diagram for makVrv::DtGaussShooter:
Inheritance graph
[legend]

Public Types

enum  DistributionType { NONE = 0, SPEED = 1, LIFE = 2 }
 

Public Member Functions

 DtGaussShooter ()
 
 DtGaussShooter (const DtGaussShooter &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 
 META_Object (osgParticle, DtGaussShooter)
 
void setDistributionType (DistributionType distType)
 
DistributionType distributionType () const
 
void setOneSigmaDistance (const osg::Vec3d &dist)
 
const osg::Vec3d & oneSigmaDistance () const
 
void setPhiRange (const osgParticle::rangef &range)
 
void setPhiRange (float min, float max)
 
const osgParticle::rangef & getPhiRange () const
 
void setThetaRange (const osgParticle::rangef &range)
 
void setThetaRange (float min, float max)
 
const osgParticle::rangef & getThetaRange () const
 
void setInitialSpeedRange (const osgParticle::rangef &range)
 
void setInitialSpeedRange (float min, float max)
 
const osgParticle::rangef & getInitialSpeedRange () const
 
void setInitialRotationalSpeedRange (const osgParticle::rangev3 &range)
 
void setInitialRotationalSpeedRange (const osg::Vec3d &min, const osg::Vec3d &max)
 
const osgParticle::rangev3 & getInitialRotationalSpeedRange () const
 
void shoot (osgParticle::Particle *particle) const
 
void setSeed (unsigned int seed)
 

Protected Member Functions

virtual ~DtGaussShooter ()
 
DtGaussShooteroperator= (const DtGaussShooter &)
 

Private Attributes

DistributionType myDistributionType
 
DtGaussianDistributionGenerator myGauss
 
osgParticle::rangef myPhiRange
 
osgParticle::rangef myThetaRange
 
osgParticle::rangef mySpeedRange
 
osgParticle::rangev3 myRotationRange
 
osg::Vec3d myOneSigmaDistance
 

Member Enumeration Documentation

Enumerator
NONE 
SPEED 
LIFE 

Constructor & Destructor Documentation

makVrv::DtGaussShooter::DtGaussShooter ( )
inline

Default CTOR.

makVrv::DtGaussShooter::DtGaussShooter ( const DtGaussShooter copy,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)
inline

Copy CTOR.

virtual makVrv::DtGaussShooter::~DtGaussShooter ( )
inlineprotectedvirtual

protected virtual destructor

Member Function Documentation

makVrv::DtGaussShooter::META_Object ( osgParticle  ,
DtGaussShooter   
)
void makVrv::DtGaussShooter::setDistributionType ( DistributionType  distType)
inline

Set the property type that has a Gaussian distribution applied.

Parameters
[in]distTypeis the property type for normal distribution, default is SPEED.
DistributionType makVrv::DtGaussShooter::distributionType ( ) const
inline

Get the property type that has a Gaussian distribution applied.

Returns
The property type for normal distribution.
See Also
setDistributionType(DistributionType)
void makVrv::DtGaussShooter::setOneSigmaDistance ( const osg::Vec3d &  dist)
inline

Set the one-sigma distance per orthogonal direction.

Parameters
[in]distis the distance in each direction where the probability of particle distribution within that distance is one-sigma (68.3%), default is Vec3(10, 10, 10).
const osg::Vec3d& makVrv::DtGaussShooter::oneSigmaDistance ( ) const
inline

Get the one-sigma distance per orthogonal direction.

Returns
The distance in each direction where the probability of particle distribution within that distance is one-sigma (68.3%).
See Also
setOneSigmaDistance(const osg::Vec3&)
void makVrv::DtGaussShooter::setPhiRange ( const osgParticle::rangef &  range)
inline

Set the range of possible values for phi angle. Phi is the angle in the XY plane from the X axis towards the Y axis.

Parameters
[in]rangeis the range of possible values, default [0, 2*PI].
Note
Particles receive a uniform distribution in this range.
void makVrv::DtGaussShooter::setPhiRange ( float  min,
float  max 
)
inline

Set the range of possible values for phi angle.

Parameters
[in]minis the minimum possible value.
[in]maxis the maximum possible value.
See Also
setPhiRange(const osgParticle::rangef&)
const osgParticle::rangef& makVrv::DtGaussShooter::getPhiRange ( ) const
inline

Get the range of possible values for phi angle.

Returns
The range of possible values.
See Also
setPhiRange(const osgParticle::rangef&)
void makVrv::DtGaussShooter::setThetaRange ( const osgParticle::rangef &  range)
inline

Set the range of possible values for theta angle. Theta is the angle from the XY plane towards the Z axis.

Parameters
[in]rangeis the range of possible values, default [0, PI].
Note
Particles receive a uniform distribution in this range.
void makVrv::DtGaussShooter::setThetaRange ( float  min,
float  max 
)
inline

Set the range of possible values for theta angle.

Parameters
[in]minis the minimum possible value.
[in]maxis the maximum possible value.
See Also
setThetaRange(const osgParticle::rangef&)
const osgParticle::rangef& makVrv::DtGaussShooter::getThetaRange ( ) const
inline

Get the range of possible values for theta angle.

Returns
The range of possible values.
See Also
setThetaRange(const osgParticle::rangef&)
void makVrv::DtGaussShooter::setInitialSpeedRange ( const osgParticle::rangef &  range)
inline

Set the range of possible values for initial speed of particles.

Parameters
[in]rangeis the range of possible values in meters-per-second, default [0.0, 1.0].
Note
When the Speed is set for Gaussian distribution, this value is saved but not used since the one-sigma distance and particle lifetime determine the speed. When the Lifetime is set for Gaussian distribution only the range-maximum is used for calculating the variable lifetime of the particle and speeds are constant. When neither the Speed nor the Lifetime are set for Gaussian distribution, this range is used to produce a uniform distribution between the range-minimum and range-maximum (same as osgParticle::RadialShooter).
void makVrv::DtGaussShooter::setInitialSpeedRange ( float  min,
float  max 
)
inline

Set the range of possible values for initial speed of particles.

Parameters
[in]minis the minimum possible value.
[in]maxis the maximum possible value.
See Also
setInitialSpeedRange(const osgParticle::rangef&)
const osgParticle::rangef& makVrv::DtGaussShooter::getInitialSpeedRange ( ) const
inline

Get the range of possible values for initial speed of particles.

Returns
The range of possible values.
See Also
setInitialSpeedRange(const osgParticle::rangef&)
void makVrv::DtGaussShooter::setInitialRotationalSpeedRange ( const osgParticle::rangev3 &  range)
inline

Set the range of possible values for initial rotational speed.

Parameters
[in]rangeis the range of possible values, default [Vec3(0, 0, 0), Vec3(0, 0, 0)].
Note
Particles receive a uniform distribution in this range.
void makVrv::DtGaussShooter::setInitialRotationalSpeedRange ( const osg::Vec3d &  min,
const osg::Vec3d &  max 
)
inline

Set the range of possible values for initial rotational speed.

Parameters
[in]minis the minimum possible value.
[in]maxis the maximum possible value.
See Also
setInitialRotationalSpeedRange(const osgParticle::rangev3&)
const osgParticle::rangev3& makVrv::DtGaussShooter::getInitialRotationalSpeedRange ( ) const
inline

Get the range of possible values for initial rotational speed.

Returns
The range of possible values.
See Also
setInitialRotationalSpeedRange(const osgParticle::rangev3&)
void makVrv::DtGaussShooter::shoot ( osgParticle::Particle *  particle) const
inline

Shoot a particle. Do not call this method.

Parameters
[in]particleis the particle to receive speed and angle.
void makVrv::DtGaussShooter::setSeed ( unsigned int  seed)

Set the seed of the random number generator.

Parameters
[in]seedis the seed to set the generator.
Note
This is only used for testing. Normally seeding is automatic and users do not need to call this function.
DtGaussShooter& makVrv::DtGaussShooter::operator= ( const DtGaussShooter )
inlineprotected

Protected copy operator.

Member Data Documentation

DistributionType makVrv::DtGaussShooter::myDistributionType
private
DtGaussianDistributionGenerator makVrv::DtGaussShooter::myGauss
private
osgParticle::rangef makVrv::DtGaussShooter::myPhiRange
private
osgParticle::rangef makVrv::DtGaussShooter::myThetaRange
private
osgParticle::rangef makVrv::DtGaussShooter::mySpeedRange
private
osgParticle::rangev3 makVrv::DtGaussShooter::myRotationRange
private
osg::Vec3d makVrv::DtGaussShooter::myOneSigmaDistance
private

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)