VPTissue Reference Manual
ChainHull.h
Go to the documentation of this file.
1 #ifndef CHAINHULL_H_INCLUDED
2 #define CHAINHULL_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include <array>
23 #include <vector>
24 
25 namespace SimPT_Sim {
26 
30 class ChainHull
31 {
32 public:
33  static std::vector<std::array<double, 2> > Compute(const std::vector<std::array<double, 2> >& polygon);
34 
38  class Point
39  {
40  public:
42  Point(float xx = 0.0, float yy = 0.0) : x(xx), y(yy) {}
43 
45  double GetX() const { return x; }
46 
48  double GetY() const { return y; }
49 
50  private:
51  float x;
52  float y;
53  };
54 
55 private:
63  static int chainHull_2D(Point* P, int n, Point* H);
64 };
65 
69 bool operator<(ChainHull::Point const& p1, ChainHull::Point const& p2);
70 
71 } // namespace
72 
73 #endif // end_of_include_guard
Point class needed by 2D convex hull code.
Definition: ChainHull.h:38
Compute the convex hull of a set of two-dimensional points.
Definition: ChainHull.h:30
bool operator<(ChainHull::Point const &p1, ChainHull::Point const &p2)
Required to sort points (e.g.
Definition: ChainHull.cpp:72
Namespace for the core simulator.