openmbvcppinterface  3.1.0
OpenMBV C++ Interface
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
spineextrusion.h
1 /*
2  OpenMBV - Open Multi Body Viewer.
3  Copyright (C) 2009 Markus Friedrich
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 #ifndef _OPENMBV_SPINEEXTRUSION_H_
21 #define _OPENMBV_SPINEEXTRUSION_H_
22 
23 #include <openmbvcppinterface/dynamiccoloredbody.h>
24 #include <openmbvcppinterface/polygonpoint.h>
25 #include <vector>
26 #include <cassert>
27 #include <hdf5serie/vectorserie.h>
28 #include <stdexcept>
29 
30 namespace OpenMBV {
31 
45  friend class ObjectFactory;
46  public:
49  void setNumberOfSpinePoints(const int num) {
51  }
52 
56  return numberOfSpinePoints;
57  }
58 
61  void setContour(const std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > &contour_) { contour = contour_; }
62 
63  std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > getContour() { return contour; }
64 
66  void setScaleFactor(const double scale) {
67  scaleFactor=scale;
68  }
69 
70  double getScaleFactor() { return scaleFactor; }
71 
73  void setInitialRotation(const std::vector<double>& initRot) {
74  if(initRot.size()!=3) throw std::runtime_error("the dimension does not match");
75  initialRotation=initRot;
76  }
77 
79  void setInitialRotation(double a, double b, double g) {
80  std::vector<double> initRot;
81  initRot.push_back(a);
82  initRot.push_back(b);
83  initRot.push_back(g);
84  initialRotation=initRot;
85  }
86 
87  void setStateOffSet(const std::vector<double>& stateOff)
88  {
89  stateOffSet = stateOff;
90  }
91 
92  std::vector<double> getStateOffSet() { return stateOffSet; }
93 
95  std::vector<double> getInitialRotation() { return initialRotation; }
96 
98  template<typename T>
99  void append(const T& row) {
100  if(data==nullptr) throw std::runtime_error("can not append data to an environment object");
101  data->append(row);
102  }
103 
104  int getRows() override { return data?data->getRows():0; }
105  std::vector<double> getRow(int i) override { return data?data->getRow(i):std::vector<double>(1+4*numberOfSpinePoints); }
106 
108  void initializeUsingXML(xercesc::DOMElement *element) override;
109 
111  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent) override;
112  protected:
113  SpineExtrusion();
114  ~SpineExtrusion() override;
115 
118 
120  std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > contour;
121 
124 
126  double scaleFactor{1};
127 
129  std::vector<double> initialRotation;
130 
132  std::vector<double> stateOffSet;
133 
135  void createHDF5File() override;
136  void openHDF5File() override;
137  };
138 
139 }
140 
141 #endif /* _OPENMBV_SPINEEXTRUSION_H_ */
142 
double scaleFactor
Definition: spineextrusion.h:126
void setScaleFactor(const double scale)
Definition: spineextrusion.h:66
std::vector< double > getRow(int i) override
Definition: spineextrusion.h:105
Class for all bodies extruded along a curve.
Definition: spineextrusion.h:44
void createHDF5File() override
Definition: spineextrusion.cc:50
H5::VectorSerie< double > * data
Definition: spineextrusion.h:123
int getNumberOfSpinePoints()
Definition: spineextrusion.h:55
void setNumberOfSpinePoints(const int num)
Definition: spineextrusion.h:49
Definition: objectfactory.h:38
void getRow(int row, size_t size, T data[])
std::vector< double > initialRotation
Definition: spineextrusion.h:129
void setInitialRotation(double a, double b, double g)
Definition: spineextrusion.h:79
void append(const T &row)
Definition: spineextrusion.h:99
xercesc::DOMElement * writeXMLFile(xercesc::DOMNode *parent) override
Definition: spineextrusion.cc:40
Definition: dynamiccoloredbody.h:28
void setInitialRotation(const std::vector< double > &initRot)
Definition: spineextrusion.h:73
int numberOfSpinePoints
Definition: spineextrusion.h:117
void append(const T data[], size_t size)
std::vector< double > getInitialRotation()
Definition: spineextrusion.h:95
std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > contour
Definition: spineextrusion.h:120
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: spineextrusion.cc:76
int getRows() override
Definition: spineextrusion.h:104
std::vector< double > stateOffSet
Definition: spineextrusion.h:132
void setContour(const std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > &contour_)
Definition: spineextrusion.h:61