Moby
GravityForce.h
1 /****************************************************************************
2  * Copyright 2005 Evan Drumwright
3  * This library is distributed under the terms of the Apache V2.0
4  * License (obtainable from http://www.apache.org/licenses/LICENSE-2.0).
5  ****************************************************************************/
6 
7 #ifndef _GRAVITY_FORCE_H
8 #define _GRAVITY_FORCE_H
9 
10 #include <Ravelin/Vector3d.h>
11 #include <Moby/RecurrentForce.h>
12 
13 namespace Moby {
14 
17 {
18  public:
19  GravityForce();
20  GravityForce(const GravityForce& source);
21  virtual ~GravityForce() {}
22  virtual void add_force(boost::shared_ptr<Ravelin::DynamicBodyd> body);
23  virtual void load_from_xml(boost::shared_ptr<const XMLTree> node, std::map<std::string, BasePtr>& id_map);
24  virtual void save_to_xml(XMLTreePtr node, std::list<boost::shared_ptr<const Base> >& shared_objects) const;
25 
27  Ravelin::Vector3d gravity;
28 }; // end class
29 } // end namespace
30 
31 #endif
32 
Used for applying forces to the simulation on every time step.
Definition: RecurrentForce.h:24
GravityForce()
Constructs a default gravity vector of [0,0,0].
Definition: GravityForce.cpp:21
Ravelin::Vector3d gravity
The gravity vector.
Definition: GravityForce.h:27
boost::shared_ptr< XMLTree > XMLTreePtr
XML tree smart pointer.
Definition: Types.h:104
Gravitational force applied to bodies.
Definition: GravityForce.h:16
virtual void add_force(boost::shared_ptr< Ravelin::DynamicBodyd > body)
Adds gravity to a body.
Definition: GravityForce.cpp:33
virtual void load_from_xml(boost::shared_ptr< const XMLTree > node, std::map< std::string, BasePtr > &id_map)
Implements Base::load_from_xml()
Definition: GravityForce.cpp:72
virtual void save_to_xml(XMLTreePtr node, std::list< boost::shared_ptr< const Base > > &shared_objects) const
Implements Base::save_to_xml()
Definition: GravityForce.cpp:87