1 |
francois |
1158 |
//####//------------------------------------------------------------ |
2 |
|
|
//####//------------------------------------------------------------ |
3 |
|
|
//####// MAGiC |
4 |
|
|
//####// Jean Christophe Cuilliere et Vincent FRANCOIS |
5 |
|
|
//####// Departement de Genie Mecanique - UQTR |
6 |
|
|
//####//------------------------------------------------------------ |
7 |
|
|
//####// MAGIC est un projet de recherche de l equipe ERICCA |
8 |
|
|
//####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres |
9 |
|
|
//####// http://www.uqtr.ca/ericca |
10 |
|
|
//####// http://www.uqtr.ca/ |
11 |
|
|
//####//------------------------------------------------------------ |
12 |
|
|
//####//------------------------------------------------------------ |
13 |
|
|
//####// |
14 |
|
|
//####// ot_geometrie.cpp |
15 |
|
|
//####// |
16 |
|
|
//####//------------------------------------------------------------ |
17 |
|
|
//####//------------------------------------------------------------ |
18 |
|
|
//####// COPYRIGHT 2000-2024 |
19 |
|
|
//####// jeu 13 jun 2024 11:58:54 EDT |
20 |
|
|
//####//------------------------------------------------------------ |
21 |
|
|
//####//------------------------------------------------------------ |
22 |
couturad |
907 |
#include "ot_geometrie.h" |
23 |
|
|
#include "ot_mathematique.h" |
24 |
|
|
#ifdef ALL_OCC |
25 |
|
|
#include <BRepExtrema_DistShapeShape.hxx> |
26 |
couturad |
951 |
#include <BRepExtrema_DistanceSS.hxx> |
27 |
couturad |
907 |
#include <GeomAPI_ProjectPointOnCurve.hxx> |
28 |
|
|
#include <GeomAPI_ProjectPointOnSurf.hxx> |
29 |
|
|
#include <ShapeAnalysis.hxx> |
30 |
|
|
#include <BRepBuilderAPI_MakeVertex.hxx> |
31 |
couturad |
911 |
#include <BRepAlgoAPI_Common.hxx> |
32 |
|
|
#include <BRepGProp.hxx> |
33 |
|
|
#include <GProp_GProps.hxx> |
34 |
couturad |
951 |
#include <BRepExtrema_ShapeProximity.hxx> |
35 |
couturad |
1029 |
#include <BRepClass3d_SolidClassifier.hxx> |
36 |
couturad |
911 |
#include <limits> |
37 |
|
|
|
38 |
couturad |
907 |
#endif |
39 |
|
|
|
40 |
|
|
OT_GEOMETRIE::OT_GEOMETRIE() |
41 |
|
|
{ |
42 |
|
|
|
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
OT_GEOMETRIE::~OT_GEOMETRIE() |
46 |
|
|
{ |
47 |
|
|
|
48 |
|
|
} |
49 |
|
|
|
50 |
couturad |
968 |
BOITE_3D OT_GEOMETRIE::get_boite_3D(MG_VOLUME* mgvolume) |
51 |
|
|
{ |
52 |
|
|
#ifdef ALL_OCC |
53 |
|
|
TopoDS_Shape shape1; |
54 |
|
|
shape1=dynamic_cast<OCC_VOLUME*>(mgvolume)->get_TopoDS_Solid(); |
55 |
|
|
Bnd_Box box_shape1; |
56 |
|
|
BRepBndLib::AddOptimal(shape1,box_shape1); |
57 |
|
|
return BOITE_3D(box_shape1.CornerMin().X(),box_shape1.CornerMin().Y(),box_shape1.CornerMin().Z(),box_shape1.CornerMax().X(),box_shape1.CornerMax().Y(),box_shape1.CornerMax().Z()); |
58 |
|
|
#endif |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
|
62 |
couturad |
951 |
int OT_GEOMETRIE::get_lien_topologique(MG_ELEMENT_TOPOLOGIQUE* mgeletopo1, MG_ELEMENT_TOPOLOGIQUE* mgeletopo2) |
63 |
|
|
{ |
64 |
|
|
TPL_MAP_ENTITE<MG_SOMMET*> tpl_map_sommet1; |
65 |
|
|
TPL_MAP_ENTITE<MG_SOMMET*> tpl_map_sommet2; |
66 |
|
|
TPL_MAP_ENTITE<MG_ARETE*> tpl_map_arete1; |
67 |
|
|
TPL_MAP_ENTITE<MG_ARETE*> tpl_map_arete2; |
68 |
|
|
TPL_MAP_ENTITE<MG_FACE*> tpl_map_face1; |
69 |
|
|
TPL_MAP_ENTITE<MG_FACE*> tpl_map_face2; |
70 |
|
|
get_map_mg_ele_topo_sous_jacent(mgeletopo1,tpl_map_sommet1,tpl_map_arete1,tpl_map_face1); |
71 |
|
|
get_map_mg_ele_topo_sous_jacent(mgeletopo2,tpl_map_sommet2,tpl_map_arete2,tpl_map_face2); |
72 |
|
|
if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) tpl_map_face1.ajouter(dynamic_cast<MG_FACE*>(mgeletopo1)); |
73 |
|
|
else if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE) tpl_map_arete1.ajouter(dynamic_cast<MG_ARETE*>(mgeletopo1)); |
74 |
|
|
else if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET) tpl_map_sommet1.ajouter(dynamic_cast<MG_SOMMET*>(mgeletopo1)); |
75 |
|
|
if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) tpl_map_face2.ajouter(dynamic_cast<MG_FACE*>(mgeletopo2)); |
76 |
|
|
else if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE) tpl_map_arete2.ajouter(dynamic_cast<MG_ARETE*>(mgeletopo2)); |
77 |
|
|
else if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET) tpl_map_sommet2.ajouter(dynamic_cast<MG_SOMMET*>(mgeletopo2)); |
78 |
|
|
bool trouve=false; |
79 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face1; |
80 |
|
|
MG_FACE *face1=tpl_map_face1.get_premier(it_face1); |
81 |
|
|
while(trouve==false && face1!=NULL) |
82 |
|
|
{ |
83 |
|
|
if(tpl_map_face2.existe(face1)) |
84 |
|
|
{ |
85 |
|
|
trouve=true; |
86 |
|
|
return TYPE_LIEN_TOPOLOGIQUE::FACE; |
87 |
|
|
} |
88 |
|
|
else face1=tpl_map_face1.get_suivant(it_face1); |
89 |
|
|
} |
90 |
|
|
TPL_MAP_ENTITE<MG_ARETE*>::ITERATEUR it_arete1; |
91 |
|
|
MG_ARETE *arete1=tpl_map_arete1.get_premier(it_arete1); |
92 |
|
|
while(trouve==false && arete1!=NULL) |
93 |
|
|
{ |
94 |
|
|
if(tpl_map_arete2.existe(arete1)) |
95 |
|
|
{ |
96 |
|
|
trouve=true; |
97 |
|
|
return TYPE_LIEN_TOPOLOGIQUE::ARETE; |
98 |
|
|
} |
99 |
|
|
else arete1=tpl_map_arete1.get_suivant(it_arete1); |
100 |
|
|
} |
101 |
|
|
TPL_MAP_ENTITE<MG_SOMMET*>::ITERATEUR it_sommet1; |
102 |
|
|
MG_SOMMET *sommet1=tpl_map_sommet1.get_premier(it_sommet1); |
103 |
|
|
while(trouve==false && sommet1!=NULL) |
104 |
|
|
{ |
105 |
|
|
if(tpl_map_sommet2.existe(sommet1)) |
106 |
|
|
{ |
107 |
|
|
trouve=true; |
108 |
|
|
return TYPE_LIEN_TOPOLOGIQUE::SOMMET; |
109 |
|
|
} |
110 |
|
|
else sommet1=tpl_map_sommet1.get_suivant(it_sommet1); |
111 |
|
|
} |
112 |
|
|
return TYPE_LIEN_TOPOLOGIQUE::AUCUN; |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
|
116 |
couturad |
934 |
int OT_GEOMETRIE::declage_mg_face_mg_face(MG_FACE* mgface1, MG_FACE* mgface2, double& moyenne_distance, double& ecart_type_distance, int nb_pas, double eps) |
117 |
|
|
{ |
118 |
|
|
moyenne_distance=0; |
119 |
|
|
ecart_type_distance=0; |
120 |
|
|
std::vector<double> vector_distance; |
121 |
|
|
double umin1,umax1,vmin1,vmax1; |
122 |
|
|
get_param_face(mgface1,umin1,umax1,vmin1,vmax1); |
123 |
|
|
double pas_u = (umax1-umin1)/nb_pas; |
124 |
|
|
double pas_v = (vmax1-vmin1)/nb_pas; |
125 |
|
|
double uv[2]; |
126 |
|
|
for(int i=0;i<nb_pas;i++) |
127 |
|
|
{ |
128 |
|
|
uv[0]=umin1+i*pas_u; |
129 |
|
|
for(int j=0;j<nb_pas;j++) |
130 |
|
|
{ |
131 |
|
|
uv[1]=vmin1+j*pas_v; |
132 |
|
|
double xyz1[3]; |
133 |
|
|
mgface1->evaluer(uv,xyz1); |
134 |
|
|
double xyz2[3]; |
135 |
|
|
int ret = projection_orthogonale_sur_mg_face(xyz1,mgface2,xyz2); |
136 |
|
|
if(ret==OK) |
137 |
|
|
{ |
138 |
|
|
double distance = sqrt((xyz2[0]-xyz1[0])*(xyz2[0]-xyz1[0])+(xyz2[1]-xyz1[1])*(xyz2[1]-xyz1[1])+(xyz2[2]-xyz1[2])*(xyz2[2]-xyz1[2])); |
139 |
|
|
vector_distance.push_back(distance); |
140 |
|
|
moyenne_distance+=distance; |
141 |
|
|
} |
142 |
|
|
} |
143 |
|
|
} |
144 |
|
|
if(vector_distance.size()==0) return FAIL; |
145 |
|
|
moyenne_distance=moyenne_distance/vector_distance.size(); |
146 |
|
|
std::vector<double>::iterator it; |
147 |
|
|
for(it=vector_distance.begin();it!=vector_distance.end();it++) |
148 |
|
|
{ |
149 |
|
|
ecart_type_distance+=(*it-moyenne_distance)*(*it-moyenne_distance); |
150 |
|
|
} |
151 |
|
|
ecart_type_distance=sqrt(ecart_type_distance*(1.0/(vector_distance.size()-1.0))); |
152 |
|
|
return OK; |
153 |
|
|
} |
154 |
|
|
|
155 |
|
|
|
156 |
couturad |
907 |
int OT_GEOMETRIE::projection_orthogonale_sur_mg_arete(double* xyz, MG_ARETE* mgarete, double& t) |
157 |
|
|
{ |
158 |
|
|
#ifdef ALL_OCC |
159 |
|
|
gp_Pnt point(xyz[0],xyz[1],xyz[2]); |
160 |
|
|
TopoDS_Edge edge = ((OCC_ARETE*)mgarete)->get_TopoDS_Edge(); |
161 |
|
|
GeomAPI_ProjectPointOnCurve projecteur; |
162 |
|
|
double t0,t1; |
163 |
|
|
Handle(Geom_Curve) courbe_edge = BRep_Tool::Curve(edge,t0,t1); |
164 |
|
|
projecteur.Init(point,courbe_edge,t0,t1); |
165 |
|
|
if(projecteur.NbPoints()==0) return FAIL; |
166 |
|
|
t = projecteur.LowerDistanceParameter(); |
167 |
|
|
return OK; |
168 |
|
|
#endif |
169 |
|
|
} |
170 |
|
|
|
171 |
|
|
int OT_GEOMETRIE::projection_orthogonale_sur_mg_face(double* xyz, MG_FACE* mgface,double* xyz2) |
172 |
|
|
{ |
173 |
|
|
#ifdef ALL_OCC |
174 |
|
|
gp_Pnt point(xyz[0],xyz[1],xyz[2]); |
175 |
|
|
TopoDS_Face face = ((OCC_FACE*)mgface)->get_TopoDS_Face(); |
176 |
|
|
GeomAPI_ProjectPointOnSurf projecteur; |
177 |
|
|
double u0,u1,v0,v1; |
178 |
|
|
ShapeAnalysis::GetFaceUVBounds(face,u0,u1,v0,v1); |
179 |
|
|
Handle(Geom_Surface) surface = BRep_Tool::Surface(face); |
180 |
couturad |
951 |
projecteur.Init(point,surface); |
181 |
couturad |
907 |
if(!projecteur.IsDone()) return FAIL; |
182 |
|
|
if(projecteur.NbPoints()==0) return FAIL; |
183 |
couturad |
951 |
gp_Pnt point2 = projecteur.NearestPoint(); |
184 |
couturad |
907 |
xyz2[0]= point2.X(); |
185 |
|
|
xyz2[1]= point2.Y(); |
186 |
|
|
xyz2[2]= point2.Z(); |
187 |
|
|
return OK; |
188 |
|
|
#endif |
189 |
|
|
} |
190 |
|
|
|
191 |
couturad |
911 |
int OT_GEOMETRIE::projection_au_plus_pres_sur_mg_face(double* xyz1,MG_FACE* mgface1, MG_FACE* mgface2, double* xyz2) |
192 |
couturad |
907 |
{ |
193 |
|
|
#ifdef ALL_OCC |
194 |
couturad |
911 |
gp_Pnt point(xyz1[0],xyz1[1],xyz1[2]); |
195 |
|
|
BRepBuilderAPI_MakeVertex makevertex(point); |
196 |
|
|
TopoDS_Vertex vertex=makevertex.Vertex(); |
197 |
|
|
TopoDS_Face face1 = ((OCC_FACE*)mgface1)->get_TopoDS_Face(); |
198 |
|
|
TopoDS_Face face2 = ((OCC_FACE*)mgface2)->get_TopoDS_Face(); |
199 |
|
|
BRepClass_FaceClassifier face1_classifier(face1,point,Precision::Confusion()); |
200 |
|
|
if(face1_classifier.State()==TopAbs_OUT) return FAIL; |
201 |
|
|
BRepExtrema_DistShapeShape distshapeshape(vertex,face2); |
202 |
|
|
distshapeshape.Perform(); |
203 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
204 |
couturad |
951 |
double distance_min=std::numeric_limits< double >::max(); |
205 |
|
|
double tmp[3]; |
206 |
|
|
for(int i=1;i==distshapeshape.NbSolution();i++) |
207 |
|
|
{ |
208 |
|
|
gp_Pnt point2= distshapeshape.PointOnShape2(i); |
209 |
|
|
tmp[0]=point2.X(); |
210 |
|
|
tmp[1]=point2.Y(); |
211 |
|
|
tmp[2]=point2.Z(); |
212 |
|
|
double distance=sqrt((tmp[0]-xyz1[0])*(tmp[0]-xyz1[0])+(tmp[1]-xyz1[1])*(tmp[1]-xyz1[1])+(tmp[2]-xyz1[2])*(tmp[2]-xyz1[2])); |
213 |
|
|
if(distance<distance_min) |
214 |
|
|
{ |
215 |
|
|
distance_min=distance; |
216 |
|
|
xyz2[0]=tmp[0]; |
217 |
|
|
xyz2[1]=tmp[1]; |
218 |
|
|
xyz2[2]=tmp[2]; |
219 |
|
|
} |
220 |
|
|
} |
221 |
couturad |
911 |
return OK; |
222 |
|
|
#endif |
223 |
|
|
} |
224 |
|
|
|
225 |
|
|
int OT_GEOMETRIE::projection_au_plus_pres_sur_mg_arete(double* xyz, MG_ARETE* mgarete, double* xyz2) |
226 |
|
|
{ |
227 |
|
|
#ifdef ALL_OCC |
228 |
couturad |
907 |
gp_Pnt point(xyz[0],xyz[1],xyz[2]); |
229 |
|
|
BRepBuilderAPI_MakeVertex makevertex(point); |
230 |
|
|
TopoDS_Vertex vertex=makevertex.Vertex(); |
231 |
couturad |
911 |
TopoDS_Edge edge = ((OCC_ARETE*)mgarete)->get_TopoDS_Edge(); |
232 |
|
|
BRepExtrema_DistShapeShape distshapeshape(vertex,edge); |
233 |
couturad |
907 |
distshapeshape.Perform(); |
234 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
235 |
couturad |
951 |
double distance_min=std::numeric_limits< double >::max(); |
236 |
|
|
double tmp[3]; |
237 |
|
|
for(int i=1;i==distshapeshape.NbSolution();i++) |
238 |
|
|
{ |
239 |
|
|
gp_Pnt point2= distshapeshape.PointOnShape2(i); |
240 |
|
|
tmp[0]=point2.X(); |
241 |
|
|
tmp[1]=point2.Y(); |
242 |
|
|
tmp[2]=point2.Z(); |
243 |
francois |
1095 |
double t; |
244 |
|
|
mgarete->inverser(t,tmp); |
245 |
|
|
if ((t<mgarete->get_tmin()) || (t>mgarete->get_tmax())) continue; |
246 |
couturad |
951 |
double distance=sqrt((tmp[0]-xyz[0])*(tmp[0]-xyz[0])+(tmp[1]-xyz[1])*(tmp[1]-xyz[1])+(tmp[2]-xyz[2])*(tmp[2]-xyz[2])); |
247 |
|
|
if(distance<distance_min) |
248 |
|
|
{ |
249 |
|
|
distance_min=distance; |
250 |
|
|
xyz2[0]=tmp[0]; |
251 |
|
|
xyz2[1]=tmp[1]; |
252 |
|
|
xyz2[2]=tmp[2]; |
253 |
|
|
} |
254 |
|
|
} |
255 |
couturad |
907 |
return OK; |
256 |
|
|
#endif |
257 |
|
|
} |
258 |
|
|
|
259 |
|
|
|
260 |
couturad |
911 |
|
261 |
couturad |
907 |
void OT_GEOMETRIE::get_param_face(MG_FACE* mgface, double &umin, double &umax, double &vmin, double &vmax) |
262 |
|
|
{ |
263 |
|
|
#ifdef ALL_OCC |
264 |
|
|
TopoDS_Face face = ((OCC_FACE*)mgface)->get_TopoDS_Face(); |
265 |
|
|
ShapeAnalysis::GetFaceUVBounds(face,umin,umax,vmin,vmax); |
266 |
|
|
#endif |
267 |
|
|
} |
268 |
|
|
|
269 |
couturad |
951 |
|
270 |
|
|
int OT_GEOMETRIE::get_distance_min_mg_eletopo_mg_eletopo(MG_ELEMENT_TOPOLOGIQUE* mgeletopo1, MG_ELEMENT_TOPOLOGIQUE* mgeletopo2, double& distance) |
271 |
|
|
{ |
272 |
|
|
#ifdef ALL_OCC |
273 |
|
|
TopoDS_Shape shape1; |
274 |
|
|
TopoDS_Shape shape2; |
275 |
|
|
if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET) |
276 |
|
|
{ |
277 |
|
|
shape1=dynamic_cast<OCC_SOMMET*>(mgeletopo1)->get_TopoDS_Vertex(); |
278 |
|
|
} |
279 |
|
|
else if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE) |
280 |
|
|
{ |
281 |
|
|
shape1=dynamic_cast<OCC_ARETE*>(mgeletopo1)->get_TopoDS_Edge(); |
282 |
|
|
} |
283 |
|
|
else if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) |
284 |
|
|
{ |
285 |
|
|
shape1=dynamic_cast<OCC_FACE*>(mgeletopo1)->get_TopoDS_Face(); |
286 |
|
|
} |
287 |
|
|
else if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::VOLUME) |
288 |
|
|
{ |
289 |
|
|
shape1=dynamic_cast<OCC_VOLUME*>(mgeletopo1)->get_TopoDS_Solid(); |
290 |
|
|
} |
291 |
|
|
else return FAIL; |
292 |
|
|
if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET) |
293 |
|
|
{ |
294 |
|
|
shape2=dynamic_cast<OCC_SOMMET*>(mgeletopo2)->get_TopoDS_Vertex(); |
295 |
|
|
} |
296 |
|
|
else if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE) |
297 |
|
|
{ |
298 |
|
|
shape2=dynamic_cast<OCC_ARETE*>(mgeletopo2)->get_TopoDS_Edge(); |
299 |
|
|
} |
300 |
|
|
else if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) |
301 |
|
|
{ |
302 |
|
|
shape2=dynamic_cast<OCC_FACE*>(mgeletopo2)->get_TopoDS_Face(); |
303 |
|
|
} |
304 |
|
|
else if(mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::VOLUME) |
305 |
|
|
{ |
306 |
|
|
shape2=dynamic_cast<OCC_VOLUME*>(mgeletopo2)->get_TopoDS_Solid(); |
307 |
|
|
} |
308 |
|
|
else return FAIL; |
309 |
couturad |
966 |
|
310 |
|
|
if(mgeletopo1->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE && mgeletopo2->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) |
311 |
couturad |
951 |
{ |
312 |
couturad |
966 |
MG_FACE* face1=(MG_FACE*)mgeletopo1; |
313 |
|
|
MG_FACE* face2=(MG_FACE*)mgeletopo2; |
314 |
|
|
get_distance_min_mg_face_mg_face_echantillonnage(face1,face2,distance); |
315 |
couturad |
951 |
} |
316 |
couturad |
966 |
else |
317 |
|
|
{ |
318 |
|
|
BRepExtrema_DistShapeShape distshapeshape(shape2,shape1,Extrema_ExtFlag_MINMAX); |
319 |
|
|
distshapeshape.SetDeflection(Precision::Angular()); |
320 |
|
|
distshapeshape.Perform(); |
321 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
322 |
|
|
distance=std::numeric_limits< double >::max(); |
323 |
|
|
for(int i=1;i<distshapeshape.NbSolution()+1;i++) |
324 |
|
|
{ |
325 |
|
|
gp_Pnt p1=distshapeshape.PointOnShape1(i); |
326 |
|
|
gp_Pnt p2=distshapeshape.PointOnShape2(i); |
327 |
|
|
double dist=sqrt((p2.X()-p1.X())*(p2.X()-p1.X())+(p2.Y()-p1.Y())*(p2.Y()-p1.Y())+(p2.Z()-p1.Z())*(p2.Z()-p1.Z())); |
328 |
|
|
if(dist<distance)distance=dist; |
329 |
|
|
} |
330 |
|
|
distance=distshapeshape.Value(); |
331 |
|
|
} |
332 |
couturad |
951 |
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
return OK; |
336 |
|
|
#endif |
337 |
|
|
} |
338 |
|
|
|
339 |
|
|
|
340 |
couturad |
907 |
int OT_GEOMETRIE::get_distance_min_mg_volume_mg_volume(MG_VOLUME* mgvolume1, MG_VOLUME* mgvolume2,double &distance) |
341 |
|
|
{ |
342 |
|
|
#ifdef ALL_OCC |
343 |
|
|
TopoDS_Solid solid1 = ((OCC_VOLUME*)mgvolume1)->get_TopoDS_Solid(); |
344 |
|
|
TopoDS_Solid solid2 = ((OCC_VOLUME*)mgvolume2)->get_TopoDS_Solid(); |
345 |
couturad |
911 |
BRepExtrema_DistShapeShape distshapeshape(solid1,solid2,Extrema_ExtFlag_MIN); |
346 |
couturad |
907 |
distshapeshape.Perform(); |
347 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
348 |
|
|
distance=distshapeshape.Value(); |
349 |
|
|
return OK; |
350 |
|
|
#endif |
351 |
|
|
} |
352 |
|
|
|
353 |
|
|
int OT_GEOMETRIE::get_distance_min_mg_face_mg_volume(MG_FACE* mgface, MG_VOLUME* mgvolume, double& distance) |
354 |
|
|
{ |
355 |
|
|
#ifdef ALL_OCC |
356 |
|
|
TopoDS_Face face = ((OCC_FACE*)mgface)->get_TopoDS_Face(); |
357 |
|
|
TopoDS_Solid solid = ((OCC_VOLUME*)mgvolume)->get_TopoDS_Solid(); |
358 |
|
|
BRepExtrema_DistShapeShape distshapeshape(face,solid); |
359 |
|
|
distshapeshape.Perform(); |
360 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
361 |
|
|
distance=distshapeshape.Value(); |
362 |
|
|
return OK; |
363 |
|
|
#endif |
364 |
|
|
} |
365 |
|
|
|
366 |
couturad |
911 |
int OT_GEOMETRIE::get_distance_min_mg_face_mg_face(MG_FACE* mgface1, MG_FACE* mgface2, double& distance) |
367 |
|
|
{ |
368 |
|
|
#ifdef ALL_OCC |
369 |
|
|
TopoDS_Face face1 = ((OCC_FACE*)mgface1)->get_TopoDS_Face(); |
370 |
|
|
TopoDS_Face face2 = ((OCC_FACE*)mgface2)->get_TopoDS_Face(); |
371 |
|
|
BRepExtrema_DistShapeShape distshapeshape(face1,face2); |
372 |
|
|
distshapeshape.Perform(); |
373 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
374 |
|
|
distance=distshapeshape.Value(); |
375 |
|
|
return OK; |
376 |
|
|
#endif |
377 |
|
|
} |
378 |
couturad |
907 |
|
379 |
couturad |
966 |
int OT_GEOMETRIE::get_distance_min_mg_face_mg_face_echantillonnage(MG_FACE* mgface1, MG_FACE* mgface2, double& distance,int nb_pas) |
380 |
|
|
{ |
381 |
|
|
#ifdef ALL_OCC |
382 |
|
|
distance=std::numeric_limits<double>::max(); |
383 |
|
|
double umin,umax,vmin,vmax; |
384 |
|
|
OT_GEOMETRIE::get_param_face(mgface1,umin,umax,vmin,vmax); |
385 |
|
|
if(mgface1->get_surface()->est_periodique_u()) |
386 |
|
|
{ |
387 |
|
|
umin=0; |
388 |
|
|
umax=mgface1->get_surface()->get_periode_u(); |
389 |
|
|
} |
390 |
|
|
if(mgface1->get_surface()->est_periodique_v()) |
391 |
|
|
{ |
392 |
|
|
vmin=0; |
393 |
|
|
vmax=mgface1->get_surface()->get_periode_v(); |
394 |
|
|
} |
395 |
|
|
double pas_u = (umax-umin)/nb_pas; |
396 |
|
|
double pas_v = (vmax-vmin)/nb_pas; |
397 |
|
|
double uv1[2]; |
398 |
|
|
for(long i=0;i<nb_pas;i++) |
399 |
|
|
{ |
400 |
|
|
uv1[0]=umin+i*pas_u; |
401 |
|
|
for(long j=0;j<nb_pas;j++) |
402 |
|
|
{ |
403 |
|
|
uv1[1] = vmin+j*pas_v; |
404 |
|
|
double xyz1[3]; |
405 |
|
|
mgface1->evaluer(uv1,xyz1); |
406 |
|
|
if(OT_GEOMETRIE::est_dans_mg_face(xyz1,mgface1)==FAIL) continue; |
407 |
|
|
double xyz2[3]; |
408 |
|
|
if(OT_GEOMETRIE::projection_au_plus_pres_sur_mg_face(xyz1,mgface1,mgface2,xyz2)==OK) |
409 |
|
|
{ |
410 |
|
|
double dist = sqrt((xyz2[0]-xyz1[0])*(xyz2[0]-xyz1[0])+(xyz2[1]-xyz1[1])*(xyz2[1]-xyz1[1])+(xyz2[2]-xyz1[2])*(xyz2[2]-xyz1[2])); |
411 |
|
|
if(dist<distance) distance=dist; |
412 |
|
|
} |
413 |
|
|
} |
414 |
|
|
} |
415 |
|
|
return OK; |
416 |
|
|
#endif |
417 |
|
|
} |
418 |
couturad |
911 |
|
419 |
couturad |
966 |
|
420 |
|
|
|
421 |
couturad |
911 |
int OT_GEOMETRIE::get_distance_min_liste_mg_face_mg_volume(TPL_MAP_ENTITE< MG_FACE* >& map_face, MG_VOLUME* mgvolume,double &distance) |
422 |
|
|
{ |
423 |
|
|
distance=std::numeric_limits<double>::max(); |
424 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face; |
425 |
|
|
for(MG_FACE* face=map_face.get_premier(it_face);face!=NULL;face=map_face.get_suivant(it_face)) |
426 |
|
|
{ |
427 |
|
|
double distance_i; |
428 |
|
|
if(OT_GEOMETRIE::get_distance_min_mg_face_mg_volume(face,mgvolume,distance_i)==FAIL) return FAIL; |
429 |
|
|
if(distance_i<distance) distance=distance_i; |
430 |
|
|
} |
431 |
|
|
return OK; |
432 |
|
|
} |
433 |
|
|
|
434 |
|
|
int OT_GEOMETRIE::get_distance_min_mg_arete_mg_arete(MG_ARETE* mgarete1, MG_ARETE* mgarete2, double& distance) |
435 |
|
|
{ |
436 |
|
|
#ifdef ALL_OCC |
437 |
|
|
TopoDS_Edge edge1 = ((OCC_ARETE*)mgarete1)->get_TopoDS_Edge(); |
438 |
|
|
TopoDS_Edge edge2 = ((OCC_ARETE*)mgarete2)->get_TopoDS_Edge(); |
439 |
|
|
BRepExtrema_DistShapeShape distshapeshape(edge1,edge2); |
440 |
|
|
distshapeshape.Perform(); |
441 |
|
|
if(!distshapeshape.IsDone()) return FAIL; |
442 |
|
|
distance=distshapeshape.Value(); |
443 |
|
|
return OK; |
444 |
|
|
#endif |
445 |
|
|
} |
446 |
|
|
|
447 |
|
|
|
448 |
couturad |
951 |
double OT_GEOMETRIE::get_volume_intersection(MG_VOLUME* mgvolume1, MG_VOLUME* mgvolume2, double eps) |
449 |
couturad |
911 |
{ |
450 |
|
|
#ifdef ALL_OCC |
451 |
|
|
TopoDS_Solid solid1 = ((OCC_VOLUME*)mgvolume1)->get_TopoDS_Solid(); |
452 |
|
|
TopoDS_Solid solid2 = ((OCC_VOLUME*)mgvolume2)->get_TopoDS_Solid(); |
453 |
|
|
BRepAlgoAPI_Common brep_common(solid1,solid2); |
454 |
|
|
if(!brep_common.IsDone()) return 0.0; |
455 |
|
|
if(brep_common.Shape().IsNull()) std::cerr << "NULL SHAPE !!!!!!!!!!!" << std::endl; |
456 |
|
|
GProp_GProps props; |
457 |
couturad |
951 |
BRepGProp::VolumeProperties(brep_common.Shape(),props,eps); |
458 |
couturad |
911 |
return props.Mass(); |
459 |
|
|
#endif |
460 |
|
|
} |
461 |
|
|
|
462 |
couturad |
919 |
double OT_GEOMETRIE::get_volume(MG_VOLUME* mgvolume,double eps) |
463 |
couturad |
911 |
{ |
464 |
|
|
#ifdef ALL_OCC |
465 |
|
|
TopoDS_Solid solid = ((OCC_VOLUME*)mgvolume)->get_TopoDS_Solid(); |
466 |
|
|
GProp_GProps props; |
467 |
couturad |
919 |
BRepGProp::VolumeProperties(solid,props,eps); |
468 |
couturad |
911 |
return props.Mass(); |
469 |
|
|
#endif |
470 |
|
|
} |
471 |
|
|
|
472 |
|
|
double OT_GEOMETRIE::get_longueur(MG_ARETE* mgarete) |
473 |
|
|
{ |
474 |
|
|
#ifdef ALL_OCC |
475 |
|
|
TopoDS_Edge edge = ((OCC_ARETE*)mgarete)->get_TopoDS_Edge(); |
476 |
|
|
GProp_GProps props; |
477 |
|
|
BRepGProp::LinearProperties(edge,props); |
478 |
|
|
return props.Mass(); |
479 |
|
|
#endif |
480 |
|
|
} |
481 |
|
|
|
482 |
couturad |
919 |
double OT_GEOMETRIE::get_aire(MG_FACE* mgface,double eps) |
483 |
couturad |
911 |
{ |
484 |
couturad |
971 |
#ifdef ALL_OCC |
485 |
couturad |
911 |
TopoDS_Face face = ((OCC_FACE*)mgface)->get_TopoDS_Face(); |
486 |
|
|
GProp_GProps props; |
487 |
couturad |
919 |
BRepGProp::SurfaceProperties(face,props,eps); |
488 |
couturad |
911 |
return props.Mass(); |
489 |
|
|
#endif |
490 |
|
|
} |
491 |
|
|
|
492 |
couturad |
971 |
void OT_GEOMETRIE::get_propriete_massique(std::vector<MG_VOLUME*> &vector_volume,double* centre_masse,double* Ixyz, double* I,double eps) |
493 |
|
|
{ |
494 |
|
|
#ifdef ALL_OCC |
495 |
|
|
std::vector<MG_VOLUME *>::iterator it_volume; |
496 |
|
|
BRep_Builder brep_builder; |
497 |
|
|
TopoDS_Compound Compound; |
498 |
|
|
brep_builder.MakeCompound(Compound); |
499 |
|
|
for(it_volume=vector_volume.begin();it_volume!=vector_volume.end();it_volume++) |
500 |
|
|
{ |
501 |
|
|
TopoDS_Solid solid = ((OCC_VOLUME*)*it_volume)->get_TopoDS_Solid(); |
502 |
|
|
brep_builder.Add(Compound,solid); |
503 |
|
|
} |
504 |
|
|
GProp_GProps props; |
505 |
|
|
BRepGProp brepgprop; |
506 |
|
|
brepgprop.VolumeProperties(Compound,props,eps); |
507 |
|
|
gp_Pnt centerofmass = props.CentreOfMass(); |
508 |
|
|
centre_masse[0] = centerofmass.X(); |
509 |
|
|
centre_masse[1] = centerofmass.Y(); |
510 |
|
|
centre_masse[2] = centerofmass.Z(); |
511 |
|
|
props.StaticMoments(Ixyz[0],Ixyz[1],Ixyz[2]); |
512 |
|
|
gp_Mat momentofinertia = props.MatrixOfInertia(); |
513 |
|
|
I[0] = momentofinertia.Value(1,1); |
514 |
|
|
I[1] = momentofinertia.Value(2,2); |
515 |
|
|
I[2] = momentofinertia.Value(3,3); |
516 |
|
|
I[3] = momentofinertia.Value(1,2); |
517 |
|
|
I[4] = momentofinertia.Value(2,3); |
518 |
|
|
I[5] = momentofinertia.Value(1,3); |
519 |
|
|
#endif |
520 |
|
|
} |
521 |
|
|
|
522 |
|
|
|
523 |
couturad |
951 |
int OT_GEOMETRIE::est_dans_mg_face(double* xyz, MG_FACE* mgface) |
524 |
|
|
{ |
525 |
|
|
#ifdef ALL_OCC |
526 |
|
|
TopoDS_Face face = ((OCC_FACE*)mgface)->get_TopoDS_Face(); |
527 |
|
|
gp_Pnt point(xyz[0],xyz[1],xyz[2]); |
528 |
|
|
BRepClass_FaceClassifier face1_classifier(face,point,Precision::Confusion()); |
529 |
|
|
if(face1_classifier.State()==TopAbs_OUT) return FAIL; |
530 |
|
|
return OK; |
531 |
|
|
#endif |
532 |
|
|
} |
533 |
|
|
|
534 |
couturad |
1029 |
int OT_GEOMETRIE::est_dans_mg_volume(double* xyz, MG_VOLUME* mgvolume) |
535 |
|
|
{ |
536 |
|
|
#ifdef ALL_OCC |
537 |
|
|
TopoDS_Solid solid = ((OCC_VOLUME*)mgvolume)->get_TopoDS_Solid(); |
538 |
|
|
gp_Pnt point(xyz[0],xyz[1],xyz[2]); |
539 |
|
|
BRepClass3d_SolidClassifier classifier(solid,point,Precision::Confusion()); |
540 |
|
|
if(classifier.State()==TopAbs_OUT) return FAIL; |
541 |
|
|
return OK; |
542 |
|
|
#endif |
543 |
|
|
} |
544 |
couturad |
951 |
|
545 |
couturad |
1029 |
|
546 |
couturad |
951 |
void OT_GEOMETRIE::get_map_mg_ele_topo_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, |
547 |
|
|
TPL_MAP_ENTITE< MG_SOMMET* >& map_sommet, |
548 |
|
|
TPL_MAP_ENTITE< MG_ARETE* >& map_arete, |
549 |
|
|
TPL_MAP_ENTITE< MG_FACE* >& map_face) |
550 |
|
|
{ |
551 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_ele_topo; |
552 |
|
|
mgeletopo->get_topologie_sousjacente(&map_ele_topo); |
553 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it; |
554 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *ele=map_ele_topo.get_premier(it);ele!=NULL;ele=map_ele_topo.get_suivant(it)) |
555 |
|
|
{ |
556 |
|
|
if(ele->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET) |
557 |
|
|
{ |
558 |
|
|
map_sommet.ajouter(dynamic_cast<MG_SOMMET*>(ele)); |
559 |
|
|
} |
560 |
|
|
else if(ele->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE) |
561 |
|
|
{ |
562 |
|
|
map_arete.ajouter(dynamic_cast<MG_ARETE*>(ele)); |
563 |
|
|
} |
564 |
|
|
else if(ele->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) |
565 |
|
|
{ |
566 |
|
|
map_face.ajouter(dynamic_cast<MG_FACE*>(ele)); |
567 |
|
|
} |
568 |
|
|
} |
569 |
|
|
} |
570 |
|
|
|
571 |
|
|
|
572 |
couturad |
907 |
void OT_GEOMETRIE::get_map_mg_sommet_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, TPL_MAP_ENTITE< MG_SOMMET* >& map_sommet) |
573 |
|
|
{ |
574 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_ele_topo; |
575 |
|
|
mgeletopo->get_topologie_sousjacente(&map_ele_topo); |
576 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it; |
577 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *ele=map_ele_topo.get_premier(it);ele!=NULL;ele=map_ele_topo.get_suivant(it)) |
578 |
|
|
{ |
579 |
|
|
if(ele->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET) |
580 |
|
|
{ |
581 |
|
|
map_sommet.ajouter(dynamic_cast<MG_SOMMET*>(ele)); |
582 |
|
|
} |
583 |
|
|
} |
584 |
|
|
} |
585 |
|
|
|
586 |
|
|
void OT_GEOMETRIE::get_map_mg_arete_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, TPL_MAP_ENTITE< MG_ARETE* >& map_arete) |
587 |
|
|
{ |
588 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_ele_topo; |
589 |
|
|
mgeletopo->get_topologie_sousjacente(&map_ele_topo); |
590 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it; |
591 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *ele=map_ele_topo.get_premier(it);ele!=NULL;ele=map_ele_topo.get_suivant(it)) |
592 |
|
|
{ |
593 |
|
|
if(ele->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE) |
594 |
|
|
{ |
595 |
|
|
map_arete.ajouter(dynamic_cast<MG_ARETE*>(ele)); |
596 |
|
|
} |
597 |
|
|
} |
598 |
|
|
} |
599 |
|
|
|
600 |
|
|
void OT_GEOMETRIE::get_map_mg_face_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, TPL_MAP_ENTITE< MG_FACE* >& map_face) |
601 |
|
|
{ |
602 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_ele_topo; |
603 |
|
|
mgeletopo->get_topologie_sousjacente(&map_ele_topo); |
604 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it; |
605 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *ele=map_ele_topo.get_premier(it);ele!=NULL;ele=map_ele_topo.get_suivant(it)) |
606 |
|
|
{ |
607 |
|
|
if(ele->get_type()==MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE) |
608 |
|
|
{ |
609 |
|
|
map_face.ajouter(dynamic_cast<MG_FACE*>(ele)); |
610 |
|
|
} |
611 |
|
|
} |
612 |
|
|
} |
613 |
|
|
|
614 |
|
|
void OT_GEOMETRIE::get_map_mg_point_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, TPL_MAP_ENTITE< MG_POINT* >& map_point) |
615 |
|
|
{ |
616 |
|
|
TPL_MAP_ENTITE<MG_SOMMET*> map_sommet; |
617 |
|
|
get_map_mg_sommet_sous_jacent(mgeletopo,map_sommet); |
618 |
|
|
TPL_MAP_ENTITE<MG_SOMMET*>::ITERATEUR it; |
619 |
|
|
for(MG_SOMMET* sommet=map_sommet.get_premier(it);sommet!=NULL;sommet=map_sommet.get_suivant(it)) |
620 |
|
|
map_point.ajouter(sommet->get_point()); |
621 |
|
|
} |
622 |
|
|
|
623 |
|
|
void OT_GEOMETRIE::get_map_mg_courbe_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, TPL_MAP_ENTITE< MG_COURBE* >& map_courbe) |
624 |
|
|
{ |
625 |
|
|
TPL_MAP_ENTITE<MG_ARETE*> map_arete; |
626 |
|
|
get_map_mg_arete_sous_jacent(mgeletopo,map_arete); |
627 |
|
|
TPL_MAP_ENTITE<MG_ARETE*>::ITERATEUR it; |
628 |
|
|
for(MG_ARETE* arete=map_arete.get_premier(it);arete!=NULL;arete=map_arete.get_suivant(it)) |
629 |
|
|
map_courbe.ajouter(arete->get_courbe()); |
630 |
|
|
} |
631 |
|
|
|
632 |
|
|
void OT_GEOMETRIE::get_map_mg_surface_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mgeletopo, TPL_MAP_ENTITE< MG_SURFACE* >& map_surface) |
633 |
|
|
{ |
634 |
|
|
TPL_MAP_ENTITE<MG_FACE*> map_face; |
635 |
|
|
get_map_mg_face_sous_jacent(mgeletopo,map_face); |
636 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it; |
637 |
|
|
for(MG_FACE* face=map_face.get_premier(it);face!=NULL;face=map_face.get_suivant(it)) |
638 |
|
|
map_surface.ajouter(face->get_surface()); |
639 |
|
|
} |
640 |
|
|
|
641 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_SOMMET* sommet, |
642 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
643 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
644 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
645 |
|
|
{ |
646 |
|
|
if(map_mg_element_geometrique!=NULL) map_mg_element_geometrique->ajouter(sommet->get_point()); |
647 |
|
|
} |
648 |
|
|
|
649 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_COSOMMET* cosommet, |
650 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
651 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
652 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
653 |
|
|
{ |
654 |
|
|
if(map_mg_element_topologique!=NULL) map_mg_element_topologique->ajouter(cosommet->get_sommet()); |
655 |
|
|
get_map_mg_element_sous_jacent(cosommet->get_sommet(), |
656 |
|
|
map_mg_element_topologique, |
657 |
|
|
map_mg_element_cotopologique, |
658 |
|
|
map_mg_element_geometrique); |
659 |
|
|
} |
660 |
|
|
|
661 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_ARETE* arete, |
662 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
663 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
664 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
665 |
|
|
{ |
666 |
|
|
if(map_mg_element_cotopologique!=NULL) |
667 |
|
|
{ |
668 |
|
|
map_mg_element_cotopologique->ajouter(arete->get_cosommet1()); |
669 |
|
|
map_mg_element_cotopologique->ajouter(arete->get_cosommet2()); |
670 |
|
|
} |
671 |
|
|
if(map_mg_element_geometrique!=NULL) map_mg_element_geometrique->ajouter(arete->get_courbe()); |
672 |
|
|
get_map_mg_element_sous_jacent(arete->get_cosommet1(), |
673 |
|
|
map_mg_element_topologique, |
674 |
|
|
map_mg_element_cotopologique, |
675 |
|
|
map_mg_element_geometrique); |
676 |
|
|
get_map_mg_element_sous_jacent(arete->get_cosommet2(), |
677 |
|
|
map_mg_element_topologique, |
678 |
|
|
map_mg_element_cotopologique, |
679 |
|
|
map_mg_element_geometrique); |
680 |
|
|
} |
681 |
|
|
|
682 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_COARETE* coarete, |
683 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
684 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
685 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
686 |
|
|
{ |
687 |
|
|
if(map_mg_element_topologique!=NULL) map_mg_element_topologique->ajouter(coarete->get_arete()); |
688 |
|
|
get_map_mg_element_sous_jacent(coarete->get_arete(), |
689 |
|
|
map_mg_element_topologique, |
690 |
|
|
map_mg_element_cotopologique, |
691 |
|
|
map_mg_element_geometrique); |
692 |
|
|
} |
693 |
|
|
|
694 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_BOUCLE* boucle, |
695 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
696 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
697 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
698 |
|
|
{ |
699 |
|
|
for(int i=0;i<boucle->get_nb_mg_coarete();i++) |
700 |
|
|
{ |
701 |
|
|
if(map_mg_element_cotopologique!=NULL) map_mg_element_cotopologique->ajouter(boucle->get_mg_coarete(i)); |
702 |
|
|
get_map_mg_element_sous_jacent(boucle->get_mg_coarete(i), |
703 |
|
|
map_mg_element_topologique, |
704 |
|
|
map_mg_element_cotopologique, |
705 |
|
|
map_mg_element_geometrique); |
706 |
|
|
} |
707 |
|
|
} |
708 |
|
|
|
709 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_POUTRE* poutre, |
710 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
711 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
712 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
713 |
|
|
{ |
714 |
|
|
for(int i=0;i<poutre->get_nb_mg_boucle();i++) |
715 |
|
|
{ |
716 |
|
|
if(map_mg_element_cotopologique!=NULL) map_mg_element_cotopologique->ajouter(poutre->get_mg_boucle(i)); |
717 |
|
|
get_map_mg_element_sous_jacent(poutre->get_mg_boucle(i), |
718 |
|
|
map_mg_element_topologique, |
719 |
|
|
map_mg_element_cotopologique, |
720 |
|
|
map_mg_element_geometrique); |
721 |
|
|
} |
722 |
|
|
} |
723 |
|
|
|
724 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_FACE* face, |
725 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
726 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
727 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
728 |
|
|
{ |
729 |
|
|
for(int i=0;i<face->get_nb_mg_boucle();i++) |
730 |
|
|
{ |
731 |
|
|
if(map_mg_element_cotopologique!=NULL) map_mg_element_cotopologique->ajouter(face->get_mg_boucle(i)); |
732 |
|
|
get_map_mg_element_sous_jacent(face->get_mg_boucle(i), |
733 |
|
|
map_mg_element_topologique, |
734 |
|
|
map_mg_element_cotopologique, |
735 |
|
|
map_mg_element_geometrique); |
736 |
|
|
} |
737 |
|
|
if(map_mg_element_geometrique!=NULL) map_mg_element_geometrique->ajouter(face->get_surface()); |
738 |
|
|
} |
739 |
|
|
|
740 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_COFACE* coface, |
741 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
742 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
743 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
744 |
|
|
{ |
745 |
|
|
if(map_mg_element_topologique!=NULL) map_mg_element_topologique->ajouter(coface->get_face()); |
746 |
|
|
get_map_mg_element_sous_jacent(coface->get_face(), |
747 |
|
|
map_mg_element_topologique, |
748 |
|
|
map_mg_element_cotopologique, |
749 |
|
|
map_mg_element_geometrique); |
750 |
|
|
} |
751 |
|
|
|
752 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_COQUILLE* coquille, |
753 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
754 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
755 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
756 |
|
|
{ |
757 |
|
|
for(int i=0;i<coquille->get_nb_mg_coface();i++) |
758 |
|
|
{ |
759 |
|
|
if(map_mg_element_cotopologique!=NULL) map_mg_element_cotopologique->ajouter(coquille->get_mg_coface(i)); |
760 |
|
|
get_map_mg_element_sous_jacent(coquille->get_mg_coface(i), |
761 |
|
|
map_mg_element_topologique, |
762 |
|
|
map_mg_element_cotopologique, |
763 |
|
|
map_mg_element_geometrique); |
764 |
|
|
} |
765 |
|
|
} |
766 |
|
|
|
767 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_VOLUME* volume, |
768 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
769 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
770 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
771 |
|
|
{ |
772 |
|
|
for(int i=0;i<volume->get_nb_mg_coquille();i++) |
773 |
|
|
{ |
774 |
|
|
if(map_mg_element_cotopologique!=NULL) map_mg_element_cotopologique->ajouter(volume->get_mg_coquille(i)); |
775 |
|
|
get_map_mg_element_sous_jacent(volume->get_mg_coquille(i), |
776 |
|
|
map_mg_element_topologique, |
777 |
|
|
map_mg_element_cotopologique, |
778 |
|
|
map_mg_element_geometrique); |
779 |
|
|
} |
780 |
|
|
} |
781 |
|
|
|
782 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_COQUE* coque, |
783 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
784 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
785 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
786 |
|
|
{ |
787 |
|
|
for(int i=0;i<coque->get_nb_mg_coquille();i++) |
788 |
|
|
{ |
789 |
|
|
if(map_mg_element_cotopologique!=NULL) map_mg_element_cotopologique->ajouter(coque->get_mg_coquille(i)); |
790 |
|
|
get_map_mg_element_sous_jacent(coque->get_mg_coquille(i), |
791 |
|
|
map_mg_element_topologique, |
792 |
|
|
map_mg_element_cotopologique, |
793 |
|
|
map_mg_element_geometrique); |
794 |
|
|
} |
795 |
|
|
} |
796 |
|
|
|
797 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_ELEMENT_TOPOLOGIQUE* mg_element_topologique, |
798 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
799 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
800 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
801 |
|
|
{ |
802 |
|
|
switch(mg_element_topologique->get_type()) |
803 |
|
|
{ |
804 |
|
|
case MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::SOMMET: |
805 |
|
|
{ |
806 |
|
|
MG_SOMMET* sommet = (MG_SOMMET*)mg_element_topologique; |
807 |
|
|
get_map_mg_element_sous_jacent(sommet, |
808 |
|
|
map_mg_element_topologique, |
809 |
|
|
map_mg_element_cotopologique, |
810 |
|
|
map_mg_element_geometrique); |
811 |
|
|
break; |
812 |
|
|
} |
813 |
|
|
case MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::ARETE: |
814 |
|
|
{ |
815 |
|
|
MG_ARETE* arete = (MG_ARETE*)mg_element_topologique; |
816 |
|
|
get_map_mg_element_sous_jacent(arete, |
817 |
|
|
map_mg_element_topologique, |
818 |
|
|
map_mg_element_cotopologique, |
819 |
|
|
map_mg_element_geometrique); |
820 |
|
|
break; |
821 |
|
|
} |
822 |
|
|
case MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::FACE: |
823 |
|
|
{ |
824 |
|
|
MG_FACE* face = (MG_FACE*)mg_element_topologique; |
825 |
|
|
get_map_mg_element_sous_jacent(face, |
826 |
|
|
map_mg_element_topologique, |
827 |
|
|
map_mg_element_cotopologique, |
828 |
|
|
map_mg_element_geometrique); |
829 |
|
|
break; |
830 |
|
|
} |
831 |
|
|
case MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::VOLUME: |
832 |
|
|
{ |
833 |
|
|
MG_VOLUME* volume = (MG_VOLUME*)mg_element_topologique; |
834 |
|
|
get_map_mg_element_sous_jacent(volume, |
835 |
|
|
map_mg_element_topologique, |
836 |
|
|
map_mg_element_cotopologique, |
837 |
|
|
map_mg_element_geometrique); |
838 |
|
|
break; |
839 |
|
|
} |
840 |
|
|
case MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::COQUE: |
841 |
|
|
{ |
842 |
|
|
MG_COQUE* coque = (MG_COQUE*)mg_element_topologique; |
843 |
|
|
get_map_mg_element_sous_jacent(coque, |
844 |
|
|
map_mg_element_topologique, |
845 |
|
|
map_mg_element_cotopologique, |
846 |
|
|
map_mg_element_geometrique); |
847 |
|
|
break; |
848 |
|
|
} |
849 |
|
|
case MG_ELEMENT_TOPOLOGIQUE::TYPE_ELEMENT_TOPOLOGIQUE::POUTRE: |
850 |
|
|
{ |
851 |
|
|
MG_POUTRE* poutre = (MG_POUTRE*)mg_element_topologique; |
852 |
|
|
get_map_mg_element_sous_jacent(poutre, |
853 |
|
|
map_mg_element_topologique, |
854 |
|
|
map_mg_element_cotopologique, |
855 |
|
|
map_mg_element_geometrique); |
856 |
|
|
break; |
857 |
|
|
} |
858 |
|
|
} |
859 |
|
|
} |
860 |
|
|
|
861 |
|
|
void OT_GEOMETRIE::get_map_mg_element_sous_jacent(MG_ELEMENT_COTOPOLOGIQUE* mg_element_cotopologique, |
862 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE* >* map_mg_element_topologique, |
863 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_COTOPOLOGIQUE* >* map_mg_element_cotopologique, |
864 |
|
|
TPL_MAP_ENTITE< MG_ELEMENT_GEOMETRIQUE* >* map_mg_element_geometrique) |
865 |
|
|
{ |
866 |
|
|
switch(mg_element_cotopologique->get_type()) |
867 |
|
|
{ |
868 |
|
|
case MG_ELEMENT_COTOPOLOGIQUE::TYPE_ELEMENT_COTOPOLOGIQUE::COSOMMET: |
869 |
|
|
{ |
870 |
|
|
MG_COSOMMET* cosommet = (MG_COSOMMET*)mg_element_cotopologique; |
871 |
|
|
get_map_mg_element_sous_jacent(cosommet, |
872 |
|
|
map_mg_element_topologique, |
873 |
|
|
map_mg_element_cotopologique, |
874 |
|
|
map_mg_element_geometrique); |
875 |
|
|
break; |
876 |
|
|
} |
877 |
|
|
case MG_ELEMENT_COTOPOLOGIQUE::TYPE_ELEMENT_COTOPOLOGIQUE::COARETE: |
878 |
|
|
{ |
879 |
|
|
MG_COARETE* coarete = (MG_COARETE*)mg_element_cotopologique; |
880 |
|
|
get_map_mg_element_sous_jacent(coarete, |
881 |
|
|
map_mg_element_topologique, |
882 |
|
|
map_mg_element_cotopologique, |
883 |
|
|
map_mg_element_geometrique); |
884 |
|
|
break; |
885 |
|
|
} |
886 |
|
|
case MG_ELEMENT_COTOPOLOGIQUE::TYPE_ELEMENT_COTOPOLOGIQUE::BOUCLE: |
887 |
|
|
{ |
888 |
|
|
MG_BOUCLE* boucle = (MG_BOUCLE*)mg_element_cotopologique; |
889 |
|
|
get_map_mg_element_sous_jacent(boucle, |
890 |
|
|
map_mg_element_topologique, |
891 |
|
|
map_mg_element_cotopologique, |
892 |
|
|
map_mg_element_geometrique); |
893 |
|
|
break; |
894 |
|
|
} |
895 |
|
|
case MG_ELEMENT_COTOPOLOGIQUE::TYPE_ELEMENT_COTOPOLOGIQUE::COFACE: |
896 |
|
|
{ |
897 |
|
|
MG_COFACE* coface = (MG_COFACE*)mg_element_cotopologique; |
898 |
|
|
get_map_mg_element_sous_jacent(coface, |
899 |
|
|
map_mg_element_topologique, |
900 |
|
|
map_mg_element_cotopologique, |
901 |
|
|
map_mg_element_geometrique); |
902 |
|
|
break; |
903 |
|
|
} |
904 |
|
|
case MG_ELEMENT_COTOPOLOGIQUE::TYPE_ELEMENT_COTOPOLOGIQUE::COQUILLE: |
905 |
|
|
{ |
906 |
|
|
MG_COQUILLE* coquille = (MG_COQUILLE*)mg_element_cotopologique; |
907 |
|
|
get_map_mg_element_sous_jacent(coquille, |
908 |
|
|
map_mg_element_topologique, |
909 |
|
|
map_mg_element_cotopologique, |
910 |
|
|
map_mg_element_geometrique); |
911 |
|
|
break; |
912 |
|
|
} |
913 |
|
|
} |
914 |
|
|
} |
915 |
|
|
|
916 |
|
|
|
917 |
|
|
|
918 |
|
|
|
919 |
|
|
|
920 |
|
|
|
921 |
|
|
|
922 |
|
|
|
923 |
|
|
|