openmbvcppinterface  3.1.0
OpenMBV C++ Interface
dynamicnurbssurface.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_DYNAMICNURBSSURFACE_H
21#define _OPENMBV_DYNAMICNURBSSURFACE_H
22
23#include <openmbvcppinterface/dynamiccoloredbody.h>
24#include <vector>
25#include <hdf5serie/vectorserie.h>
26
27namespace OpenMBV {
28
31 friend class ObjectFactory;
32 protected:
33 std::vector<std::vector<double> > cp;
34 int numU{0}, numV{0};
35 std::vector<double> uKnot, vKnot;
37 DynamicNurbsSurface() = default;
38 ~DynamicNurbsSurface() override = default;
39 xercesc::DOMElement *writeXMLFile(xercesc::DOMNode *parent) override;
41 void createHDF5File() override;
42 void openHDF5File() override;
43 public:
46 const std::vector<std::vector<double> >& getControlPoints() { return cp; }
47 int getNumberOfUControlPoints() { return numU; }
48 int getNumberOfVControlPoints() { return numV; }
49 const std::vector<double>& getUKnotVector() { return uKnot; }
50 const std::vector<double>& getVKnotVector() { return vKnot; }
51
54 void setControlPoints(const std::vector<std::vector<double> > &cp_) { cp = cp_; }
55 void setNumberOfUControlPoints(int numU_) { numU = numU_; }
56 void setNumberOfVControlPoints(int numV_) { numV = numV_; }
57 void setUKnotVector(const std::vector<double>& uKnot_) { uKnot = uKnot_; }
58 void setVKnotVector(const std::vector<double>& vKnot_) { vKnot = vKnot_; }
59
61 template<typename T>
62 void append(const T& row) {
63 if(data==nullptr) throw std::runtime_error("can not append data to an environment object");
64 data->append(row);
65 }
66
67 int getRows() override { return data?data->getRows():0; }
68 std::vector<double> getRow(int i) override { return data?data->getRow(i):std::vector<double>(1+4*numU*numV); }
69
71 void initializeUsingXML(xercesc::DOMElement *element) override;
72 };
73
74}
75
76#endif
void getRow(int row, size_t size, T data[])
void append(const T data[], size_t size)
Definition: dynamiccoloredbody.h:28
Definition: dynamicnurbssurface.h:30
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: dynamicnurbssurface.cc:69
void createHDF5File() override
Definition: dynamicnurbssurface.cc:42
std::vector< double > getRow(int i) override
Definition: dynamicnurbssurface.h:68
void append(const T &row)
Definition: dynamicnurbssurface.h:62
int getRows() override
Definition: dynamicnurbssurface.h:67
void setControlPoints(const std::vector< std::vector< double > > &cp_)
Definition: dynamicnurbssurface.h:54
const std::vector< std::vector< double > > & getControlPoints()
Definition: dynamicnurbssurface.h:46
Definition: objectfactory.h:38