[Teleus-cvs] teleus/src/math mass.cpp,1.5,1.6 mass.hpp,1.3,1.4
Status: Inactive
Brought to you by:
spiffgq
|
From: Daniel R. <sp...@us...> - 2004-05-25 23:01:35
|
Update of /cvsroot/teleus/teleus/src/math In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15591/src/math Modified Files: mass.cpp mass.hpp Log Message: Created a new class called Mass that extends PointMass. Mass gives PointMass a volume and rotational component. Index: mass.cpp =================================================================== RCS file: /cvsroot/teleus/teleus/src/math/mass.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mass.cpp 25 Feb 2004 06:34:00 -0000 1.5 --- mass.cpp 25 May 2004 23:01:25 -0000 1.6 *************** *** 26,32 **** --- 26,34 ---- #include <string> + #include <cmath> #include "mass.hpp" #include "physics.hpp" #include "vector.hpp" + #include "util/debugrecord.hpp" #include "debug.hpp" [...1450 lines suppressed...] * \file mass.cpp ! * \brief Source file for PointMass */ /** * \file mass.hpp ! * \brief Header file for PointMass */ --- 1557,1566 ---- /** * \file mass.cpp ! * \brief Source file for PointMass and Mass */ /** * \file mass.hpp ! * \brief Header file for PointMass and Mass */ Index: mass.hpp =================================================================== RCS file: /cvsroot/teleus/teleus/src/math/mass.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mass.hpp 25 Feb 2004 02:23:26 -0000 1.3 --- mass.hpp 25 May 2004 23:01:25 -0000 1.4 *************** *** 30,43 **** #include "vector.hpp" namespace teleus { namespace math { class PointMass { protected: double mMass; ! Vector3d mPosition; ! Vector3d mVelocity; public: --- 30,48 ---- #include "vector.hpp" + #include "matrix.hpp" namespace teleus { namespace math { + class PointMass { protected: + double mMass; ! Vector3d mPosition; // In world coordinates ! Vector3d mLastPosition; // In world coordinates ! Vector3d mVelocity; // In world coordinates ! Vector3d mNetForce; // In world coordinates public: *************** *** 50,61 **** virtual void updatePhysics(double); const Vector3d& pos() const; void setPos (const Vector3d&); const Vector3d& vel() const; void setVel (const Vector3d&); ! double mass() const; ! void setMass (double); const PointMass& operator= (const PointMass&); --- 55,73 ---- virtual void updatePhysics(double); + double mass() const; + void setMass (double); + const Vector3d& pos() const; void setPos (const Vector3d&); + const Vector3d& lastPos () const; const Vector3d& vel() const; + const float speed() const; void setVel (const Vector3d&); ! const Vector3d& netForce() const; ! void setForces (const Vector3d&); ! void addForce (const Vector3d&); ! void resetForces (); const PointMass& operator= (const PointMass&); *************** *** 64,67 **** --- 76,155 ---- }; + class Mass : public PointMass{ + + protected: + + Tensor mInertia; // In self coordinates + Tensor mInertiaInv; // In self coordinates + + Vector3d mAngVelocity; // In self coordinates + Vector3d mOrientation; // In self coordinates + Quaternion mRotation; // In world coordinates + Vector3d mNetTorqueBody; // In self coordinates + Vector3d mNetTorqueWorld; // In world coordinates + Vector3d mNetForceBody; // In self coordinates + + Vector3d mForwardVector; // In world coordinates + Vector3d mRightVector; // In world coordinates + Vector3d mUpVector; // In world coordinates + + float mRadius; + float mLength; + float mWidth; + float mHeight; + + public: + + Mass (); + Mass (double, const Vector3d&, const Vector3d&, + const Tensor&, const Vector3d&, const Quaternion&, + float, float, float, float); + Mass (const PointMass&); + //Mass (const Mass&); + + virtual void updatePhysics(double); + + const Tensor& inertia () const; + void setInertia (const Tensor&); + void setInertia (float f11, float f22, float f33); + + const Tensor& inertiaInverse() const; + void setInertiaInverse (const Tensor&); + + const Vector3d& orientation () const; + void setOrientation (const Vector3d&); + + const Quaternion& rotation () const; + void setRotation (const Quaternion&); + void setRotation (double r, double p, double y); + + const Vector3d& angVelocity () const; + void setAngVelocity (const Vector3d&); + + const Vector3d& netTorque () const; + void addForceBody (const Vector3d&, const Vector3d&); + void addForceWorld (const Vector3d&, const Vector3d&); + void resetForces (); + + const Vector3d& forward() const; + const Vector3d& right() const; + const Vector3d& up() const; + + float radius() const; + void setRadius (float); + + float length() const; + void setLength (float); + + float width() const; + void setWidth (float); + + float height() const; + void setHeight(float); + + void setDimensions(float, float, float); + + }; + } // END NAMESPACE math |