8 #include "VsMovableItem.h"
11 #include "VsRigidBody.h"
14 #include "VsSimulator.h"
15 #include "VsOsgUserData.h"
16 #include "VsOsgUserDataVisitor.h"
17 #include "VsDragger.h"
37 VsEllipsoid::~VsEllipsoid()
45 {
Std_TraceMsg(0,
"Caught Error in desctructor of VsEllipsoid/\r\n",
"", -1,
false,
true);}
48 void VsEllipsoid::CreateGraphicsGeometry()
53 void VsEllipsoid::CalculateEstimatedMassAndVolume()
61 void VsEllipsoid::CreatePhysicsGeometry()
67 osg::ref_ptr<osg::Geode> osgNode =
new osg::Geode;
68 osgNode->addDrawable(m_osgGeometry.get());
70 m_vxGeometry = GetVsSimulator()->CreateConvexMeshFromOsg(osgNode.get());
73 CalculateEstimatedMassAndVolume();
80 VsRigidBody::CreateItem();
81 Ellipsoid::CreateParts();
82 VsRigidBody::SetBody();
90 Ellipsoid::CreateJoints();
91 VsRigidBody::Initialize();
94 void VsEllipsoid::ResizePhysicsGeometry()
96 if(m_vxGeometry && m_vxCollisionGeometry && m_vxSensor)
98 if(!m_vxSensor->removeCollisionGeometry(m_vxCollisionGeometry))
99 THROW_PARAM_ERROR(Vs_Err_lRemovingCollisionGeometry, Vs_Err_strRemovingCollisionGeometry,
"ID: ",
m_strID);
101 delete m_vxCollisionGeometry;
102 m_vxCollisionGeometry = NULL;
104 CreatePhysicsGeometry();
106 CollisionGeometry(m_vxSensor->addGeometry(m_vxGeometry, iMaterialID, 0, m_lpThisRB->Density()));
108 CalculateEstimatedMassAndVolume();
virtual bool IsCollisionObject()
Query if this object is collision object.
float m_fltEstimatedVolume
The estimated volume. See m_fltEstimatedMass desciption.
Simulator * m_lpSim
The pointer to a Simulation.
float m_fltMinorRadius
The radius of the minor axis of the ellipsoid.
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
float m_fltMajorRadius
The radius of the major axis of the ellipsoid.
VsEllipsoid()
Default constructor.
virtual void DistanceUnits(std::string strUnits)
Sets the distance units.
virtual void CreateJoint()
Creates the joint.
std::string m_strID
The unique Id for this object.
virtual int GetMaterialID(std::string strID)
Gets a material identifier from the physics engine for the specified unique ID.
virtual float DisplayMassUnits()
Gets the density mass units.
float m_fltDensity
Uniform density for the rigid body.
int m_iLatSegments
The number of segments used to draw in the latitude direction.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
Declares the vortex ellipsoid class.
osg::Geometry * CreateEllipsoidGeometry(int latres, int longres, float rSemiMajorAxis, float rSemiMinorAxis)
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
Joint * m_lpJointToParent
virtual std::string MaterialID()
Gets the material ID for this part.
Declares the vortex structure class.
int m_iLongSegments
The number of segments used to draw in the longtitude direction.