Flow123d
polygon.h
Go to the documentation of this file.
1 #ifndef polygonH
2 #define polygonH
3 
4 #include "vertex.h"
5 #include "triangle.h"
6 #include <vector>
7 
8 #define FOR_POL_VERTECES(i,j) \
9  for((j)=(i)->verteces.begin();(j)!=(i)->verteces.end();(j)++)
10 
11 class TPolygon {
12 private:
13  static int numberInstance;
14  int id;
15 
16  double area;
21 
23 
24  int generateId();
25 
26  void ComputeCenter();
27  void ComputeArea();
28 
29  /**
30  * Find position of new vertex
31  *
32  * @param Vx New vertex
33  * @return position of new vertex
34  */
35  int InsertPosition(const TVertex& Vx);
36 
37 public:
38  TPolygon();
39  ~TPolygon();
40 
41  friend std::ostream & operator <<(std::ostream&, const TPolygon&);
42 
43  void Add(const TPoint&);
44  double GetArea();
45  TPoint GetCenter();
46 
47  /**
48  * Get count of vertexes
49  */
51  return verteces.size();
52  }
53 
54  static int getNumInstances() {
56  }
57 };
58 
59 #endif
60