MBSim

Project Page
plot_rigid_body_group.h
1 /* Copyright (C) 2004-2011 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@gmail.com
18  */
19 
20 #ifndef _PLOT_RIGID_BODY_GROUP_H__
21 #define _PLOT_RIGID_BODY_GROUP_H__
22 #include "mbsim/element.h"
23 
24 #ifdef HAVE_OPENMBVCPPINTERFACE
25 namespace OpenMBV {
26  //class Frame;
27  class Arrow;
28  class Frame;
29 }
30 #endif
31 
32 namespace MBSim {
33  class RigidBody;
34  class Frame;
35 
36  class PlotRigidBodyGroup : public Element {
37  private:
38  std::vector<RigidBody*> body;
39  Frame* ref;
40 #ifdef HAVE_OPENMBVCPPINTERFACE
41  OpenMBV::Group* openMBVGrp;
42  OpenMBV::Arrow *openMBVPosition, *openMBVVelocity, *openMBVAcceleration, *openMBVAngularVelocity, *openMBVAngularAcceleration, *openMBVWeight, *openMBVMomentum, *openMBVAngularMomentum, *openMBVDerivativeOfMomentum, *openMBVDerivativeOfAngularMomentum;
43 #endif
44 
45  public:
46  PlotRigidBodyGroup(const std::string &name);
47  void addBody(RigidBody *body_) { body.push_back(body_); }
48  void setFrameOfReference(Frame* frame) { ref = frame; }
49 
50  void init(InitStage stage);
51  virtual void plot(double t, double dt);
52 
53 #ifdef HAVE_OPENMBVCPPINTERFACE
54  OpenMBV::Group* getOpenMBVGrp() { return openMBVGrp; }
55  void enableOpenMBVWeight(double scaleLength, double diameter, double headDiameter, double headLength, double color=0.5);
56  void enableOpenMBVMomentum(double scaleLength, double diameter, double headDiameter, double headLength, double color=0.5);
57  void enableOpenMBVAngularMomentum(double scaleLength, double diameter, double headDiameter, double headLength, double color=0.5);
58  void enableOpenMBVDerivativeOfMomentum(double scaleLength, double diameter, double headDiameter, double headLength, double color=0.5);
59  void enableOpenMBVDerivativeOfAngularMomentum(double scaleLength, double diameter, double headDiameter, double headLength, double color=0.5);
60 #endif
61 
62  };
63 
64 }
65 
66 #endif
67