A Zone defining a line in the universe. More...
Public Member Functions | |
Line (const Vector3D &p0=Vector3D(0.0f, 0.0f, 0.0f), const Vector3D &p1=Vector3D(0.0f, 0.0f, 0.0f)) | |
Constructor of Line. | |
void | setPosition (const Vector3D &v) |
Sets the position of this Zone. | |
void | setBounds (const Vector3D &p0, const Vector3D &p1) |
Sets the bounds of this Line. | |
const Vector3D & | getBound (size_t index) const |
Gets the bound of index of this Line. | |
const Vector3D & | getTransformedBound (size_t index) const |
Gets the transformed bound of index of this Line. | |
void | pushBound (const Vector3D &bound) |
Pushes a new bound to this Line. | |
virtual void | generatePosition (Particle &particle, bool full) const |
Randomly generates a position inside this Zone for a given Particle. | |
virtual bool | contains (const Vector3D &v) const |
Checks whether a point is within the Zone. | |
virtual bool | intersects (const Vector3D &v0, const Vector3D &v1, Vector3D *intersection, Vector3D *normal) const |
Checks whether a line intersects the Zone. | |
virtual void | moveAtBorder (Vector3D &v, bool inside) const |
Moves a point at the border of the Zone. | |
virtual Vector3D | computeNormal (const Vector3D &point) const |
Computes the normal for the point. | |
Static Public Member Functions | |
static Line * | create (const Vector3D &p0=Vector3D(0.0f, 0.0f, 0.0f), const Vector3D &p1=Vector3D(0.0f, 0.0f, 0.0f)) |
Creates and registers a new Line. | |
Protected Member Functions | |
virtual void | innerUpdateTransform () |
Updates all the parameters in the world coordinates. |
A Zone defining a line in the universe.
As any Zone, a Line is defined by a position. The Line in itself is defined by two bounds.
Moving the position results in moving the 2 bounds in the universe by the same vector.
To conform with the Zone class (the position is defined as the center of the Zone), the position is always set to be the center of the line. Therefore, if a bound is modified, the position will be modified as well.
Definition at line 42 of file SPK_Line.h.
Computes the normal for the point.
point | : the point from where the normal is computed |
Implements Zone.
bool contains | ( | const Vector3D & | point | ) | const [virtual] |
Checks whether a point is within the Zone.
point | : the point to check |
Implements Zone.
Definition at line 153 of file SPK_Line.h.
Line * create | ( | const Vector3D & | p0 = Vector3D(0.0f,0.0f,0.0f) , |
|
const Vector3D & | p1 = Vector3D(0.0f,0.0f,0.0f) | |||
) | [static] |
virtual void generatePosition | ( | Particle & | particle, | |
bool | full | |||
) | const [virtual] |
const Vector3D & getBound | ( | size_t | index | ) | const |
Gets the bound of index of this Line.
index | : the index of the bound (0 or 1) |
Definition at line 143 of file SPK_Line.h.
const Vector3D & getTransformedBound | ( | size_t | index | ) | const |
Gets the transformed bound of index of this Line.
index | : the index of the bound (0 or 1) |
Definition at line 148 of file SPK_Line.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 Zone.
bool intersects | ( | const Vector3D & | v0, | |
const Vector3D & | v1, | |||
Vector3D * | intersection, | |||
Vector3D * | normal | |||
) | const [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 |
Implements Zone.
Definition at line 158 of file SPK_Line.h.
void moveAtBorder | ( | Vector3D & | point, | |
bool | inside | |||
) | const [virtual] |
void pushBound | ( | const Vector3D & | bound | ) |