15 #include "sphereVolumeEmitter.h" 35 _radius = copy._radius;
36 _particle_pos = copy._particle_pos;
63 void SphereVolumeEmitter::
64 assign_initial_position(
LPoint3& pos) {
65 PN_stdfloat z, theta, r;
69 r = sqrtf((_radius * _radius) - (z * z));
70 theta = NORMALIZED_RAND() * 2.0f * MathNumbers::pi_f;
72 t = NORMALIZED_RAND();
75 t = NORMALIZED_RAND();
77 PN_stdfloat pos_x = r * cosf(theta) * t;
78 PN_stdfloat pos_y = r * sinf(theta) * t;
79 PN_stdfloat pos_z = z * t;
81 _particle_pos.set(pos_x, pos_y, pos_z);
90 void SphereVolumeEmitter::
91 assign_initial_velocity(
LVector3& vel) {
94 vel = _particle_pos / _radius;
106 out<<
"SphereVolumeEmitter";
117 write(ostream &out,
int indent)
const {
119 out.width(indent); out<<
""; out<<
"SphereVolumeEmitter:\n";
120 out.width(indent+2); out<<
""; out<<
"_radius "<<_radius<<
"\n";
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
SphereVolumeEmitter()
constructor
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Describes a voluminous spherical region in which particles are generated.
virtual void write(ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual BaseParticleEmitter * make_copy()
copier
Describes a physical region in space in which particles are randomly generated.
virtual ~SphereVolumeEmitter()
destructor