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