MBSim

Project Page
plot_cartesian_coordinates.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_CYLINDER_COORDINATES_H__
21 #define _PLOT_CYLINDER_COORDINATES_H__
22 #include "mbsim/element.h"
23 
24 #ifdef HAVE_OPENMBVCPPINTERFACE
25 namespace OpenMBV {
26  //class Frame;
27  class Arrow;
28  class Frame;
29  class Group;
30 }
31 #endif
32 
33 namespace MBSim {
34  class RigidBody;
35  class Frame;
36 
38  private:
39  Frame* frame;
40 #ifdef HAVE_OPENMBVCPPINTERFACE
41  OpenMBV::Group* openMBVGrp;
42  OpenMBV::Arrow *openMBVPosition, *openMBVVelocity, *openMBVXVelocity, *openMBVYVelocity, *openMBVZVelocity, *openMBVAcceleration, *openMBVXAcceleration, *openMBVYAcceleration, *openMBVZAcceleration;
43  OpenMBV::Frame* openMBVFrame;
44  fmatvec::Vec roff, voff, aoff;
45  double rscale, vscale, ascale;
46  fmatvec::Vec ex, ey, ez;
47  fmatvec::SqrMat A;
48 #endif
49 
50  public:
51  PlotCartesianCoordinates(const std::string &name);
52  void setFrame(Frame *frame_) { frame = frame_; }
53  void setOrientation(const fmatvec::SqrMat &A_) { A = A_; }
54 
55  void init(InitStage stage);
56  void setez(const fmatvec::Vec &ez_) {ez = ez_/nrm2(ez_);}
57  virtual void plot(double t, double dt);
58 
59 #ifdef HAVE_OPENMBVCPPINTERFACE
60  OpenMBV::Group* getOpenMBVGrp() { return openMBVGrp; }
61  //void setvscale(double scale) { vscale = scale; }
62  //void setascale(double scale) { ascale = scale; }
63  virtual void enableOpenMBVPosition(double diameter=0.5, double headDiameter=1, double headLength=1, double color=0.5);
64  virtual void enableOpenMBVVelocity(double scale=1, double diameter=0.5, double headDiameter=1, double headLength=1, double color=0.5);
65  virtual void enableOpenMBVAcceleration(double scale=1, double diameter=0.5, double headDiameter=1, double headLength=1, double color=0.5);
66  virtual void enableOpenMBVFrame(double size=1, double offset=1);
67 #endif
68 
69  };
70 
71 }
72 
73 #endif
74