Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

body.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: body.h,v 1.14 2004/05/01 11:30:31 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #ifndef OXYGEN_BODY_H
00023 #define OXYGEN_BODY_H
00024 
00025 #include "odeobject.h"
00026 
00027 namespace oxygen
00028 {
00029 class World;
00030 
00038 class Body : public ODEObject
00039 {
00040     //
00041     // Functions
00042     //
00043 public:
00044     Body();
00045     virtual ~Body();
00046 
00048     dBodyID GetODEBody() const;
00049 
00057     void Enable();
00058 
00060     void Disable();
00061 
00063     bool IsEnabled() const;
00064 
00069     void UseGravity(bool f);
00070 
00073     bool UsesGravity() const;
00074 
00076     void SetMass(float mass);
00077 
00079     void SetMassParameters(const dMass& mass);
00080 
00082     float GetMass() const;
00083 
00085     void GetMassParameters(dMass& mass) const;
00086 
00091     void SetSphere(float density, float radius);
00092 
00097     void SetSphereTotal(float total_mass, float radius);
00098 
00103     void SetBox(float density, const salt::Vector3f& size);
00104 
00109     void SetBoxTotal(float total_mass, const salt::Vector3f& size);
00110 
00117     void SetCylinder (float density, float radius, float length);
00118 
00125     void SetCylinderTotal(float total_mass, float radius, float length);
00126 
00127     /* Set the mass parameters to represent a capped cylinder of the
00128        given parameters and density, with the center of mass at
00129        (0,0,0) relative to the body. The radius of the cylinder (and
00130        the spherical cap) is radius. The length of the cylinder (not
00131        counting the spherical cap) is length. The cylinder's long axis
00132        is oriented along the body's z axis.
00133     */
00134     void SetCappedCylinder (float density, float radius, float length);
00135 
00136     /* Set the mass parameters to represent a capped cylinder of the
00137        given parameters and total mass, with the center of mass at
00138        (0,0,0) relative to the body. The radius of the cylinder (and
00139        the spherical cap) is radius. The length of the cylinder (not
00140        counting the spherical cap) is length. The cylinder's long axis
00141        is oriented along the body's z axis.
00142     */
00143     void SetCappedCylinderTotal(float total_mass, float radius, float length);
00144 
00146     salt::Vector3f GetVelocity() const;
00147 
00149     void SetVelocity(const salt::Vector3f& vel);
00150 
00152     void SetRotation(const salt::Matrix& rot);
00153 
00155     salt::Vector3f GetAngularVelocity() const;
00156 
00158     void SetAngularVelocity(const salt::Vector3f& vel);
00159 
00161     static boost::shared_ptr<Body> GetBody(dBodyID id);
00162 
00164     void AddForce(const salt::Vector3f& force);
00165 
00167     void AddTorque(const salt::Vector3f& torque);
00168 
00170     void SetPosition(const salt::Vector3f& pos);
00171 
00173     salt::Vector3f GetPosition() const;
00174 
00175 protected:
00179     virtual void OnLink();
00180 
00182     bool CreateBody();
00183 
00184 private:
00189     virtual void PostPhysicsUpdateInternal();
00190 
00191     //
00192     // Members
00193     //
00194 protected:
00196     dBodyID mODEBody;
00197 };
00198 
00199 DECLARE_CLASS(Body);
00200 
00201 } //namespace oxygen
00202 
00203 #endif //OXYGEN_BODY_H

Generated on Thu Apr 6 15:25:37 2006 for rcssserver3d by  doxygen 1.4.4