00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00043 #include "../include/IPSA/SoCollisionShapeCylinder.h"
00044 #include <Inventor/nodes/SoCylinder.h>
00045
00046 SO_KIT_SOURCE(SoCollisionShapeCylinder);
00047
00050 void SoCollisionShapeCylinder::initClass()
00051 {
00052 SO_KIT_INIT_CLASS(SoCollisionShapeCylinder, SoCollisionShape, "CollisionShape");
00053 }
00054
00055
00062 SoCollisionShapeCylinder::SoCollisionShapeCylinder(const SbString& nodeName )
00063 : SoCollisionShape(nodeName)
00064 {
00065 SO_KIT_CONSTRUCTOR(SoCollisionShapeCylinder);
00066 isBuiltIn = TRUE;
00067
00068 SO_KIT_ADD_FIELD(radius,(1.0f));
00069 SO_KIT_ADD_FIELD(height,(1.0f));
00070
00071 SO_KIT_CHANGE_ENTRY_TYPE(visualisation,SoCylinder,SoCylinder);
00072 SO_KIT_CHANGE_NULL_BY_DEFAULT(visualisation, FALSE);
00073
00074 SO_KIT_INIT_INSTANCE();
00075
00076 updateOdePropertiesTrigger.appendConnection(&radius);
00077 updateOdePropertiesTrigger.appendConnection(&height);
00078 }
00079
00080
00084 SoCollisionShape* SoCollisionShapeCylinder::copy(SbBool copyConnections) const
00085 {
00086
00087
00088 SoCollisionShapeCylinder* newSoCollisionShape = dynamic_cast<SoCollisionShapeCylinder*> (SoCollisionShape::copy(copyConnections));
00089
00090 newSoCollisionShape->setUpConnections(TRUE, TRUE);
00091 return newSoCollisionShape;
00092 }
00093
00094
00100 void SoCollisionShapeCylinder::updateVisualisationAndOdeProperties()
00101 {
00102 const dGeomID cylinderID = this->geometry;
00103 if (NULL != cylinderID)
00104 dGeomCylinderSetParams(cylinderID, this->radius.getValue(), this->height.getValue());
00105
00106 SoCylinder* visualisationShape = dynamic_cast<SoCylinder*> (getPart("visualisation", TRUE));
00107 if (NULL != visualisationShape)
00108 {
00109 visualisationShape->radius.setValue( this->radius.getValue() );
00110 visualisationShape->height.setValue( this->height.getValue() );
00111 }
00112 }
00113
00114
00123 dGeomID SoCollisionShapeCylinder::cGeom(const SbMatrix& mm)
00124 {
00125 assert(space != NULL);
00126
00127 return dCreateCylinder(space, radius.getValue(), height.getValue());
00128 }
00129