PhyCylinder class. More...
Classes | |
struct | SegmentColor |
The structure used to define the color of a single segment of the cylinder. More... | |
Public Member Functions | |
PhyCylinder (real radius, real height, World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity()) | |
Create a physics cylinder object and insert it in the world passed. | |
virtual | ~PhyCylinder () |
Destroy this object. | |
bool | graphicalRepresentationNeedsUpdate () |
Whether the graphical representation should be updated or not. | |
real | height () const |
return the height | |
const QColor & | lowerBaseColor () const |
Returns the color of the lower base. | |
real | radius () const |
return the radius | |
const QList< SegmentColor > & | segmentsColor () const |
Returns the color of segments of the cylinder. | |
void | setLowerBaseColor (QColor color) |
Sets the color of the lower base. | |
void | setSegmentsColor (QList< SegmentColor > segmentsColor) |
Sets the color of segments of the cylinder. | |
void | setUpperBaseColor (QColor color) |
Sets the color of the upper base. | |
const QColor & | upperBaseColor () const |
Returns the color of the upper base. | |
Public Member Functions inherited from PhyObject | |
PhyObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool cp=true) | |
Create a physics object with no-collision-shape and insert it in the world passed. | |
virtual | ~PhyObject () |
Destroy this object. | |
void | addForce (const wVector &force) |
void | addImpulse (const wVector &pointDeltaVeloc, const wVector &pointPosit) |
void | addTorque (const wVector &torque) |
wVector | force () |
bool | getKinematic () const |
Returns true if the object has kinematic behaviour. | |
bool | getStatic () const |
Returns true if the object is static. | |
wVector | inertiaVec () const |
wVector | invInertiaVec () const |
Return the inverse of Inertia. | |
wVector | invMassInertiaVec () const |
real | mass () |
Return the mass. | |
wVector | massInertiaVec () const |
Return the Mass and momentum of Inertia. | |
QString | material () const |
wVector | omega () |
void | reset () |
reset the object:
set the velocity to zeroset the angural velocity to zeroset any residual forces and torques to zeroremove any pending collision | |
void | setForce (const wVector &force) |
void | setKinematic (bool b, bool c=false) |
Changes between kinematic/dynamic behaviour for the object. | |
void | setMass (real) |
Set the mass without touching the Inertia data. | |
void | setMassInertiaVec (const wVector &) |
Set the Mass and momentum of Inertia: ( mass, Ixx, Iyy, Izz ) | |
void | setMaterial (QString material) |
void | setOmega (const wVector &omega) |
void | setStatic (bool b) |
Makes the object static or not. | |
void | setTorque (const wVector &torque) |
void | setVelocity (const wVector &velocity) |
wVector | torque () |
wVector | velocity () |
Public Member Functions inherited from WObject | |
WObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool addToWorld=true) | |
create the object and automatically put this into the world | |
virtual | ~WObject () |
destroy the Object and drop it from the world | |
QColor | color () const |
return the color of this object | |
bool | isInvisible () |
return if it is invisible | |
const wMatrix & | matrix () const |
return a reference to the transformation matrix | |
QString | name () const |
Return the name of this object. | |
virtual void | postUpdate () |
postUpdate the WObject this method is called at each step of the world just after the physic update | |
virtual void | preUpdate () |
preUpdate the WObject this method is called at each step of the world just before the physic update | |
void | setAlpha (int alpha) |
set the value of alpha channel (the transparency) | |
void | setColor (QColor c) |
Set the color to use on rendering. | |
void | setInvisible (bool b) |
set invisibility | |
void | setMatrix (const wMatrix &newm) |
set a new matrix | |
void | setPosition (const wVector &newpos) |
set the position specified in global coordinate frame | |
void | setPosition (real x, real y, real z) |
set the position specified in global coordinate frame | |
void | setTexture (QString textureName) |
Set the texture to use for this WObject when rendered. | |
void | setUseColorTextureOfOwner (bool b) |
set if the object will be rendered with the color and texture of our owner (if we have one) | |
QString | texture () const |
Return the texture name. | |
bool | useColorTextureOfOwner () const |
if true, we will use color and texture of our owner (if we have one) | |
World * | world () |
Return the world. | |
const World * | world () const |
Return the world (const version) | |
Public Member Functions inherited from Ownable | |
Ownable () | |
Constructor. | |
virtual | ~Ownable () |
Destructor. | |
const QList< Owned > & | owned () const |
Returns the list of objects owned by this one. | |
Ownable * | owner () const |
Returns the owner of this object. | |
void | setOwner (Ownable *owner, bool destroy=true) |
Sets the owner of this object. | |
Protected Member Functions | |
void | createPrivateObject () |
Engine encapsulation. | |
Protected Member Functions inherited from PhyObject | |
virtual void | changedMatrix () |
syncronize this object with underlying physic object | |
void | createPrivateObject () |
Additional Inherited Members | |
Public Types inherited from Ownable | |
typedef QList< Owned > | OwnedList |
The type for the list of owned objects. | |
Protected Attributes inherited from PhyObject | |
PhyObjectPrivate * | priv |
Engine encapsulation. | |
WorldPrivate * | worldpriv |
Detailed Description
PhyCylinder class.
- Motivation
- Represent a physical cylinder object.
- Description
- The cylinder is described by the radius and the height. The local frame of reference has the x axis along the line connecting the center of the two bases and the center of the frame is in the middle of that line. For this object you can either specify a single color (using methods inherited from WObject) or you can use functions provided here to separately specify the colors of the two bases and of sectors of the cylinder (see function description for more information). If you use functions specific to this class, the color of the object retuned by WObject::color() will be invalid. To set a single color for the whole cylinder, simply use WObject::setColor with a valid color. More precisely, as soon as you use one of the functions defined here to set colors (setUpperBaseColor, setLowerBaseColor or setSegmentsColor) those colors are used to draw the cylinder and the WObject::color property is set to an invalid color (the color of other parts of the cylinder are set to WObject::color before making it invalid); if you explicitly use WObject::setColor, the cylinder is drawn with a single color. Textures are ignored when using color functions defined here
- Warnings
- Warnings
Definition at line 52 of file phycylinder.h.
Constructor & Destructor Documentation
PhyCylinder | ( | real | radius, |
real | height, | ||
World * | world, | ||
QString | name = "unamed" , |
||
const wMatrix & | tm = wMatrix::identity() |
||
) |
Create a physics cylinder object and insert it in the world passed.
- Parameters
-
radius radius of cylinder height the height of cylinder (cylinder 'grows up' along its local X axis) world The World which object will be inserted tm rotation and position at the moment of creation
Definition at line 27 of file phycylinder.cpp.
References PhyObject::changedMatrix(), and PhyCylinder::createPrivateObject().
|
virtual |
Destroy this object.
Definition at line 42 of file phycylinder.cpp.
Member Function Documentation
|
protected |
Engine encapsulation.
Definition at line 98 of file phycylinder.cpp.
References wMatrix::identity(), PhyObject::priv, and PhyObject::setMass().
Referenced by PhyCylinder::PhyCylinder().
bool graphicalRepresentationNeedsUpdate | ( | ) |
Whether the graphical representation should be updated or not.
This function is called by RenderPhyCylinder to check if a new representation of the cylinder should be generated since the last time this function was called. This function only considers changes to properties like dimensions and color, not position or orientation.
- Returns
- true if the phycylinder representation should be updated
Definition at line 88 of file phycylinder.cpp.
References WObject::colorv.
|
inline |
return the height
Definition at line 123 of file phycylinder.h.
|
inline |
Returns the color of the lower base.
- Returns
- the color of the lower base
Definition at line 160 of file phycylinder.h.
|
inline |
|
inline |
Returns the color of segments of the cylinder.
- Note
- The list is guaranteed to be sorted in by ascending angles
- Returns
- the color of segments of the cylinder
Definition at line 184 of file phycylinder.h.
Referenced by PhyCylinder::setSegmentsColor().
void setLowerBaseColor | ( | QColor | color | ) |
Sets the color of the lower base.
- Parameters
-
color the new color of the upper base. If this is invalid, the base is drawn with slices corresponding to those defined by setSegmentsColor
Definition at line 61 of file phycylinder.cpp.
References WObject::color(), and WObject::colorv.
void setSegmentsColor | ( | QList< SegmentColor > | segmentsColor | ) |
Sets the color of segments of the cylinder.
This function takes a list of SegmentColor objects. The i-th segment starts at segmentColors[i].startingAngle and ends at segmentColors[i+1].startingAngle. The last segment ends where the first starts. If there is only one segment its color is used for the whole cylinder.
- Note
- The list is sorted by ascending angles
- Parameters
-
segmentColors the list of colors of segments
Definition at line 74 of file phycylinder.cpp.
References WObject::colorv, and PhyCylinder::segmentsColor().
void setUpperBaseColor | ( | QColor | color | ) |
Sets the color of the upper base.
- Parameters
-
color the new color of the upper base. If this is invalid, the base is drawn with slices corresponding to those defined by setSegmentsColor
Definition at line 48 of file phycylinder.cpp.
References WObject::color(), and WObject::colorv.
|
inline |
Returns the color of the upper base.
- Returns
- the color of the upper base
Definition at line 141 of file phycylinder.h.
The documentation for this class was generated from the following files:
- worldsim/include/phycylinder.h
- worldsim/src/phycylinder.cpp