A Zone defining a cylinder in the universe. More...
Public Member Functions | |
Cylinder (const Vector3D &position=Vector3D(0.0f, 0.0f, 0.0f), const Vector3D &direction=Vector3D(0.0f, 1.0f, 0.0f), float radius=1.0f, float length=1.0f) | |
Constructor of cylinder. | |
void | setDirection (const Vector3D &direction) |
Sets the direction of the cylinder. | |
void | setRadius (float radius) |
Sets the radius of this cylinder. | |
void | setLength (float length) |
Sets the length of this cylinder. | |
const Vector3D & | getDirection () const |
Gets the direction of this cylinder. | |
const Vector3D & | getTransformedDirection () const |
Gets the transformed direction of this cylinder. | |
float | getRadius () const |
Gets the radius of this cylinder. | |
float | getLength () const |
Gets the length of this cylinder. | |
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 Cylinder * | create (const Vector3D &position=Vector3D(0.0f, 0.0f, 0.0f), const Vector3D &direction=Vector3D(0.0f, 1.0f, 0.0f), float radius=1.0f, float length=1.0f) |
Creates and registers a new cylinder. | |
Protected Member Functions | |
virtual void | innerUpdateTransform () |
Updates all the parameters in the world coordinates. |
A Zone defining a cylinder in the universe.
A cylinder is defined by :
Note that the direction does not have to be normalized as it is normalized internally when set.
Definition at line 45 of file SPK_Cylinder.h.
Cylinder | ( | const Vector3D & | position = Vector3D(0.0f, 0.0f, 0.0f) , |
|
const Vector3D & | direction = Vector3D(0.0f, 1.0f, 0.0f) , |
|||
float | radius = 1.0f , |
|||
float | length = 1.0f | |||
) |
Constructor of cylinder.
position | : the position of the cylinder | |
direction | : the direction of the cylinder | |
radius | : the radius of the cylinder |
Computes the normal for the point.
point | : the point from where the normal is computed |
Implements Zone.
virtual bool contains | ( | const Vector3D & | point | ) | const [virtual] |
Cylinder * create | ( | const Vector3D & | position = Vector3D(0.0f,0.0f,0.0f) , |
|
const Vector3D & | direction = Vector3D(0.0f,1.0f,0.0f) , |
|||
float | radius = 1.0f , |
|||
float | length = 1.0f | |||
) | [static] |
Creates and registers a new cylinder.
position | : the position of the cylinder | |
direction | : the direction of the cylinder | |
radius | : the radius of the cylinder |
Definition at line 156 of file SPK_Cylinder.h.
virtual void generatePosition | ( | Particle & | particle, | |
bool | full | |||
) | const [virtual] |
const Vector3D & getDirection | ( | ) | const |
Gets the direction of this cylinder.
Definition at line 181 of file SPK_Cylinder.h.
float getLength | ( | ) | const |
Gets the length of this cylinder.
Definition at line 196 of file SPK_Cylinder.h.
float getRadius | ( | ) | const |
Gets the radius of this cylinder.
Definition at line 191 of file SPK_Cylinder.h.
const Vector3D & getTransformedDirection | ( | ) | const |
Gets the transformed direction of this cylinder.
Definition at line 186 of file SPK_Cylinder.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.
virtual 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.
virtual void moveAtBorder | ( | Vector3D & | point, | |
bool | inside | |||
) | const [virtual] |
void setDirection | ( | const Vector3D & | direction | ) |
Sets the direction of the cylinder.
Note that the direction is normalized internally
direction | : the direction of the cylinder |
Definition at line 163 of file SPK_Cylinder.h.
void setLength | ( | float | length | ) |
Sets the length of this cylinder.
A length cannot be negative.
Note that negative length are inverted internally
length | : the length of this cylinder |
Definition at line 176 of file SPK_Cylinder.h.
void setRadius | ( | float | radius | ) |
Sets the radius of this cylinder.
A radius cannot be negative.
Note that negative radius are inverted internally
radius | : the radius of this cylinder |
Definition at line 171 of file SPK_Cylinder.h.