A modifier defining a vortex in the universe. More...
Public Member Functions | |
Vortex (const Vector3D &position=Vector3D(), const Vector3D &direction=Vector3D(0.0f, 1.0f, 0.0f), float rotationSpeed=1.0f, float attractionSpeed=0.0f) | |
Constructor of vortex. | |
void | setPosition (const Vector3D &position) |
Sets the position of the eye of the vortex. | |
void | setDirection (const Vector3D &direction) |
Sets the direction of the eye of the vortex. | |
void | setRotationSpeed (float rotationSpeed, bool angular) |
Sets the rotation speed of the vortex. | |
void | setAttractionSpeed (float attractionSpeed, bool linear) |
Sets the attraction speed of the vortex. | |
void | setEyeRadius (float eyeRadius) |
Sets the eye radius. | |
void | enableParticleKilling (bool kill) |
Tells whether particles is the eye must be killed or not. | |
const Vector3D & | getPosition () const |
Gets the position of the eye. | |
const Vector3D & | getDirection () const |
Gets the direction of the eye. | |
const Vector3D & | getTransformedPosition () const |
Gets the transformed position of the eye. | |
const Vector3D & | getTransformedDirection () const |
Gets the transformed direction of the eye. | |
float | getRotationSpeed () const |
Gets the rotation speed. | |
float | getAttractionSpeed () const |
Gets the attraction speed. | |
bool | isRotationSpeedAngular () const |
Tells whether rotation speed is angular. | |
bool | isAttractionSpeedLinear () const |
Tells whether attraction speed is function of the distance from the eye. | |
float | getEyeRadius () const |
Returns the eye radius. | |
bool | isParticleKillingEnabled () const |
Tells whether particles are killed when in the eye. | |
Static Public Member Functions | |
static Vortex * | create (const Vector3D &position=Vector3D(), const Vector3D &direction=Vector3D(0.0f, 1.0f, 0.0f), float rotationSpeed=1.0f, float attractionSpeed=0.0f) |
Creates and registers a new Vortex. | |
Protected Member Functions | |
virtual void | innerUpdateTransform () |
Updates all the parameters in the world coordinates. |
A modifier defining a vortex in the universe.
A vortex is a spinning flow around a center. Its center (its eye) is defined as a line in the universe.
In addition to its center line, a vortex is defined by 2 speeds :
The rotation speed can be defined either in units per second or in radians per seconds. In the first case, the closer to the eye particles are, the faster they will spin around. In the second case, the speed is constant.
The attraction speed can be either constant or linear (function of the distance to the eye). In the second case, the farther particles are from the eye, the faster the are attracted (or repeled). First case can be assimilated to a Archimedes' spiral while second is more a logarithmic spiral (Bernoulli's).
The vertex eye radius can be defined. The user has also the possibility to tell the vortex to destroy particles that enter its eye automatically.
Note that this modifier does not update particle's velocity. Therefore particles modified by a vortex does not have any inertia.
This is because defining an accurate vortex in a discrete environment cannot be performed by using the derivatives of the position and velocity.
Definition at line 54 of file SPK_Vortex.h.
Vortex | ( | const Vector3D & | position = Vector3D() , |
|
const Vector3D & | direction = Vector3D(0.0f, 1.0f, 0.0f) , |
|||
float | rotationSpeed = 1.0f , |
|||
float | attractionSpeed = 0.0f | |||
) |
Constructor of vortex.
position | : the position of the eye | |
direction | : the direction of the eye | |
rotationSpeed | : the speed of rotation | |
attractionSpeed | : the speed of attraction |
Vortex * create | ( | const Vector3D & | position = Vector3D() , |
|
const Vector3D & | direction = Vector3D(0.0f,1.0f,0.0f) , |
|||
float | rotationSpeed = 1.0f , |
|||
float | attractionSpeed = 0.0f | |||
) | [static] |
Creates and registers a new Vortex.
position | : the position of the eye | |
direction | : the direction of the eye | |
rotationSpeed | : the speed of rotation | |
attractionSpeed | : the speed of attraction |
Definition at line 242 of file SPK_Vortex.h.
void enableParticleKilling | ( | bool | kill | ) |
Tells whether particles is the eye must be killed or not.
kill | : true to kill particles in the eye, false not to |
Definition at line 282 of file SPK_Vortex.h.
float getAttractionSpeed | ( | ) | const |
Gets the attraction speed.
Definition at line 312 of file SPK_Vortex.h.
const Vector3D & getDirection | ( | ) | const |
Gets the direction of the eye.
Definition at line 292 of file SPK_Vortex.h.
float getEyeRadius | ( | ) | const |
const Vector3D & getPosition | ( | ) | const |
Gets the position of the eye.
Definition at line 287 of file SPK_Vortex.h.
float getRotationSpeed | ( | ) | const |
const Vector3D & getTransformedDirection | ( | ) | const |
Gets the transformed direction of the eye.
Definition at line 302 of file SPK_Vortex.h.
const Vector3D & getTransformedPosition | ( | ) | const |
Gets the transformed position of the eye.
Definition at line 297 of file SPK_Vortex.h.
virtual void innerUpdateTransform | ( | ) | [protected, virtual] |
Updates all the parameters in the world coordinates.
This method can be overriden in derived classes of Transformable (By default it does nothing).
It is this method task to compute all parameters of the class that are dependent of the world transform.
Reimplemented from Transformable.
bool isAttractionSpeedLinear | ( | ) | const |
Tells whether attraction speed is function of the distance from the eye.
Definition at line 322 of file SPK_Vortex.h.
bool isParticleKillingEnabled | ( | ) | const |
Tells whether particles are killed when in the eye.
Definition at line 332 of file SPK_Vortex.h.
bool isRotationSpeedAngular | ( | ) | const |
Tells whether rotation speed is angular.
Definition at line 317 of file SPK_Vortex.h.
void setAttractionSpeed | ( | float | attractionSpeed, | |
bool | linear | |||
) |
Sets the attraction speed of the vortex.
The attraction speed is the speed that move particles towards the eye of the vortex.
It can either be constant or linear (function of the distance of the particle from the eye).
A constant attraction speed is defined in units per unit of time, a linear attraction speed is also defined in units per unit of time and the value is the speed at a distance of 1.0f from the eye.
A negative speed means particles are repelled by the eye.
A speed of 0.0f means particles are neither attracted nor repelled by the eye of the vortex.
attractionSpeed | : the attraction speed of the vortex in units per unit of time | |
linear | : true to set the speed function of the distance from the eye, false to set it constant |
Definition at line 270 of file SPK_Vortex.h.
void setDirection | ( | const Vector3D & | direction | ) |
Sets the direction of the eye of the vortex.
The eye of the vortex is an infinite line defined by a position and a direction.
Note that the direction is normalized internally.
direction | : the direction of the eye of the vortex |
Definition at line 256 of file SPK_Vortex.h.
void setEyeRadius | ( | float | eyeRadius | ) |
Sets the eye radius.
Note that an negative radius is inverted internally
eyeRadius | : the eye radius |
Definition at line 276 of file SPK_Vortex.h.
void setPosition | ( | const Vector3D & | position | ) |
Sets the position of the eye of the vortex.
The eye of the vortex is an infinite line defined by a position and a direction.
position | : the position of the eye of the vortex |
Definition at line 249 of file SPK_Vortex.h.
void setRotationSpeed | ( | float | rotationSpeed, | |
bool | angular | |||
) |
Sets the rotation speed of the vortex.
The rotation speed can either be in units per second or in radians per second (angular).
In the case the rotation speed is angular, all particles are rotated around the eye at the same speed.
In the other case, the more particles are close to the eye, the faster they rotate.
The sens of rotation is defined by the sens of the speed (and depends also on whether we are in a right or left handed system).
A speed of 0 means no rotation.
rotationSpeed | : the speed of rotation (either in units per unit of time or in radians per unit of time dependent on the second parameter) | |
angular | : true to have the rotation in radians per unit of time, false to have it in unit per unit of time. |
Definition at line 264 of file SPK_Vortex.h.