36 area_is_actual =
false;
37 center_is_actual =
false;
38 center.SetCoord(0, 0, 0);
61 stream <<
"V" << i <<
" = " << (*iv)->GetPoint() <<
"\n";
71 if ((*iv)->GetPoint() == P)
75 int insertPos = InsertPosition(*V);
76 area_is_actual =
false;
77 center_is_actual =
false;
78 verteces.insert(verteces.begin() + insertPos, V);
83 if (!center_is_actual)
93 double D[ 3 ] = {0, 0, 0};
95 if (verteces.size() < 3) {
96 center.SetCoord(D[ 0 ], D[ 1 ], D[ 2 ]);
101 for (i = 0; i < 3; i++)
102 D[ i ] += (*iv)->GetPoint().Get(i + 1);
104 for (i = 0; i < 3; i++)
105 D[ i ] /= verteces.size();
106 center.SetCoord(D[ 0 ], D[ 1 ], D[ 2 ]);
107 center_is_actual =
true;
112 if (center_is_actual)
124 if (verteces.size() < 2)
125 return verteces.size();
128 if (verteces.size() == 2) {
129 V1 = (*(verteces.begin()));
130 V2 = (*(verteces.begin() + 1));
134 normal_vector =
Cross(U1, U2);
135 return verteces.size();
138 for (
unsigned int i=0; i<verteces.size(); ++i) {
139 V1 = (*(verteces.begin() + i));
140 if (i == verteces.size() - 1)
141 V2 = (*(verteces.begin()));
143 V2 = (*(verteces.begin() + i + 1));
147 if (
Dot(N, normal_vector) < 0) {
148 if (pos > 0)
MessageOut() <<
"TPolygon::InsertPosition - ERROR: only one vector product must be negative\n";
153 if (pos == 0)
MessageOut() <<
"TPolygon::InsertPosition - ERROR: no vector product is negative\n";
164 area_is_actual =
true;
165 if (verteces.size() < 3)
170 P2 = (*iv)->GetPoint();
171 if (iv == verteces.end() - 1)
172 P3 = (*verteces.begin())->GetPoint();
174 P3 = (*(iv + 1))->GetPoint();
#define MessageOut()
Macro defining 'message' record of log.
#define FOR_POL_VERTECES(i, j)
static int numberInstance
void SetPoints(const TPoint &, const TPoint &, const TPoint &)
TVector Cross(const TVector &, const TVector &)
int InsertPosition(const TVertex &Vx)
std::ostream & operator<<(std::ostream &stream, const TPolygon &p)
double Dot(const TVector &, const TVector &)