1212#include < jet/implicit_surface2.h>
1313#include < jet/particle_emitter2.h>
1414#include < jet/point_generator2.h>
15+
1516#include < limits>
1617#include < memory>
1718#include < random>
@@ -33,9 +34,11 @@ class VolumeParticleEmitter2 final : public ParticleEmitter2 {
3334 // ! the particle generation region.
3435 // !
3536 // ! \param[in] implicitSurface The implicit surface.
36- // ! \param[in] bounds The max region.
37+ // ! \param[in] maxRegion The max region.
3738 // ! \param[in] spacing The spacing between particles.
38- // ! \param[in] initialVel The initial velocity.
39+ // ! \param[in] initialVel The initial velocity of new particles.
40+ // ! \param[in] linearVel The linear velocity of the emitter.
41+ // ! \param[in] angularVel The angular velocity of the emitter.
3942 // ! \param[in] maxNumberOfParticles The max number of particles to be
4043 // ! emitted.
4144 // ! \param[in] jitter The jitter amount between 0 and 1.
@@ -46,9 +49,11 @@ class VolumeParticleEmitter2 final : public ParticleEmitter2 {
4649 // !
4750 VolumeParticleEmitter2 (
4851 const ImplicitSurface2Ptr& implicitSurface,
49- const BoundingBox2D& bounds ,
52+ const BoundingBox2D& maxRegion ,
5053 double spacing,
5154 const Vector2D& initialVel = Vector2D(),
55+ const Vector2D& linearVel = Vector2D(),
56+ double angularVel = 0.0 ,
5257 size_t maxNumberOfParticles = kMaxSize ,
5358 double jitter = 0.0 ,
5459 bool isOneShot = true ,
@@ -65,6 +70,18 @@ class VolumeParticleEmitter2 final : public ParticleEmitter2 {
6570 // !
6671 void setPointGenerator (const PointGenerator2Ptr& newPointsGen);
6772
73+ // ! Returns source surface.
74+ const ImplicitSurface2Ptr& surface () const ;
75+
76+ // ! Sets the source surface.
77+ void setSurface (const ImplicitSurface2Ptr& newSurface);
78+
79+ // ! Returns max particle gen region.
80+ const BoundingBox2D& maxRegion () const ;
81+
82+ // ! Sets the max particle gen region.
83+ void setMaxRegion (const BoundingBox2D& newBox);
84+
6885 // ! Returns jitter amount.
6986 double jitter () const ;
7087
@@ -117,6 +134,18 @@ class VolumeParticleEmitter2 final : public ParticleEmitter2 {
117134 // ! Returns the initial velocity of the particles.
118135 void setInitialVelocity (const Vector2D& newInitialVel);
119136
137+ // ! Returns the linear velocity of the emitter.
138+ Vector2D linearVelocity () const ;
139+
140+ // ! Sets the linear velocity of the emitter.
141+ void setLinearVelocity (const Vector2D& newLinearVel);
142+
143+ // ! Returns the angular velocity of the emitter.
144+ double angularVelocity () const ;
145+
146+ // ! Sets the linear velocity of the emitter.
147+ void setAngularVelocity (double newAngularVel);
148+
120149 // ! Returns builder fox VolumeParticleEmitter2.
121150 static Builder builder ();
122151
@@ -127,6 +156,8 @@ class VolumeParticleEmitter2 final : public ParticleEmitter2 {
127156 BoundingBox2D _bounds;
128157 double _spacing;
129158 Vector2D _initialVel;
159+ Vector2D _linearVel;
160+ double _angularVel = 0.0 ;
130161 PointGenerator2Ptr _pointsGen;
131162
132163 size_t _maxNumberOfParticles = kMaxSize ;
@@ -152,6 +183,8 @@ class VolumeParticleEmitter2 final : public ParticleEmitter2 {
152183 Array1<Vector2D>* newVelocities);
153184
154185 double random ();
186+
187+ Vector2D velocityAt (const Vector2D& point) const ;
155188};
156189
157190// ! Shared pointer for the VolumeParticleEmitter2 type.
@@ -178,6 +211,12 @@ class VolumeParticleEmitter2::Builder final {
178211 // ! Returns builder with initial velocity.
179212 Builder& withInitialVelocity (const Vector2D& initialVel);
180213
214+ // ! Returns builder with linear velocity.
215+ Builder& withLinearVelocity (const Vector2D& linearVel);
216+
217+ // ! Returns builder with angular velocity.
218+ Builder& withAngularVelocity (double angularVel);
219+
181220 // ! Returns builder with max number of particles.
182221 Builder& withMaxNumberOfParticles (size_t maxNumberOfParticles);
183222
@@ -204,7 +243,9 @@ class VolumeParticleEmitter2::Builder final {
204243 bool _isBoundSet = false ;
205244 BoundingBox2D _bounds;
206245 double _spacing = 0.1 ;
207- Vector2D _initialVel{0 , 0 };
246+ Vector2D _initialVel;
247+ Vector2D _linearVel;
248+ double _angularVel = 0.0 ;
208249 size_t _maxNumberOfParticles = kMaxSize ;
209250 double _jitter = 0.0 ;
210251 bool _isOneShot = true ;
0 commit comments