Flow123d  release_2.2.0-36-g163dc99
polygon.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file polygon.h
15  * @brief
16  */
17 
18 #ifndef polygonH
19 #define polygonH
20 
21 #include "vertex.h"
22 #include "triangle.h"
23 #include <vector>
24 
25 #define FOR_POL_VERTECES(i,j) \
26  for((j)=(i)->verteces.begin();(j)!=(i)->verteces.end();(j)++)
27 
28 class TPolygon {
29 private:
30  static int numberInstance;
31  int id;
32 
33  double area;
38 
40 
41  int generateId();
42 
43  void ComputeCenter();
44  void ComputeArea();
45 
46  /**
47  * Find position of new vertex
48  *
49  * @param Vx New vertex
50  * @return position of new vertex
51  */
52  int InsertPosition(const TVertex& Vx);
53 
54 public:
55  TPolygon();
56  ~TPolygon();
57 
58  friend std::ostream & operator <<(std::ostream&, const TPolygon&);
59 
60  void Add(const TPoint&);
61  double GetArea();
62  TPoint GetCenter();
63 
64  /**
65  * Get count of vertexes
66  */
68  return verteces.size();
69  }
70 
71  static int getNumInstances() {
73  }
74 };
75 
76 #endif
77 
TVector normal_vector
Definition: polygon.h:35
std::vector< TVertex * > verteces
Definition: polygon.h:39
void ComputeCenter()
Definition: polygon.cpp:91
double area
Definition: polygon.h:33
TPoint center
Definition: polygon.h:34
bool area_is_actual
Definition: polygon.h:36
int vertexes_count()
Definition: polygon.h:67
TPoint GetCenter()
Definition: polygon.cpp:111
void ComputeArea()
Definition: polygon.cpp:157
Definition: point.h:27
static int numberInstance
Definition: polygon.h:30
~TPolygon()
Definition: polygon.cpp:42
int generateId()
Definition: polygon.cpp:29
int id
Definition: polygon.h:31
bool center_is_actual
Definition: polygon.h:37
int InsertPosition(const TVertex &Vx)
Definition: polygon.cpp:118
double GetArea()
Definition: polygon.cpp:82
void Add(const TPoint &)
Definition: polygon.cpp:67
TPolygon()
Definition: polygon.cpp:33
Definition: vertex.h:23
static int getNumInstances()
Definition: polygon.h:71
friend std::ostream & operator<<(std::ostream &, const TPolygon &)
Definition: polygon.cpp:52