Mondschein Engine  0.3.0
nurbspatch.h
Go to the documentation of this file.
1 #ifndef NURBSPATCH_H_INCLUDED
2 #define NURBSPATCH_H_INCLUDED
3 
4 /* Mondschein Engine is a fast, powerful, and easy-to-use 3D realtime rendering engine.
5  *
6  * Copyright (C) 2009-2013 by Andreas Amereller
7  * E-Mail: andreas.amereller.dev@googlemail.com
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the Free
11  * Software Foundation; either version 3 of the License, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17  * more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
24 
25 #include "types.h"
26 #include "eigen3.h"
27 
28 #include <cmath>
29 
30 namespace mondschein
31 {
32  namespace math
33  {
43  class NURBSpatch
44  {
45  private:
46  uint32 degree;
47  std::vector<NURBScurve_p> curves;
48  std::vector<float64> knots;
49  virtual void uniform_knots();
50  virtual void chord_knots();
51 
52  public:
53  explicit NURBSpatch();
54  explicit NURBSpatch(uint32 _d,const std::vector<NURBScurve_p> &_c);
55  explicit NURBSpatch(NURBSpatch_c _p);
56  virtual ~NURBSpatch();
57  virtual NURBSpatch &operator=(NURBSpatch_c _p);
58 
70  virtual Eigen::Vector3d operator()(float64 _t,float64 _u) const;
71 
82  virtual void set_degree(uint32 _d);
83 
89  virtual uint32 get_degree() const;
90 
101  virtual void set_curves(const std::vector<NURBScurve_p> &_c);
102 
108  virtual std::vector<NURBScurve_p> get_curves() const;
109 
120  virtual void calc_knots(bool _cl);
121 
133  virtual Eigen::Vector3d get_point(float64 _t,float64 _u) const;
134 
135  virtual scene::Mesh_p generate_mesh(float64 _t,float64 _u,normal_calculation_e _normals) const;
136  };
137  }
138 }
139 
140 #endif // NURBSPATCH_H_INCLUDED