8 using namespace mathfce;
19 area_is_actual =
false;
20 center_is_actual =
false;
21 center.SetCoord(0, 0, 0);
44 stream <<
"V" << i <<
" = " << (*iv)->GetPoint() <<
"\n";
54 if ((*iv)->GetPoint() == P)
58 int insertPos = InsertPosition(*V);
59 area_is_actual =
false;
60 center_is_actual =
false;
61 verteces.insert(verteces.begin() + insertPos, V);
66 if (!center_is_actual)
76 double D[ 3 ] = {0, 0, 0};
78 if (verteces.size() < 3) {
79 center.SetCoord(D[ 0 ], D[ 1 ], D[ 2 ]);
84 for (i = 0; i < 3; i++)
85 D[ i ] += (*iv)->GetPoint().Get(i + 1);
87 for (i = 0; i < 3; i++)
88 D[ i ] /= verteces.size();
89 center.SetCoord(D[ 0 ], D[ 1 ], D[ 2 ]);
90 center_is_actual =
true;
107 if (verteces.size() < 2)
108 return verteces.size();
111 if (verteces.size() == 2) {
112 V1 = (*(verteces.begin()));
113 V2 = (*(verteces.begin() + 1));
117 normal_vector =
Cross(U1, U2);
118 return verteces.size();
121 for (
unsigned int i=0; i<verteces.size(); ++i) {
122 V1 = (*(verteces.begin() + i));
123 if (i == verteces.size() - 1)
124 V2 = (*(verteces.begin()));
126 V2 = (*(verteces.begin() + i + 1));
130 if (
Dot(N, normal_vector) < 0) {
131 if (pos > 0)
xprintf(
Msg,
" - TPolygon::InsertPosition - ERROR: only one vector product must be negative\n");
136 if (pos == 0)
xprintf(
Msg,
" - TPolygon::InsertPosition - ERROR: no vector product is negative\n");
147 area_is_actual =
true;
148 if (verteces.size() < 3)
153 P2 = (*iv)->GetPoint();
154 if (iv == verteces.end() - 1)
155 P3 = (*verteces.begin())->GetPoint();
157 P3 = (*(iv + 1))->GetPoint();
static int numberInstance
void SetPoints(const TPoint &, const TPoint &, const TPoint &)
TVector Cross(const TVector &, const TVector &)
int InsertPosition(const TVertex &Vx)
STREAM & operator<<(STREAM &s, UpdateFlags u)
#define FOR_POL_VERTECES(i, j)
double Dot(const TVector &, const TVector &)