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