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