Virtual Testbed
Ship dynamics simulator for extreme conditions
geometry/ruled_surface.hh
1 #ifndef VTESTBED_GEOMETRY_RULED_SURFACE_HH
2 #define VTESTBED_GEOMETRY_RULED_SURFACE_HH
3 
4 #include <algorithm>
5 #include <vector>
6 
7 namespace vtb {
8 
9  namespace geometry {
10 
11  template <class T, class Curve>
12  class Ruled_surface {
13 
14  public:
15  using curve_type = Curve;
16  using value_type = typename curve_type::value_type;
17  using size_type = size_t;
18 
19  private:
20  curve_type _curve1, _curve2;
21 
22  public:
23 
24  inline explicit
25  Ruled_surface(const curve_type& c, const curve_type& d):
26  _curve1(c), _curve2(d) {}
27 
28  inline value_type
29  operator()(T u, T v) const {
30  const auto& c = this->_curve1;
31  const auto& d = this->_curve2;
32  return (T{1}-v)*c(u) + v*d(u);
33  }
34 
35  inline size_type
36  max_size() const {
37  return std::max(this->_curve1.size(), this->_curve2.size());
38  }
39 
40  };
41 
42  }
43 
44 }
45 
46 #endif // vim:filetype=cpp
Main namespace.
Definition: convert.hh:9