1 |
foucault |
27 |
//---------------------------------------------------------------------------
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
#pragma hdrstop
|
5 |
|
|
|
6 |
|
|
#include "CAD4FE_MCNode.h"
|
7 |
|
|
#include <mg_maillage.h>
|
8 |
|
|
#include <mg_geometrie.h>
|
9 |
|
|
#include "CAD4FE_FaceBoundaryPoint.h"
|
10 |
|
|
#include "CAD4FE_MCVertex.h"
|
11 |
|
|
#include "CAD4FE_MCEdge.h"
|
12 |
|
|
#include "CAD4FE_MCFace.h"
|
13 |
|
|
#include "CAD4FE_geometric_tools.h"
|
14 |
|
|
#include <math.h>
|
15 |
|
|
|
16 |
|
|
//---------------------------------------------------------------------------
|
17 |
|
|
|
18 |
|
|
#pragma package(smart_init)
|
19 |
|
|
|
20 |
|
|
using namespace CAD4FE;
|
21 |
|
|
|
22 |
|
|
//---------------------------------------------------------------------------
|
23 |
|
|
MCNode::MCNode()
|
24 |
|
|
: MG_NOEUD (0, 0, 0, 0, 0), _saveFormat(0)
|
25 |
|
|
{
|
26 |
|
|
}
|
27 |
|
|
//---------------------------------------------------------------------------
|
28 |
|
|
MCNode::MCNode(unsigned long num,MG_ELEMENT_TOPOLOGIQUE* mcTopo,MG_ELEMENT_TOPOLOGIQUE* __refTopo,double xx,double yy,double zz)
|
29 |
|
|
: MG_NOEUD (num, mcTopo, xx,yy,zz),_refTopo(__refTopo), _saveFormat(0)
|
30 |
|
|
{
|
31 |
|
|
ConstructMapping();
|
32 |
|
|
}
|
33 |
|
|
//---------------------------------------------------------------------------
|
34 |
|
|
MCNode::MCNode(MG_ELEMENT_TOPOLOGIQUE* mcTopo,MG_ELEMENT_TOPOLOGIQUE* __refTopo,double xx,double yy,double zz)
|
35 |
|
|
: MG_NOEUD(mcTopo,xx,yy,zz),_refTopo(__refTopo), _saveFormat(0)
|
36 |
|
|
{
|
37 |
|
|
ConstructMapping();
|
38 |
|
|
}
|
39 |
|
|
//---------------------------------------------------------------------------
|
40 |
|
|
MCNode::MCNode(MG_ELEMENT_TOPOLOGIQUE* mcTopo,MG_FACE* __refFace, double __uv[2], double __xyz[3])
|
41 |
|
|
: MG_NOEUD(mcTopo,__xyz[0],__xyz[1],__xyz[2]),_refTopo(__refFace), _saveFormat(0)
|
42 |
|
|
{
|
43 |
|
|
OT_VECTEUR_3D uv(__uv[0], __uv[1], 0);
|
44 |
|
|
_F.insert(std::make_pair(__refFace, uv));
|
45 |
|
|
}
|
46 |
|
|
//---------------------------------------------------------------------------
|
47 |
|
|
MCNode::MCNode(MG_ELEMENT_TOPOLOGIQUE* mcTopo,MG_ARETE* __refEdge, double __t, double __xyz[3])
|
48 |
|
|
: MG_NOEUD(mcTopo,__xyz[0],__xyz[1],__xyz[2]),_refTopo(__refEdge), _saveFormat(0)
|
49 |
|
|
{
|
50 |
|
|
_E.insert(std::make_pair(__refEdge, __t));
|
51 |
|
|
ConstructMapping();
|
52 |
|
|
}
|
53 |
|
|
//---------------------------------------------------------------------------
|
54 |
|
|
MCNode::~MCNode()
|
55 |
|
|
{
|
56 |
|
|
}
|
57 |
|
|
//---------------------------------------------------------------------------
|
58 |
|
|
MCNode::MCNode(const MCNode& __src)
|
59 |
|
|
: MG_NOEUD ((MG_NOEUD & )__src)
|
60 |
|
|
{
|
61 |
|
|
/* for (FMapCIterator itF = __src._F.begin();
|
62 |
|
|
itF != __src._F.end();
|
63 |
|
|
itF++)
|
64 |
|
|
_F.insert(std::make_pair(itF->first,itF->second));
|
65 |
|
|
for (EMapCIterator itE = __src._E.begin();
|
66 |
|
|
itE != __src._E.end();
|
67 |
|
|
itE++)
|
68 |
|
|
_E.insert(std::make_pair(itE->first,itE->second));
|
69 |
|
|
for (VMapCIterator itV = __src._V.begin();
|
70 |
|
|
itV != __src._V.end();
|
71 |
|
|
itV++)
|
72 |
|
|
_V.insert(*itV); */
|
73 |
|
|
_F=__src._F;
|
74 |
|
|
_E=__src._E;
|
75 |
|
|
_V=__src._V;
|
76 |
|
|
_refTopo = __src._refTopo;
|
77 |
|
|
}
|
78 |
|
|
//---------------------------------------------------------------------------
|
79 |
|
|
void MCNode::CopyGeometry(const MCNode& __src)
|
80 |
|
|
{
|
81 |
|
|
/*_F.clear();
|
82 |
|
|
for (FMapCIterator itF = __src._F.begin();
|
83 |
|
|
itF != __src._F.end();
|
84 |
|
|
itF++)
|
85 |
|
|
_F.insert(std::make_pair(itF->first,itF->second));
|
86 |
|
|
_E.clear();
|
87 |
|
|
for (EMapCIterator itE = __src._E.begin();
|
88 |
|
|
itE != __src._E.end();
|
89 |
|
|
itE++)
|
90 |
|
|
_E.insert(std::make_pair(itE->first,itE->second));
|
91 |
|
|
_V.clear();
|
92 |
|
|
for (VMapCIterator itV = __src._V.begin();
|
93 |
|
|
itV != __src._V.end();
|
94 |
|
|
itV++)
|
95 |
|
|
_V.insert(*itV); */
|
96 |
|
|
_F.clear();_E.clear();_V.clear();
|
97 |
|
|
_F=__src._F;
|
98 |
|
|
_E=__src._E;
|
99 |
|
|
_V=__src._V;
|
100 |
|
|
_refTopo = __src._refTopo;
|
101 |
|
|
for (int i=0;i<3;i++)xyz[i]=__src.xyz[i];
|
102 |
|
|
}
|
103 |
|
|
//---------------------------------------------------------------------------
|
104 |
|
|
int MCNode::get_type_entite ()
|
105 |
|
|
{
|
106 |
|
|
return IDMCNODE;
|
107 |
|
|
}
|
108 |
|
|
//---------------------------------------------------------------------------
|
109 |
|
|
MG_ELEMENT_TOPOLOGIQUE * MCNode::get_lien_topologie_reference()
|
110 |
|
|
{
|
111 |
|
|
return _refTopo;
|
112 |
|
|
}
|
113 |
|
|
//---------------------------------------------------------------------------
|
114 |
|
|
void MCNode::change_lien_topologie_reference(MG_ELEMENT_TOPOLOGIQUE *__refTopo)
|
115 |
|
|
{
|
116 |
|
|
_refTopo = __refTopo;
|
117 |
|
|
}
|
118 |
|
|
MCNode::FMap & MCNode::GetRefFaceMapping() {return _F;}
|
119 |
|
|
MCNode::EMap & MCNode::GetRefEdgeMapping() {return _E;}
|
120 |
|
|
MCNode::VMap & MCNode::GetRefVertexMapping() {return _V;}
|
121 |
|
|
void MCNode::SetRefFaceMapping(MG_FACE * __face, double * __uv) {OT_VECTEUR_3D vec(__uv[0],__uv[1],0);_F[__face] = vec;}
|
122 |
|
|
void MCNode::SetRefEdgeMapping(MG_ARETE * __edge, double __t) {_E[__edge] = __t;}
|
123 |
|
|
void MCNode::SetRefVertexMapping(MG_SOMMET * __vertex) { _V.insert(__vertex); }
|
124 |
|
|
//---------------------------------------------------------------------------
|
125 |
|
|
void MCNode::ConstructMapping()
|
126 |
|
|
{
|
127 |
|
|
MG_ELEMENT_TOPOLOGIQUE * topo = _refTopo;
|
128 |
|
|
|
129 |
|
|
if (topo == NULL) // should happen rarely
|
130 |
|
|
return;
|
131 |
|
|
|
132 |
|
|
switch (topo->get_dimension())
|
133 |
|
|
{
|
134 |
|
|
case 0:
|
135 |
|
|
{
|
136 |
|
|
// Look for an existing MC Node on this vertex
|
137 |
|
|
MG_SOMMET* vertex=(MG_SOMMET*)topo;
|
138 |
|
|
MCNode * mcNode = 0;
|
139 |
|
|
|
140 |
|
|
TPL_SET<MG_ELEMENT_MAILLAGE*> * lien_maillage = vertex->get_lien_maillage(); |
141 |
|
|
TPL_SET<MG_ELEMENT_MAILLAGE*>::ITERATEUR it; |
142 |
|
|
MG_ELEMENT_MAILLAGE* element; |
143 |
|
|
int nb = lien_maillage->get_nb(); |
144 |
|
|
int i=0; |
145 |
|
|
for (element = lien_maillage->get_premier(it); i++ < nb && element ; element = lien_maillage->get_suivant(it) ) |
146 |
|
|
{ |
147 |
|
|
int elementType = element->get_type_entite(); |
148 |
|
|
if ( elementType == IDMCNODE && element != this ) |
149 |
|
|
{ |
150 |
|
|
MCNode * tmpmcNode = (MCNode*) element; |
151 |
|
|
if (tmpmcNode->_V.size() && tmpmcNode->_E.size() && tmpmcNode->_F.size()) |
152 |
|
|
{ |
153 |
|
|
mcNode = tmpmcNode; |
154 |
|
|
break; |
155 |
|
|
} |
156 |
|
|
} |
157 |
|
|
}
|
158 |
|
|
// Make a copy of the mapping to the existing MC node
|
159 |
|
|
if (mcNode)
|
160 |
|
|
{
|
161 |
|
|
_V = mcNode->_V;
|
162 |
|
|
_E = mcNode->_E;
|
163 |
|
|
_F = mcNode->_F;
|
164 |
|
|
}
|
165 |
|
|
// Compute the topology mapping
|
166 |
|
|
else
|
167 |
|
|
{
|
168 |
|
|
_V.insert((MG_SOMMET*)topo);
|
169 |
|
|
if (get_lien_topologie())
|
170 |
|
|
{
|
171 |
|
|
if (get_lien_topologie()->get_dimension() == 0)
|
172 |
|
|
{
|
173 |
|
|
MCVertex * mcVertex = (MCVertex*)get_lien_topologie();
|
174 |
|
|
for (std::map<unsigned long, MG_SOMMET*>::iterator itMergedVertex = mcVertex->GetMergedRefVertices().begin();
|
175 |
|
|
itMergedVertex != mcVertex->GetMergedRefVertices().end();
|
176 |
|
|
itMergedVertex++)
|
177 |
|
|
_V.insert(itMergedVertex->second);
|
178 |
|
|
}
|
179 |
|
|
if (get_lien_topologie()->get_dimension() == 1)
|
180 |
|
|
{
|
181 |
|
|
MCEdge * mcEdge = (MCEdge*)get_lien_topologie();
|
182 |
|
|
MCVertex * mcVertex[2];
|
183 |
|
|
mcVertex[0] = (MCVertex*)mcEdge->get_cosommet1()->get_sommet();
|
184 |
|
|
mcVertex[1] = (MCVertex*)mcEdge->get_cosommet2()->get_sommet();
|
185 |
|
|
for (int j = 0; j<2; j++)
|
186 |
|
|
{
|
187 |
|
|
std::map<unsigned long, MG_SOMMET*>::iterator itMergedVertex = mcVertex[j]->GetMergedRefVertices().find(_refTopo->get_id());
|
188 |
|
|
if (itMergedVertex != mcVertex[j]->GetMergedRefVertices().end())
|
189 |
|
|
{
|
190 |
|
|
for (itMergedVertex = mcVertex[j]->GetMergedRefVertices().begin();
|
191 |
|
|
itMergedVertex != mcVertex[j]->GetMergedRefVertices().end();
|
192 |
|
|
itMergedVertex++)
|
193 |
|
|
_V.insert(itMergedVertex->second);
|
194 |
|
|
}
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
|
|
}
|
198 |
|
|
else
|
199 |
|
|
{
|
200 |
|
|
printf("Warning: MC topology of MC Node = NULL!\n");
|
201 |
|
|
}
|
202 |
|
|
for (std::set<MG_SOMMET*>::iterator itV = _V.begin();
|
203 |
|
|
itV != _V.end();
|
204 |
|
|
itV++)
|
205 |
|
|
{
|
206 |
|
|
MG_SOMMET * v = *itV;
|
207 |
|
|
// Init Edge Mapping
|
208 |
|
|
for (int itE = 0; itE < v->get_nb_mg_cosommet(); itE++)
|
209 |
|
|
{
|
210 |
|
|
MG_ARETE * edge = v->get_mg_cosommet(itE)->get_arete();
|
211 |
|
|
|
212 |
|
|
// edge parameter is the reference vertex parameter
|
213 |
|
|
MG_SOMMET * refVertex = (MG_SOMMET *) _refTopo;
|
214 |
|
|
if ( v == refVertex || (edge->get_cosommet1()->get_sommet() != refVertex) && (edge->get_cosommet1()->get_sommet() != refVertex) )
|
215 |
|
|
{
|
216 |
|
|
double tEdge = v->get_mg_cosommet(itE)->get_t();
|
217 |
|
|
double edgePeriod = edge->get_courbe()->get_periode();
|
218 |
|
|
if ( tEdge < edge->get_tmin() && edgePeriod != 0.0 )
|
219 |
|
|
{
|
220 |
|
|
tEdge += edgePeriod;
|
221 |
|
|
}
|
222 |
|
|
_E.insert(std::make_pair(edge, tEdge));
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
// Init Face mapping
|
226 |
|
|
for (int itF = 0; itF < edge->get_nb_mg_coarete(); itF++)
|
227 |
|
|
{
|
228 |
|
|
MG_FACE * face = edge->get_mg_coarete(itF)->get_boucle()->get_mg_face();
|
229 |
|
|
|
230 |
|
|
if (v != refVertex && GeometricTools::MG_FACE_Contains_MG_SOMMET(face,refVertex) )
|
231 |
|
|
continue;
|
232 |
|
|
|
233 |
|
|
if ( _F.find(face) == _F.end() )
|
234 |
|
|
{
|
235 |
|
|
// project vertex in face parametrization
|
236 |
|
|
OT_VECTEUR_3D uv(0,0,0);
|
237 |
|
|
face->inverser(uv,xyz,1E-6);
|
238 |
|
|
// correct uv coordinates of 3D points which are not
|
239 |
|
|
// exactly on "exact surfaces" (torus, sphere, cylinder, cone, etc)
|
240 |
|
|
GeometricTools::FacePointCorrection(face,xyz,uv);
|
241 |
|
|
_F.insert(std::make_pair(face, uv));
|
242 |
|
|
}
|
243 |
|
|
}
|
244 |
|
|
}
|
245 |
|
|
}
|
246 |
|
|
}
|
247 |
|
|
break;
|
248 |
|
|
}
|
249 |
|
|
case 1:
|
250 |
|
|
{
|
251 |
|
|
MG_ARETE * edge = (MG_ARETE*) topo;
|
252 |
|
|
|
253 |
|
|
// Init Edge Mapping
|
254 |
|
|
// Not implemented : parameter of edge mapping
|
255 |
|
|
if (_E.find(edge) == _E.end())
|
256 |
|
|
{
|
257 |
|
|
double tEdge;
|
258 |
|
|
double edgePeriod = edge->get_courbe()->get_periode();
|
259 |
|
|
edge->inverser(tEdge,xyz);
|
260 |
|
|
if ( tEdge < edge->get_tmin() && edgePeriod != 0.0 )
|
261 |
|
|
{
|
262 |
|
|
tEdge += edgePeriod;
|
263 |
|
|
}
|
264 |
|
|
_E.insert(std::make_pair(edge, tEdge));
|
265 |
|
|
}
|
266 |
|
|
|
267 |
|
|
// Init Face mapping
|
268 |
|
|
for (int itF = 0; itF < edge->get_nb_mg_coarete(); itF++)
|
269 |
|
|
{
|
270 |
|
|
MG_FACE * face = edge->get_mg_coarete(itF)->get_boucle()->get_mg_face();
|
271 |
|
|
OT_VECTEUR_3D uv(0,0,0);
|
272 |
|
|
face->inverser(uv,xyz,1E-6);
|
273 |
|
|
// correct uv coordinates of 3D points which are not
|
274 |
|
|
// exactly on "exact surfaces" (torus, sphere, cylinder, cone, etc)
|
275 |
|
|
GeometricTools::FacePointCorrection(face,xyz,uv);
|
276 |
|
|
_F.insert(std::make_pair(face, uv));
|
277 |
|
|
}
|
278 |
|
|
break;
|
279 |
|
|
}
|
280 |
|
|
case 2:
|
281 |
|
|
{
|
282 |
|
|
// Init Face Mapping
|
283 |
|
|
MG_FACE * face = (MG_FACE*) topo;
|
284 |
|
|
OT_VECTEUR_3D uv(0,0,0);
|
285 |
|
|
face->inverser(uv,xyz,1E-6);
|
286 |
|
|
// correct uv coordinates of 3D points which are not
|
287 |
|
|
// exactly on "exact surfaces" (torus, sphere, cylinder, cone, etc)
|
288 |
|
|
GeometricTools::FacePointCorrection(face,xyz,uv);
|
289 |
|
|
_F.insert(std::make_pair(face, uv));
|
290 |
|
|
break;
|
291 |
|
|
}
|
292 |
|
|
|
293 |
|
|
}
|
294 |
|
|
}
|
295 |
|
|
//---------------------------------------------------------------------------
|
296 |
|
|
void MCNode::SharedFaces(MCNode * __other, std::set <MG_FACE*> & __setF)
|
297 |
|
|
{
|
298 |
|
|
for (MCNode::FMapIterator itF1 = _F.begin();
|
299 |
|
|
itF1 != _F.end();
|
300 |
|
|
itF1 ++ )
|
301 |
|
|
if (__other->_F.find(itF1->first) != __other->_F.end())
|
302 |
|
|
__setF.insert (itF1->first);
|
303 |
|
|
}
|
304 |
|
|
//---------------------------------------------------------------------------
|
305 |
|
|
void MCNode::SharedEdges(MCNode * __other, std::set <MG_ARETE*> & __setE)
|
306 |
|
|
{
|
307 |
|
|
for (MCNode::EMapIterator itE1 = _E.begin();
|
308 |
|
|
itE1 != _E.end();
|
309 |
|
|
itE1 ++ )
|
310 |
|
|
if (__other->_E.find(itE1->first) != __other->_E.end())
|
311 |
|
|
__setE.insert (itE1->first);
|
312 |
|
|
}
|
313 |
|
|
//---------------------------------------------------------------------------
|
314 |
|
|
void MCNode::SharedVertices(MCNode * __other, std::set <MG_SOMMET*> & __setV)
|
315 |
|
|
{
|
316 |
|
|
for (MCNode::VMapIterator itV1 = _V.begin();
|
317 |
|
|
itV1 != _V.end();
|
318 |
|
|
itV1 ++ )
|
319 |
|
|
if (__other->_V.find(*itV1) != __other->_V.end())
|
320 |
|
|
__setV.insert (*itV1);
|
321 |
|
|
}
|
322 |
|
|
//---------------------------------------------------------------------------
|
323 |
|
|
bool MCNode::IsInFace (MG_FACE * __e)
|
324 |
|
|
{
|
325 |
|
|
FMapIterator itF = _F.find(__e);
|
326 |
|
|
return (itF != _F.end());
|
327 |
|
|
}
|
328 |
|
|
//---------------------------------------------------------------------------
|
329 |
|
|
void MCNode::NormalMCFace(MCFace* __mcFace, double * __normal)
|
330 |
|
|
{ |
331 |
|
|
int nbRefFaces=0; |
332 |
|
|
int dimension=_refTopo->get_dimension(); |
333 |
|
|
switch (dimension) |
334 |
|
|
{ |
335 |
|
|
case 1: |
336 |
|
|
{ |
337 |
|
|
__mcFace->calcul_normale_unitaire(GetRefFaceMapping(), __normal, &nbRefFaces); |
338 |
|
|
return; |
339 |
|
|
} |
340 |
|
|
case 2: |
341 |
|
|
{ |
342 |
|
|
__mcFace->calcul_normale_unitaire(GetRefFaceMapping(), __normal, &nbRefFaces); |
343 |
|
|
return; |
344 |
|
|
} |
345 |
|
|
case 0: |
346 |
|
|
{ |
347 |
|
|
__mcFace->calcul_normale_unitaire((MG_SOMMET*) _refTopo, __normal, &nbRefFaces); |
348 |
|
|
} |
349 |
|
|
} |
350 |
|
|
}
|
351 |
|
|
|
352 |
|
|
//---------------------------------------------------------------------------
|
353 |
|
|
bool MCNode::RefTopoIsInFace (MG_FACE * __e)
|
354 |
|
|
{
|
355 |
|
|
FMapIterator itF = _F.find(__e);
|
356 |
|
|
if (itF == _F.end()) return false;
|
357 |
|
|
switch (_refTopo->get_dimension())
|
358 |
|
|
{
|
359 |
|
|
case 0:
|
360 |
|
|
if (_V.size() <= 1) // if it's not in a merged vertex, then no further test is required
|
361 |
|
|
return true;
|
362 |
|
|
else
|
363 |
|
|
return (GeometricTools::MG_FACE_Contains_MG_SOMMET(__e, (MG_SOMMET*) _refTopo));
|
364 |
|
|
default:
|
365 |
|
|
return true;
|
366 |
|
|
}
|
367 |
|
|
}
|
368 |
|
|
//---------------------------------------------------------------------------
|
369 |
|
|
bool MCNode::RefTopoIsInEdge (MG_ARETE * __e)
|
370 |
|
|
{
|
371 |
|
|
EMapIterator itE = _E.find(__e);
|
372 |
|
|
if (itE == _E.end()) return false;
|
373 |
|
|
switch (_refTopo->get_dimension())
|
374 |
|
|
{
|
375 |
|
|
case 0:
|
376 |
|
|
if (_V.size() <= 1) // if it's not in a merged vertex, then no further test is required
|
377 |
|
|
return true;
|
378 |
|
|
else
|
379 |
|
|
return (GeometricTools::MG_ARETE_Contains_MG_SOMMET(__e, (MG_SOMMET*) _refTopo));
|
380 |
|
|
default:
|
381 |
|
|
return true;
|
382 |
|
|
}
|
383 |
|
|
}
|
384 |
|
|
//---------------------------------------------------------------------------
|
385 |
|
|
bool MCNode::IsInEdge (MG_ARETE * __e)
|
386 |
|
|
{
|
387 |
|
|
return (_E.find(__e) != _E.end());
|
388 |
|
|
}
|
389 |
|
|
//---------------------------------------------------------------------------
|
390 |
|
|
bool MCNode::IsInVertex (MG_SOMMET * __e)
|
391 |
|
|
{
|
392 |
|
|
return (_V.find(__e) != _V.end());
|
393 |
|
|
}
|
394 |
|
|
//---------------------------------------------------------------------------
|
395 |
|
|
bool MCNode::RefTopoIsInVertex (MG_SOMMET * __e)
|
396 |
|
|
{
|
397 |
|
|
return (_refTopo != __e);
|
398 |
|
|
}
|
399 |
|
|
//---------------------------------------------------------------------------
|
400 |
|
|
MG_SOMMET * MCNode::GetMergedVertex(MG_FACE * __face)
|
401 |
|
|
{
|
402 |
|
|
if (_V.size() > 1)
|
403 |
|
|
{
|
404 |
|
|
MG_SOMMET * refVertex = (MG_SOMMET*) _refTopo;
|
405 |
|
|
for (VMapIterator itV = _V.begin();
|
406 |
|
|
itV != _V.end();
|
407 |
|
|
itV++)
|
408 |
|
|
{
|
409 |
|
|
MG_SOMMET * mergedVertex = *itV;
|
410 |
|
|
if (mergedVertex == refVertex)
|
411 |
|
|
continue;
|
412 |
|
|
if (GeometricTools::MG_FACE_Contains_MG_SOMMET(__face, mergedVertex))
|
413 |
|
|
return mergedVertex;
|
414 |
|
|
}
|
415 |
|
|
}
|
416 |
|
|
return NULL;
|
417 |
|
|
}
|
418 |
|
|
//---------------------------------------------------------------------------
|
419 |
|
|
OT_VECTEUR_3D & MCNode::GetFaceParams (MG_FACE * __e)
|
420 |
|
|
{
|
421 |
|
|
static OT_VECTEUR_3D badParam (-1E308,-1E308,-1E308);
|
422 |
|
|
FMapIterator itF = _F.find(__e);
|
423 |
|
|
if (itF != _F.end())
|
424 |
|
|
return itF->second;
|
425 |
|
|
else
|
426 |
|
|
return badParam;
|
427 |
|
|
}
|
428 |
|
|
//---------------------------------------------------------------------------
|
429 |
|
|
OT_VECTEUR_3D & MCNode::UV (MG_FACE * __e)
|
430 |
|
|
{
|
431 |
|
|
return GetFaceParams (__e);
|
432 |
|
|
}
|
433 |
|
|
//---------------------------------------------------------------------------
|
434 |
|
|
double MCNode::GetEdgeParams (MG_ARETE * __e)
|
435 |
|
|
{
|
436 |
|
|
static badParam = -1E308;
|
437 |
|
|
EMapCIterator itE = _E.find(__e);
|
438 |
|
|
if (itE != _E.end())
|
439 |
|
|
return itE->second;
|
440 |
|
|
else
|
441 |
|
|
return badParam;
|
442 |
|
|
}
|
443 |
|
|
//---------------------------------------------------------------------------
|
444 |
|
|
double MCNode::T (MG_ARETE * __e)
|
445 |
|
|
{
|
446 |
|
|
return GetEdgeParams(__e);
|
447 |
|
|
}
|
448 |
|
|
//---------------------------------------------------------------------------
|
449 |
|
|
|
450 |
|
|
void MCNode::SetSaveFormat(char __format)
|
451 |
|
|
{
|
452 |
|
|
_saveFormat=__format;
|
453 |
|
|
if (__format == 2)
|
454 |
|
|
{
|
455 |
|
|
change_lien_topologie(_refTopo);
|
456 |
|
|
}
|
457 |
|
|
}
|
458 |
|
|
|
459 |
|
|
void MCNode::enregistrer(std::ostream& o)
|
460 |
|
|
{
|
461 |
|
|
if (_saveFormat==0)
|
462 |
|
|
{
|
463 |
|
|
o << "%" << get_id() << "=CAD4FE_MCNODE($"<< _refTopo->get_id() <<",$" << get_lien_topologie()->get_id() << "," << xyz[0] << "," << xyz[1] << "," << xyz[2] << ");" << std::endl;
|
464 |
|
|
}
|
465 |
|
|
else if (_saveFormat==1)
|
466 |
|
|
{
|
467 |
|
|
MG_NOEUD::enregistrer (o);
|
468 |
|
|
}
|
469 |
|
|
else if (_saveFormat==2)
|
470 |
|
|
{
|
471 |
|
|
MG_NOEUD::enregistrer (o);
|
472 |
|
|
}
|
473 |
|
|
}
|
474 |
|
|
//---------------------------------------------------------------------------
|
475 |
|
|
|
476 |
|
|
void MCNode::Print()
|
477 |
|
|
{
|
478 |
|
|
printf("%f %f %f ", get_x(), get_y(), get_z());
|
479 |
|
|
}
|
480 |
|
|
|