Virtual Testbed
Ship dynamics simulator for extreme conditions
polyline.hh
1 #ifndef VTESTBED_GEOMETRY_POLYLINE_HH
2 #define VTESTBED_GEOMETRY_POLYLINE_HH
3 
4 #include <iosfwd>
5 #include <queue>
6 
7 #include <vtestbed/geometry/line_segment.hh>
8 #include <vtestbed/geometry/types.hh>
9 
10 namespace vtb {
11 
12  namespace geometry {
13 
19  template <class T, int N>
20  class Polyline: public std::vector<Line_segment<T,N>> {
21 
22  private:
24 
25  public:
26  static constexpr const int dimensions = N;
27  using scalar_type = T;
28  using value_type = typename base_type::value_type;
29  using pointer = typename base_type::pointer;
30  using const_pointer = typename base_type::const_pointer;
31  using reference = typename base_type::reference;
32  using const_reference = typename base_type::const_reference;
33  using iterator = typename base_type::iterator;
34  using const_iterator = typename base_type::const_iterator;
35  using size_type = typename base_type::size_type;
36  using difference_type = typename base_type::difference_type;
37  using reverse_iterator = typename base_type::reverse_iterator;
38  using const_reverse_iterator = typename base_type::const_reverse_iterator;
39 
40  public:
41  using base_type::base_type;
42  using base_type::operator=;
43  using base_type::operator[];
44 
53  void gift_wrap();
54  void remove_interior();
55  void reorder();
56  void stitch();
57  void simplify();
58  void gnuplot(std::ostream& out) const;
59 
60  Polygon<T,N> polygon() const;
61 
62  };
63 
64  template <class T, int N>
65  struct is_figure<Polyline<T,N>>: public std::true_type {};
66 
76  template <class T, int N>
78 
79  }
80 
81 }
82 
83 #endif // vim:filetype=cpp
Mass_moments< T, N > mass_moments(const Polyline< T, N > &polyline)
Calculate area, centroid and inertia tensor.
A polygon composed of line segments.
Definition: polyline.hh:20
void gift_wrap()
Convex hull.
Definition: polyline.cc:76
Main namespace.
Definition: convert.hh:9