An abstract class that defines a zone in space. More...
Public Member Functions | |
Zone (const Vector3D &position=Vector3D()) | |
Default constructor for Zone. | |
virtual | ~Zone () |
Destructor of Zone. | |
virtual void | setPosition (const Vector3D &v) |
Sets the position of this Zone. | |
const Vector3D & | getPosition () const |
Gets the position of this Zone. | |
const Vector3D & | getTransformedPosition () const |
Gets the transformed position of this Zone. | |
virtual void | generatePosition (Particle &particle, bool full) const =0 |
Randomly generates a position inside this Zone for a given Particle. | |
virtual bool | contains (const Vector3D &point) const =0 |
Checks whether a point is within the Zone. | |
virtual bool | intersects (const Vector3D &v0, const Vector3D &v1, Vector3D *intersection, Vector3D *normal) const =0 |
Checks whether a line intersects the Zone. | |
virtual void | moveAtBorder (Vector3D &point, bool inside) const =0 |
Moves a point at the border of the Zone. | |
virtual Vector3D | computeNormal (const Vector3D &point) const =0 |
Computes the normal for the point. | |
Protected Member Functions | |
virtual void | innerUpdateTransform () |
Updates all the parameters in the world coordinates. | |
Static Protected Member Functions | |
static void | normalizeOrRandomize (Vector3D &v) |
A helper static method to normalize a Vector3D. | |
Static Protected Attributes | |
static const float | APPROXIMATION_VALUE |
Value used for approximation. |
An abstract class that defines a zone in space.
A Zone is used in SPARK to :
Definition at line 46 of file SPK_Zone.h.
virtual ~Zone | ( | ) | [virtual] |
Destructor of Zone.
Definition at line 65 of file SPK_Zone.h.
virtual bool contains | ( | const Vector3D & | point | ) | const [pure virtual] |
virtual void generatePosition | ( | Particle & | particle, | |
bool | full | |||
) | const [pure virtual] |
Randomly generates a position inside this Zone for a given Particle.
particle | : the Particle whose position will be generated | |
full | : true to generate a position in the whole volume of this Zone, false to generate a position only at borders |
Implemented in AABox, Cylinder, Line, Plane, Point, Ring, and Sphere.
const Vector3D & getPosition | ( | ) | const |
Gets the position of this Zone.
Definition at line 172 of file SPK_Zone.h.
const Vector3D & getTransformedPosition | ( | ) | const |
Gets the transformed position of this Zone.
Definition at line 177 of file SPK_Zone.h.
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.
Reimplemented in Cylinder, Line, Plane, and Ring.
Definition at line 191 of file SPK_Zone.h.
virtual bool intersects | ( | const Vector3D & | v0, | |
const Vector3D & | v1, | |||
Vector3D * | intersection, | |||
Vector3D * | normal | |||
) | const [pure virtual] |
Checks whether a line intersects the Zone.
The intersection is computed only if the Vector3D* intersection is not NULL.
The normal is computed if the Vector3D* normal AND intersection are not NULL.
v0 | : start of the line | |
v1 | : end of the line | |
intersection | : the Vector3D where the intersection will be stored, NULL not to compute the intersection | |
normal | : the Vector3D where the normal will be stored, NULL not to compute the normal |
Implemented in AABox, Cylinder, Line, Plane, Point, Ring, and Sphere.
virtual void moveAtBorder | ( | Vector3D & | point, | |
bool | inside | |||
) | const [pure virtual] |
Moves a point at the border of the Zone.
point | : the point that will be moved to the border of the Zone | |
inside | : true to move the point inside the Zone of APPROXIMATION_VALUE, false to move it outside of APPROXIMATION_VALUE |
Implemented in AABox, Cylinder, Line, Plane, Point, Ring, and Sphere.
void normalizeOrRandomize | ( | Vector3D & | v | ) | [static, protected] |
void setPosition | ( | const Vector3D & | v | ) | [virtual] |
Sets the position of this Zone.
v | : the position of this Zone |
Reimplemented in Line.
Definition at line 166 of file SPK_Zone.h.
const float APPROXIMATION_VALUE [static, protected] |
Value used for approximation.
Definition at line 144 of file SPK_Zone.h.