Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

RigidBody.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_RIGIDBODY_H 00012 #define OPENCAL_RIGIDBODY_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 #include <OpenCAL/PhysicalObject.h> 00017 #include <OpenCAL/Rigid.h> 00018 00019 #include <OpenCAL/Matrix33.h> 00020 using OpenCAL::Utils::Matrix33; 00021 00022 00023 namespace OpenCAL 00024 { 00025 // Forward declarations 00026 00031 class OPENCAL_API RigidBody: public PhysicalObject, public Rigid 00032 { 00033 protected: 00034 // Member variables 00035 Vector3 m_angularMomentum, m_torque; 00036 Matrix33 m_inertia, m_invInertia; 00037 00038 float m_volume; 00039 00040 public: 00041 // Constructors and destructor 00042 RigidBody(System *parent, float mass = 1.0); 00043 virtual ~RigidBody(); 00044 00045 // Get functions 00046 const Vector3 &getAngularMomentum() const { return m_angularMomentum; } 00047 Vector3 *getAngularMomentumP() { return &m_angularMomentum; } 00048 const Vector3 &getTorque() const { return m_torque; } 00049 Vector3 *getTorqueP() { return &m_torque; } 00050 const Matrix33 &getInvInertia() const { return m_invInertia; } 00051 Matrix33 *getInvInertiaP() { return &m_invInertia; } 00052 00053 // Set functions 00054 void setTorque(const Vector3 &torque) { m_torque = torque; } 00055 void addTorque(const Vector3 &torque) { m_torque += torque; } 00056 00057 Vector3 getAngularVelocity() const; 00058 void setAngularVelocity(const Vector3 &velocity); 00059 00060 // Force functions 00061 virtual void addForce(const Vector3 &force, const Vector3 &position); 00062 00063 virtual void initialize(); 00064 00065 virtual void calculateVolume() = 0; 00066 virtual void calculateInversedInertia() = 0; 00067 00068 // State functions 00069 virtual void addToState(PhaseSpace *state); 00070 virtual void addToDerivative(PhaseSpace *deriv); 00071 virtual void fromState(PhaseSpace *state); 00072 00073 // Other functions 00074 virtual void disable(); 00075 /* 00076 #ifdef USE_OPENGL 00077 virtual void drawGL(); 00078 #endif // USE_OPENGL 00079 */ 00080 }; 00081 } 00082 00083 #endif // OPENCAL_RIGIDBODY_H

Generated on Sun Aug 15 19:19:23 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8