Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1996-03-07 |
2 | // Created by: Jean Yves LEBEY | |
3 | // Copyright (c) 1996-1999 Matra Datavision | |
973c2be1 | 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | // |
973c2be1 | 6 | // This file is part of Open CASCADE Technology software library. |
b311480e | 7 | // |
d5f74e42 | 8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
973c2be1 | 10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
12 | // distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 13 | // |
973c2be1 | 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. | |
7fd59977 | 16 | |
17 | #include <TopOpeBRepBuild_BuilderON.ixx> | |
18 | ||
19 | #include <TopOpeBRepTool_EXPORT.hxx> | |
20 | #include <TopOpeBRepTool_TOOL.hxx> | |
21 | #include <TopOpeBRepDS_EXPORT.hxx> | |
22 | #include <TopOpeBRepDS_ProcessInterferencesTool.hxx> | |
23 | #include <TopOpeBRepBuild_define.hxx> | |
24 | #include <TopOpeBRepDS_connex.hxx> | |
25 | #include <BRep_Tool.hxx> | |
26 | #include <TopoDS.hxx> | |
27 | #include <Precision.hxx> | |
28 | #include <BRepAdaptor_Surface.hxx> | |
29 | #include <GeomAbs_SurfaceType.hxx> | |
30 | #include <TopOpeBRepTool_SC.hxx> | |
31 | #include <BRepLProp_SurfaceTool.hxx> | |
32 | #include <BRepLProp_SLProps.hxx> | |
ec357c5c | 33 | #include <TopOpeBRepDS_ShapeShapeInterference.hxx> |
7fd59977 | 34 | |
0797d9d3 | 35 | #ifdef OCCT_DEBUG |
7fd59977 | 36 | Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextEINTERNAL(); |
37 | Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextEEXTERNAL(); | |
38 | Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextNOSG(); | |
39 | Standard_EXPORT void debON(const Standard_Integer iF) | |
40 | {cout<<"++ debON "<<iF<<" "<<endl;} | |
41 | Standard_EXPORT void debON(const Standard_Integer iF, const TopAbs_State TB1,const TopAbs_State TB2) | |
42 | {cout<<"++ debON "<<iF<<" :TB1=";TopAbs::Print(TB1,cout);cout<<",TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
43 | Standard_EXPORT void debfillonf(const Standard_Integer iF) | |
44 | {cout<<"++ debfillonf "<<iF<<" "<<endl;} | |
45 | Standard_EXPORT void debfillone(const Standard_Integer iE) | |
46 | {cout<<"++ debfillone "<<iE<<" "<<endl;} | |
47 | Standard_EXPORT void debfillonfe(){} | |
48 | Standard_EXPORT void debfillonfemess(const Standard_Integer f,const Standard_Integer e) | |
49 | {cout<<"++ debfillonfe f"<<f<<" e"<<e<<endl;debfillonfe();} | |
50 | Standard_EXPORT void debfillonfe3d(){} | |
51 | Standard_EXPORT void debfillonfemess3d(const Standard_Integer f,const Standard_Integer e) | |
52 | {cout<<"++ debfillonfe3d f"<<f<<" e"<<e<<endl;debfillonfe3d();} | |
53 | Standard_EXPORT void debfillonfemess(const Standard_Integer iFOR,const Standard_Integer iEG,const TopOpeBRepBuild_PBuilder& PB,const TopOpeBRepBuild_PWireEdgeSet& PWES,const TCollection_AsciiString& str) | |
54 | {PB->GdumpSHASTA(iEG,TopAbs_ON,*PWES,str); debfillonfemess(iFOR,iEG); } | |
55 | Standard_EXPORT void debaddpwes(const Standard_Integer iFOR,const TopAbs_State TB1,const Standard_Integer iEG,const TopAbs_Orientation neworiE,const TopOpeBRepBuild_PBuilder& PB,const TopOpeBRepBuild_PWireEdgeSet& PWES,const TCollection_AsciiString& str1,const TCollection_AsciiString& str2) | |
56 | {PB->GdumpSHASTA(iFOR,TB1,*PWES,str1,str2);cout<<iEG<<" : 1 edge ";TopAbs::Print(neworiE,cout);cout<<endl; } | |
57 | Standard_EXPORT Standard_Boolean DEBTEFOR(const TopOpeBRepBuild_Builder& B,const Standard_Integer iFOR,const Standard_Integer GI) | |
58 | {return B.GtraceSPS(iFOR,GI); } | |
59 | #endif | |
60 | ||
0797d9d3 | 61 | #ifdef OCCT_DEBUG |
7fd59977 | 62 | Standard_EXPORT void FUN_RaiseON() |
63 | {Standard_Failure::Raise("BuilderON");} | |
64 | static void FUN_cout(const TopoDS_Shape& eON) | |
65 | { | |
66 | TopAbs_Orientation oE = eON.Orientation(); | |
67 | if (oE == TopAbs_FORWARD) cout<<"-> + eONF"<<endl; | |
68 | if (oE == TopAbs_REVERSED) cout<<"-> + eONR"<<endl; | |
69 | if (oE == TopAbs_INTERNAL) cout<<"-> + eONI"<<endl; | |
70 | if (oE == TopAbs_EXTERNAL) cout<<"-> + eONE"<<endl; | |
71 | } | |
72 | #endif | |
73 | ||
74 | #define M_FORWARD(st) (st == TopAbs_FORWARD) | |
75 | #define M_REVERSED(st) (st == TopAbs_REVERSED) | |
76 | #define M_INTERNAL(st) (st == TopAbs_INTERNAL) | |
77 | #define M_EXTERNAL(st) (st == TopAbs_EXTERNAL) | |
78 | ||
79 | // NYI : TopOpeBRepTool_ShapeTool::ShapesSameOriented -> CurvesSameOriented NYI for E !line | |
80 | //Standard_IMPORT Standard_Boolean TopOpeBRepBuild_FUN_aresamegeom(const TopoDS_Shape& S1,const TopoDS_Shape& S2); | |
81 | ||
82 | //======================================================================= | |
83 | //function : TopOpeBRepBuild_BuilderON | |
84 | //purpose : | |
85 | //======================================================================= | |
86 | TopOpeBRepBuild_BuilderON::TopOpeBRepBuild_BuilderON() | |
87 | { | |
88 | } | |
89 | ||
90 | //======================================================================= | |
91 | //function : TopOpeBRepBuild_BuilderON | |
92 | //purpose : | |
93 | //======================================================================= | |
94 | TopOpeBRepBuild_BuilderON::TopOpeBRepBuild_BuilderON(const TopOpeBRepBuild_PBuilder& PB, const TopoDS_Shape& FOR,const TopOpeBRepBuild_PGTopo& PG, | |
95 | const TopOpeBRepTool_Plos& PLSclass, const TopOpeBRepBuild_PWireEdgeSet& PWES) | |
96 | { | |
97 | Perform(PB,FOR,PG,PLSclass,PWES); | |
98 | } | |
99 | ||
100 | //======================================================================= | |
101 | //function : Perform | |
102 | //purpose : | |
103 | //======================================================================= | |
104 | void TopOpeBRepBuild_BuilderON::Perform(const TopOpeBRepBuild_PBuilder& PB,const TopoDS_Shape& FOR,const TopOpeBRepBuild_PGTopo& PG, | |
105 | const TopOpeBRepTool_Plos& PLSclass, const TopOpeBRepBuild_PWireEdgeSet& PWES) | |
106 | { | |
107 | myPB = PB; | |
108 | myFace = FOR; | |
109 | myPG = PG; | |
110 | myPLSclass = PLSclass; | |
111 | myPWES = PWES; | |
112 | ||
0797d9d3 | 113 | #ifdef OCCT_DEBUG |
7fd59977 | 114 | Standard_Integer iFOR;Standard_Boolean tFOR=myPB->GtraceSPS(FOR,iFOR); |
115 | if (tFOR) debfillonf(iFOR); | |
116 | #endif | |
117 | ||
118 | const TopOpeBRepDS_DataStructure& BDS=myPB->DataStructure()->DS(); | |
119 | const TopOpeBRepDS_ListOfInterference& LI=BDS.ShapeInterferences(myFace); | |
120 | for (TopOpeBRepDS_ListIteratorOfListOfInterference ILI(LI);ILI.More();ILI.Next() ) { | |
121 | const Handle(TopOpeBRepDS_Interference)& I=ILI.Value(); | |
122 | GFillONPartsWES1(I); | |
123 | } | |
124 | } | |
125 | ||
126 | //======================================================================= | |
127 | //function : GFillONCheckI | |
128 | //purpose : | |
129 | //======================================================================= | |
130 | Standard_Boolean TopOpeBRepBuild_BuilderON::GFillONCheckI(const Handle(TopOpeBRepDS_Interference)& I) const | |
131 | { | |
132 | const TopOpeBRepDS_DataStructure& BDS=myPB->DataStructure()->DS(); | |
133 | ||
134 | Handle(TopOpeBRepDS_ShapeShapeInterference) SSI=Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I); | |
135 | if (SSI.IsNull()) return Standard_False; | |
136 | ||
137 | TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); | |
138 | if (GT != TopOpeBRepDS_EDGE || ST != TopOpeBRepDS_FACE) return Standard_False; | |
0797d9d3 | 139 | #ifdef OCCT_DEBUG |
7fd59977 | 140 | // Standard_Integer iFOR=BDS.Shape(myFace); |
141 | #endif | |
142 | const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI, Standard_False)); | |
0797d9d3 | 143 | #ifdef OCCT_DEBUG |
7fd59977 | 144 | // Standard_Integer iEG=BDS.Shape(EG, Standard_False); |
145 | #endif | |
146 | const TopoDS_Shape& FS=BDS.Shape(SI, Standard_False); | |
0797d9d3 | 147 | #ifdef OCCT_DEBUG |
7fd59977 | 148 | // Standard_Integer iFS=BDS.Shape(FS, Standard_False); |
149 | #endif | |
150 | TopAbs_ShapeEnum ShapeInterf=TopAbs_FACE; | |
151 | const TopOpeBRepDS_Transition& TFE=SSI->Transition(); | |
152 | TopAbs_ShapeEnum shab=TFE.ShapeBefore(),shaa=TFE.ShapeAfter(); | |
153 | if (shaa != ShapeInterf || shab != ShapeInterf) return Standard_False; | |
154 | ||
155 | Standard_Boolean isrest=BDS.IsSectionEdge(EG); | |
156 | Standard_Boolean issplit=myPB->IsSplit(EG,TopAbs_ON); | |
157 | Standard_Boolean keep=(isrest && issplit); | |
158 | if ( !keep ) return Standard_False; | |
159 | ||
160 | const TopTools_ListOfShape& lEspON=myPB->Splits(EG,TopAbs_ON); | |
161 | if (lEspON.Extent() == 0) return Standard_False; | |
162 | ||
0797d9d3 | 163 | #ifdef OCCT_DEBUG |
7fd59977 | 164 | // const TopoDS_Shape& EspON=lEspON.First(); |
165 | #endif | |
166 | Standard_Integer rankFS=myPB->GShapeRank(FS); | |
167 | Standard_Integer rankFOR=myPB->GShapeRank(myFace); | |
168 | if (rankFS == 0 || rankFOR == 0) return Standard_False; | |
169 | ||
170 | return Standard_True; | |
171 | } // GFillONCheckI | |
172 | ||
173 | //======================================================================= | |
174 | //function : GFillONPartsWES1 | |
175 | //purpose : | |
176 | //======================================================================= | |
177 | void TopOpeBRepBuild_BuilderON::GFillONPartsWES1(const Handle(TopOpeBRepDS_Interference)& I) | |
178 | { | |
179 | const TopOpeBRepDS_DataStructure& BDS=myPB->DataStructure()->DS(); | |
0797d9d3 | 180 | #ifdef OCCT_DEBUG |
7fd59977 | 181 | Standard_Integer iFOR= |
182 | #endif | |
183 | BDS.Shape(myFace); | |
184 | TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(I,GT,GI,ST,SI); | |
185 | ||
186 | Standard_Boolean Iok=GFillONCheckI(I); | |
187 | if (!Iok) return; | |
188 | ||
189 | const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI)); | |
190 | // const TopoDS_Shape& FS=BDS.Shape(SI); | |
0797d9d3 | 191 | #ifdef OCCT_DEBUG |
7fd59977 | 192 | // Standard_Integer iEG=BDS.Shape(EG); |
193 | // Standard_Integer iFS=BDS.Shape(FS); | |
194 | #endif | |
195 | ||
0797d9d3 | 196 | #ifdef OCCT_DEBUG |
7fd59977 | 197 | Standard_Boolean tEFOR=DEBTEFOR(*myPB,iFOR,GI); |
198 | if (tEFOR) debfillonfemess(iFOR,GI,myPB,myPWES,"--- GFillONPartsWES1"); | |
199 | #endif | |
200 | ||
201 | const TopTools_ListOfShape& lEspON=myPB->Splits(EG,TopAbs_ON); | |
0797d9d3 | 202 | #ifdef OCCT_DEBUG |
7fd59977 | 203 | // Standard_Integer nEspON=lEspON.Extent(); |
204 | #endif | |
205 | for(TopTools_ListIteratorOfListOfShape it(lEspON);it.More();it.Next()) { | |
206 | const TopoDS_Shape& EspON=it.Value(); | |
207 | GFillONPartsWES2(I,EspON); | |
208 | } | |
209 | } // GFillONPartsWES1 | |
210 | ||
0797d9d3 | 211 | #ifdef OCCT_DEBUG |
7fd59977 | 212 | Standard_EXPORT void FUN_coutmess(const TCollection_AsciiString& m) |
213 | { | |
214 | cout<<m; | |
215 | } | |
216 | #else | |
217 | Standard_EXPORT void FUN_coutmess(const TCollection_AsciiString&) | |
218 | { | |
219 | } | |
220 | #endif | |
221 | ||
222 | //------------------------------------------------------ | |
0797d9d3 | 223 | #ifdef OCCT_DEBUG |
7fd59977 | 224 | Standard_Boolean FUN_keepEON(const TopOpeBRepBuild_Builder& B, |
225 | #else | |
226 | Standard_Boolean FUN_keepEON(const TopOpeBRepBuild_Builder&, | |
227 | #endif | |
228 | const TopoDS_Shape& sEG, | |
229 | const TopoDS_Shape& sFOR, | |
230 | const TopoDS_Shape& sFS, | |
0797d9d3 | 231 | #ifdef OCCT_DEBUG |
7fd59977 | 232 | const Standard_Boolean EGBoundFOR, |
233 | #else | |
234 | const Standard_Boolean, | |
235 | #endif | |
236 | const TopOpeBRepDS_Transition& TFE, | |
237 | const TopAbs_State TB1, | |
238 | const TopAbs_State ) | |
239 | //------------------------------------------------------ | |
240 | { | |
241 | // on construit l'etat TB1 de FOR par rapport a FS. | |
242 | // sur face FOR,on transitionne (TFE) en l'arete EG par rapport a la face FS. | |
243 | // TFE est defini sur la geometrie naturelle de la face orientee FOR, | |
244 | // c'est a dire sur FF=FOR orientee FORWARD,par rapport a la matiere | |
245 | // definie par la face orientee FS. | |
246 | // on cherche oEGFF=orientation de EG dans FF | |
247 | TopoDS_Edge EG=TopoDS::Edge(sEG); | |
248 | TopoDS_Face FF=TopoDS::Face(sFOR);FF.Orientation(TopAbs_FORWARD); | |
249 | TopoDS_Face FS=TopoDS::Face(sFS); | |
250 | ||
0797d9d3 | 251 | #ifdef OCCT_DEBUG |
7fd59977 | 252 | Standard_Integer iEG;/*Standard_Boolean tEG=*/B.GtraceSPS(EG,iEG); |
253 | Standard_Integer iFF;/*Standard_Boolean tFF=*/B.GtraceSPS(FF,iFF); | |
254 | Standard_Integer iFS;/*Standard_Boolean tFS=*/B.GtraceSPS(FS,iFS); | |
255 | Standard_Boolean tFFEG=DEBTEFOR(B,iFF,iEG);if (tFFEG) debfillonfemess(iFF,iEG); | |
256 | Standard_Boolean tFSEG=DEBTEFOR(B,iFS,iEG);if (tFSEG) debfillonfemess(iFS,iEG); | |
257 | #endif | |
258 | ||
0797d9d3 | 259 | #ifdef OCCT_DEBUG |
7fd59977 | 260 | Standard_Boolean keep1=Standard_True; |
261 | Standard_Boolean keep2=Standard_True; | |
96a95605 | 262 | #endif |
7fd59977 | 263 | Standard_Boolean keep3=Standard_True; |
264 | Standard_Boolean isclosedFF=BRep_Tool::IsClosed(EG,FF); | |
265 | if (isclosedFF) { | |
0797d9d3 | 266 | #ifdef OCCT_DEBUG |
7fd59977 | 267 | keep1=Standard_True; |
268 | keep2=Standard_True; | |
96a95605 | 269 | #endif |
7fd59977 | 270 | keep3=Standard_True; |
271 | } | |
272 | else { | |
273 | TopAbs_Orientation oEGFF=TopAbs_FORWARD; | |
274 | FUN_tool_orientEinF(EG,FF,oEGFF); | |
275 | ||
0797d9d3 | 276 | #ifdef OCCT_DEBUG |
7fd59977 | 277 | TopAbs_Orientation omatFS1=TFE.Orientation(TB1); |
278 | if (oEGFF == TopAbs_REVERSED) omatFS1=TopAbs::Complement(omatFS1); | |
279 | keep1=(omatFS1 == TopAbs_FORWARD); | |
280 | ||
281 | TopAbs_Orientation omatFS2=TFE.Orientation(TB1); | |
282 | keep2=(omatFS2 == oEGFF); | |
96a95605 | 283 | #endif |
7fd59977 | 284 | |
285 | TopAbs_State tfeb=TFE.Before(); | |
286 | TopAbs_State tfea=TFE.After(); | |
287 | if (oEGFF == TopAbs_FORWARD ) keep3=(tfea == TB1); | |
288 | else if (oEGFF == TopAbs_REVERSED) keep3=(tfeb == TB1); | |
289 | else if (oEGFF == TopAbs_EXTERNAL) keep3=(tfea == TB1 || tfeb == TB1); | |
290 | else if (oEGFF == TopAbs_INTERNAL) keep3=(tfea == TB1 || tfeb == TB1); | |
291 | } | |
292 | ||
0797d9d3 | 293 | #ifdef OCCT_DEBUG |
7fd59977 | 294 | if (tFFEG || tFSEG) { |
295 | if ( keep1 != keep2 || keep1 != keep3 || keep2 != keep3 ) { | |
296 | cout<<"\nkeepEON : EGB "<<EGBoundFOR<<" EG "<<iEG<<" FOR "<<iFF<<" FS "<<iFS; | |
297 | cout<<" keep1 "<<keep1<<" keep2 "<<keep2<<" keep3 "<<keep3; | |
298 | cout<<" !=!=!=!=!=!=!=!=!=!=!=!=!=!=!="; | |
299 | cout<<endl; | |
300 | } | |
301 | } | |
302 | #endif | |
303 | ||
304 | return keep3; | |
305 | } | |
306 | ||
307 | Standard_EXPORT TopAbs_State FUN_build_TB(const TopOpeBRepBuild_PBuilder& PB,const Standard_Integer rank) | |
308 | { | |
309 | Standard_Boolean opeFus = PB->Opefus(); | |
310 | Standard_Boolean opec12 = PB->Opec12(); | |
311 | Standard_Boolean opec21 = PB->Opec21(); | |
312 | Standard_Boolean opeCom = PB->Opecom(); | |
313 | TopAbs_State sta = TopAbs_UNKNOWN; | |
314 | if (opeFus) sta = TopAbs_OUT; | |
315 | if (opeCom) sta = TopAbs_IN; | |
316 | if (opec12) sta = (rank == 1) ? TopAbs_OUT : TopAbs_IN; | |
317 | if (opec21) sta = (rank == 2) ? TopAbs_OUT : TopAbs_IN; | |
318 | return sta; | |
319 | } | |
320 | ||
321 | static Standard_Boolean FUN_Kpart0(const GeomAbs_SurfaceType& ST1, const GeomAbs_SurfaceType& ST2) | |
322 | { | |
323 | Standard_Boolean plane1 = (ST1 == GeomAbs_Plane); | |
324 | Standard_Boolean cyli1 = (ST1 == GeomAbs_Cylinder); | |
325 | Standard_Boolean cone1 = (ST1 == GeomAbs_Cone); | |
326 | ||
327 | Standard_Boolean cyli2 = (ST2 == GeomAbs_Cylinder); | |
328 | Standard_Boolean cone2 = (ST2 == GeomAbs_Cone); | |
329 | Standard_Boolean sphe2 = (ST2 == GeomAbs_Sphere); | |
330 | Standard_Boolean quad2 = cyli2 || cone2 || sphe2 || (ST2 == GeomAbs_Torus); | |
331 | ||
332 | if (plane1 && quad2) return Standard_True; | |
333 | if (cyli1 && sphe2) return Standard_True; | |
334 | if (cone1 && sphe2) return Standard_True; | |
335 | return Standard_False; | |
336 | } | |
337 | static Standard_Integer FUN_Kpart(const GeomAbs_SurfaceType& ST1, const GeomAbs_SurfaceType& ST2) | |
338 | { | |
339 | Standard_Boolean kpart0 = FUN_Kpart0(ST1,ST2); | |
340 | if (kpart0) return 1; | |
341 | kpart0 = FUN_Kpart0(ST2,ST1); | |
342 | if (kpart0) return 2; | |
343 | return 0; | |
344 | } | |
345 | ||
346 | static Standard_Integer FUN_findeSD | |
347 | (const TopOpeBRepDS_DataStructure& BDS, const TopoDS_Edge& EspON, const TopoDS_Edge& EG, const TopoDS_Face& FOR, | |
348 | TopAbs_Orientation& oeSD, const Standard_Integer D) | |
349 | { | |
350 | // chercher eSD = SameDomain3d/2d de EG, arete de FOR, qui contient EspON | |
351 | gp_Pnt ptON; Standard_Real parON; | |
352 | FUN_tool_findPinE(EspON,ptON,parON); | |
353 | TopTools_ListOfShape lesdSD; | |
354 | if (D == 3) FDS_HasSameDomain3d(BDS,EG,&lesdSD); | |
355 | if (D == 2) FDS_HasSameDomain2d(BDS,EG,&lesdSD); | |
356 | for(TopTools_ListIteratorOfListOfShape it(lesdSD);it.More();it.Next()) { | |
357 | TopoDS_Edge eSD = TopoDS::Edge(it.Value()); | |
358 | TopAbs_Orientation oesd; Standard_Boolean eSDofFOR = FUN_tool_orientEinFFORWARD(eSD,FOR,oesd); | |
359 | if (!eSDofFOR) continue; | |
360 | TopAbs_State staeSD = FUN_tool_staPinE(ptON,eSD); | |
361 | if (staeSD == TopAbs_IN) { | |
362 | Standard_Integer i = BDS.Shape(eSD); oeSD = oesd; | |
363 | return i; | |
364 | } | |
365 | } | |
366 | return 0; | |
367 | } | |
368 | ||
369 | static Standard_Boolean ComputeFaceCrvtInSec(const TopoDS_Face& aFace, | |
370 | const gp_Pnt2d& aP2d, | |
371 | const gp_Dir& aSecDir, | |
372 | Standard_Real& aCrvt) | |
373 | { | |
374 | BRepAdaptor_Surface aSurf(aFace); | |
375 | Standard_Integer cn = BRepLProp_SurfaceTool::Continuity(aSurf); | |
376 | if (cn < 2) return Standard_False; | |
377 | BRepLProp_SLProps aProp(aSurf, aP2d.X(), aP2d.Y(), 2, Precision::Confusion()); | |
378 | if (!aProp.IsCurvatureDefined()) return Standard_False; | |
379 | ||
380 | if (aProp.IsUmbilic()) { | |
381 | aCrvt = aProp.MaxCurvature(); | |
382 | return Standard_True; | |
383 | } | |
384 | ||
385 | Standard_Real maxCrv = aProp.MaxCurvature(); | |
386 | Standard_Real minCrv = aProp.MinCurvature(); | |
387 | gp_Dir maxDir, minDir; | |
388 | aProp.CurvatureDirections(maxDir, minDir); | |
389 | Standard_Real cosMax = aSecDir * maxDir; | |
390 | Standard_Real cosMin = aSecDir * minDir; | |
391 | aCrvt = maxCrv * cosMax + minCrv * cosMin; | |
392 | return Standard_True; | |
393 | } | |
394 | ||
395 | //======================================================================= | |
396 | //function : GFillONPartsWES2 | |
397 | //purpose : | |
398 | //======================================================================= | |
399 | void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const Handle(TopOpeBRepDS_Interference)& I,const TopoDS_Shape& EspON) | |
400 | { | |
401 | const Handle(TopOpeBRepDS_HDataStructure)& HDS=myPB->DataStructure(); | |
402 | const TopOpeBRepDS_DataStructure& BDS= HDS->DS(); | |
403 | const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI=Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I); | |
404 | TopAbs_State TB1,TB2;myPG->StatesON(TB1,TB2); TopAbs_State TB=TB1; | |
405 | TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); | |
406 | const TopOpeBRepDS_Transition& TFE=SSI->Transition(); Standard_Boolean EGBoundFOR=SSI->GBound(); | |
407 | const TopoDS_Face& FOR=TopoDS::Face(myFace); Standard_Integer iFOR=BDS.Shape(FOR); | |
408 | const TopoDS_Edge& eON=TopoDS::Edge(EspON); | |
409 | const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI)); | |
0797d9d3 | 410 | #ifdef OCCT_DEBUG |
7fd59977 | 411 | Standard_Integer iEG= |
412 | #endif | |
413 | BDS.Shape(EG); | |
414 | const TopoDS_Face& FS=TopoDS::Face(BDS.Shape(SI)); Standard_Integer iFS=BDS.Shape(FS); | |
415 | ||
416 | Standard_Real tola = Precision::Angular()*1.e3;//nyitol | |
417 | ||
418 | TopAbs_Orientation oFOR = BDS.Shape(iFOR).Orientation(); | |
419 | TopAbs_Orientation oFS = BDS.Shape(iFS).Orientation(); | |
420 | ||
421 | Standard_Boolean isclosedFF=FUN_tool_IsClosingE(EG,FOR,FOR); //xpu240898 : cto900J5 faulty yapc2(FOR17,FS18,EG15) | |
422 | Standard_Boolean isclosedFS=FUN_tool_IsClosingE(EG,FS,FS); //xpu240898 | |
423 | Standard_Boolean isclosed=(isclosedFF || isclosedFS); | |
424 | Standard_Boolean isrest=BDS.IsSectionEdge(EG); | |
0797d9d3 | 425 | #ifdef OCCT_DEBUG |
7fd59977 | 426 | // Standard_Boolean issplit=myPB->IsSplit(EG,TopAbs_ON); |
427 | #endif | |
428 | Standard_Integer rankFS=myPB->GShapeRank(FS); | |
429 | Standard_Integer rankEG=myPB->GShapeRank(EG); | |
430 | Standard_Integer rankFOR=myPB->GShapeRank(FOR); | |
431 | TopAbs_Orientation OTFE = TFE.Orientation(TopAbs_IN); | |
432 | TopAbs_State TFEbef = TFE.Before(); | |
433 | TopAbs_State TFEaft = TFE.After(); | |
0797d9d3 | 434 | #ifdef OCCT_DEBUG |
7fd59977 | 435 | // Standard_Boolean EGboundFOR = |
436 | // Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I)->GBound(); | |
437 | #endif | |
438 | Standard_Boolean eghassd = HDS->HasSameDomain(EG); | |
439 | TopTools_ListOfShape le3;Standard_Boolean eghassd3d = FDS_HasSameDomain3d(BDS,EG,&le3); | |
440 | Standard_Integer ie3d = 0; TopAbs_Orientation oe3d = TopAbs_EXTERNAL; | |
441 | Standard_Integer ie2d = 0; TopAbs_Orientation oe2d = TopAbs_EXTERNAL; | |
442 | TopTools_ListOfShape lfcx; FDSCNX_FaceEdgeConnexFaces(FS,EG,HDS,lfcx); | |
443 | Standard_Integer nlfcx=lfcx.Extent(); | |
444 | ||
445 | Standard_Boolean hsdFOR = HDS->HasSameDomain(FOR); | |
446 | TopOpeBRepDS_Config cFOR = TopOpeBRepDS_UNSHGEOMETRY; | |
447 | Standard_Integer irefFOR = 0; | |
448 | TopAbs_Orientation orefFOR = TopAbs_EXTERNAL; | |
449 | Standard_Boolean FORisref = Standard_False; | |
450 | if (hsdFOR) { | |
451 | cFOR = BDS.SameDomainOri(iFOR); | |
452 | if (hsdFOR) irefFOR = BDS.SameDomainRef(FOR); | |
453 | if (irefFOR != 0) orefFOR = BDS.Shape(irefFOR).Orientation(); | |
454 | FORisref = (irefFOR == iFOR); | |
455 | } | |
456 | ||
457 | Standard_Boolean opeFus = myPB->Opefus(); | |
458 | Standard_Boolean opec12 = myPB->Opec12(); | |
0797d9d3 | 459 | #ifdef OCCT_DEBUG |
7fd59977 | 460 | // Standard_Boolean opec21 = myPB->Opec21(); |
461 | #endif | |
462 | Standard_Boolean opeCut = myPB->Opec12() || myPB->Opec21(); | |
463 | Standard_Boolean opeCom = myPB->Opecom(); | |
464 | Standard_Boolean ComOfCut = opeCut && (TB1 == TB2) && (TB1 == TopAbs_IN); //xpu200598 only if FFSDSO | |
465 | ||
466 | TopAbs_State TBFOR = FUN_build_TB(myPB,rankFOR); | |
467 | ||
0797d9d3 | 468 | #ifdef OCCT_DEBUG |
7fd59977 | 469 | Standard_Boolean tFOR=myPB->GtraceSPS(iFOR);Standard_Boolean tE=myPB->GtraceSPS(GI); |
470 | Standard_Boolean tEFOR=DEBTEFOR(*myPB,iFOR,GI); | |
471 | if (tFOR) debON(iFOR); | |
472 | #endif | |
473 | ||
474 | Standard_Real factor = 1.e2; | |
475 | Standard_Real tolEG = BRep_Tool::Tolerance(EG)*factor; //NYITOLXPU | |
476 | Standard_Real tolFOR = BRep_Tool::Tolerance(FOR)*factor; //NYITOLXPU | |
477 | Standard_Real tolFS = BRep_Tool::Tolerance(FS)*factor; //NYITOLXPU | |
478 | ||
479 | Standard_Real f,l; FUN_tool_bounds(eON,f,l); Standard_Real x=0.456189; Standard_Real parON = (1-x)*f + x*l; | |
480 | ||
481 | ||
482 | // xpu150698 : spON(EG)=spON1+spON2+.., spON1 ON EsdEG, spON2 shares no | |
483 | // geometry with any other edge. | |
484 | // FRA11018 (FOR=f5,EG=e18,EsdEG=e7) | |
485 | Standard_Boolean espONesd = Standard_False; Standard_Integer Iesd=0;// xpu150698 | |
486 | if (eghassd) espONesd = FUN_ds_ONesd(BDS,GI,EspON,Iesd);// xpu150698 | |
1d47d8d0 | 487 | Standard_Boolean eONsoEsd = Standard_False; |
7fd59977 | 488 | if (eghassd && (Iesd != 0)) { |
489 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); | |
490 | Standard_Boolean ok = FUN_tool_curvesSO(eON,Esd,eONsoEsd); | |
491 | if (!ok) return; | |
492 | } | |
493 | ||
494 | Standard_Boolean eONFS = Standard_True; // xpu240898 | |
495 | if (eghassd && (!espONesd)) { | |
496 | gp_Pnt pON; Standard_Boolean ok = FUN_tool_value(parON,eON,pON); | |
497 | if (!ok) return; | |
498 | gp_Pnt2d uvFS; Standard_Real d=1.; ok = FUN_tool_projPonboundedF(pON,FS,uvFS,d); | |
499 | if (!ok) return; | |
500 | Standard_Real tolF = FUN_tool_maxtol(FS); eONFS = (d < tolF); | |
501 | } | |
502 | // ------------------------------------ | |
503 | Standard_Boolean eghassdON = eghassd && espONesd; | |
504 | Standard_Boolean eghassd3dON = eghassd3d && espONesd; | |
505 | // ------------------------------------ | |
506 | ||
507 | Standard_Boolean yap00 = Standard_True; //xpu180998 : cto900Q2 | |
508 | yap00 = yap00 && (!isclosed); | |
509 | yap00 = yap00 && (EGBoundFOR); | |
510 | yap00 = yap00 && (espONesd); | |
511 | yap00 = yap00 && (!hsdFOR); //xpu280998 : PRO14892 (FOR16,FS30,GI20) | |
512 | if (yap00) { | |
513 | const TopOpeBRepDS_ListOfInterference& lI = BDS.ShapeInterferences(FOR); | |
514 | TopOpeBRepDS_ListOfInterference lIcopy; FDS_assign(lI,lIcopy); | |
515 | TopOpeBRepDS_ListOfInterference lIGesd; Standard_Integer nGesd = FUN_selectGIinterference(lIcopy,Iesd,lIGesd); | |
516 | if (nGesd != 0) yap00=Standard_False; // ES has interference on G=edge(Iesd) | |
517 | } | |
518 | ||
519 | Standard_Boolean yap0 = Standard_True; | |
520 | yap0 = yap0 && (!isclosed); | |
521 | yap0 = yap0 && (EGBoundFOR); | |
522 | yap0 = yap0 && (!eghassd); | |
523 | ||
524 | Standard_Boolean yap0bis = Standard_True; // xpu160698 | |
525 | yap0bis = yap0bis && (!isclosed); | |
526 | yap0bis = yap0bis && (EGBoundFOR); | |
527 | yap0bis = yap0bis && (eghassd); // xpu300798 : cto 902 B7 | |
528 | yap0bis = yap0bis && (!eghassdON); | |
529 | yap0bis = yap0bis && eONFS; //xpu240898 : cto900J3 (e7on_2 NOT ON FS, FOR18,FS17,EG7) | |
530 | yap0bis = yap0bis && !ComOfCut; // xpu270798 : boxes240798, f14in,GI=34 | |
531 | if ( yap0bis ) { | |
532 | yap0 = Standard_True; | |
533 | } | |
534 | ||
535 | Standard_Boolean hassd3dON = Standard_False; | |
536 | // if (isclosed && !EGBoundFOR && eghassd3d) { -xpu110898 -> yapc3 | |
537 | if (!EGBoundFOR && eghassd3d) { | |
538 | ie3d = ::FUN_findeSD(BDS,eON,EG,FOR,oe3d,3); | |
539 | hassd3dON = (ie3d != 0); | |
540 | } | |
541 | ||
542 | Standard_Boolean yapc1 = Standard_True; | |
543 | yapc1 = yapc1 && (isclosed); | |
544 | yapc1 = yapc1 && (!EGBoundFOR); | |
545 | yapc1 = yapc1 && (eghassd3d); | |
546 | yapc1 = yapc1 && hassd3dON; //xpu230798 | |
547 | ||
548 | Standard_Boolean yapc2a = Standard_True; | |
549 | yapc2a = yapc2a && (isclosed); | |
550 | yapc2a = yapc2a && (!eghassd3d); | |
551 | ||
552 | //xpu240798 cto902A3 (iFOR=5,GI=3,iFCX=6) : complement yapc1 | |
553 | Standard_Boolean yapc2b = Standard_True; | |
554 | yapc2b = yapc2b && (isclosed); | |
555 | yapc2b = yapc2b && (!EGBoundFOR); | |
556 | yapc2b = yapc2b && (eghassd3d); | |
557 | yapc2b = yapc2b && (!hassd3dON); | |
558 | ||
559 | Standard_Boolean yapc2c = Standard_True; | |
560 | yapc2c = yapc2c && (isclosed); | |
561 | yapc2c = yapc2c && (EGBoundFOR); | |
562 | yapc2c = yapc2c && (eghassd3d); | |
563 | ||
564 | Standard_Boolean yapc2 = yapc2a; | |
565 | yapc2 = yapc2 || yapc2b || yapc2c; //xpu240798 | |
566 | ||
567 | Standard_Boolean yapc3 = Standard_True; | |
568 | yapc3 = yapc3 && (!isclosed); | |
569 | yapc3 = yapc3 && (eghassd3d); | |
570 | yapc3 = yapc3 && (hassd3dON); | |
571 | Standard_Boolean e3closedFOR = Standard_False; | |
572 | if (hassd3dON) { | |
573 | const TopoDS_Edge& e3d = TopoDS::Edge(BDS.Shape(ie3d)); | |
574 | e3closedFOR = BRep_Tool::IsClosed(e3d,FOR); | |
575 | } | |
576 | yapc3 = yapc3 && e3closedFOR; // => !EGBoundFOR | |
577 | ||
578 | //========================================= | |
579 | if ( yap00 ) { | |
0797d9d3 | 580 | #ifdef OCCT_DEBUG |
7fd59977 | 581 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap0 GFillON"); |
582 | if (tE) {cout<<"yap00(FOR"<<iFOR<<" FS"<<iFS<<" EG"<<GI<<") "; | |
583 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
584 | #endif | |
585 | ||
586 | TopAbs_Orientation oeff; | |
587 | FUN_tool_orientEinFFORWARD(EG,FOR,oeff); | |
588 | Standard_Boolean add = Standard_False; | |
589 | if (oeff == TopAbs_FORWARD) add = (TFEaft == TB); | |
590 | else if (oeff == TopAbs_REVERSED) add = (TFEbef == TB); | |
591 | else if (oeff == TopAbs_INTERNAL) add = Standard_True; | |
592 | else if (oeff == TopAbs_EXTERNAL) add = Standard_True; | |
593 | if (!add) return; | |
594 | ||
595 | const TopoDS_Shape& Esd = BDS.Shape(Iesd); | |
596 | Standard_Boolean isONFS=Standard_False; TopExp_Explorer ex(FS, TopAbs_EDGE); | |
597 | for (; ex.More(); ex.Next()) | |
598 | if (ex.Current().IsSame(Esd)) {isONFS=Standard_True;break;} | |
599 | if (!isONFS) return; | |
600 | ||
601 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
602 | if (!ok) return; | |
603 | Standard_Boolean samegeom; ok = FUN_tool_curvesSO(EG,parEG,eON,samegeom); | |
604 | if (!ok) return; | |
605 | TopAbs_Orientation neworiE = oeff; | |
606 | if (!samegeom && (M_FORWARD(neworiE) || M_REVERSED(neworiE))) neworiE = TopAbs::Complement(neworiE); | |
607 | ||
608 | TopoDS_Shape newE = EspON; | |
609 | newE.Orientation(neworiE); | |
0797d9d3 | 610 | #ifdef OCCT_DEBUG |
7fd59977 | 611 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap00 GFillON","WES+ EspON "); |
612 | if (tE) FUN_cout(newE); | |
613 | #endif | |
614 | myPWES->AddStartElement(newE); | |
615 | return; | |
616 | } | |
617 | ||
618 | //========================================= | |
619 | if ( yap0 ) { | |
0797d9d3 | 620 | #ifdef OCCT_DEBUG |
7fd59977 | 621 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap0 GFillON"); |
622 | if (tE) {cout<<"yap0(FOR"<<iFOR<<" FS"<<iFS<<" EG"<<GI<<") "; | |
623 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
624 | #endif | |
625 | ||
626 | TopAbs_Orientation oeff; | |
627 | FUN_tool_orientEinFFORWARD(EG,FOR,oeff); | |
628 | Standard_Boolean add = Standard_False; | |
629 | if (oeff == TopAbs_FORWARD) add = (TFEaft == TB); | |
630 | else if (oeff == TopAbs_REVERSED) add = (TFEbef == TB); | |
631 | else if (oeff == TopAbs_INTERNAL) add = Standard_True; | |
632 | else if (oeff == TopAbs_EXTERNAL) add = Standard_True; | |
633 | if (!add) return; //xpu100698 | |
634 | ||
635 | // parEG : | |
636 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
637 | if (!ok) return; | |
638 | // ngFS, ngFOR, xxFOR : | |
639 | Standard_Real tolON = Max(tolFS,tolEG); | |
640 | tolON *= 1.e2;//*****CAREFULL***** : xpu040998, cto 904 A3 | |
641 | gp_Vec ngFS; ok = FUN_tool_nggeomF(parEG,EG,FS,ngFS,tolON); | |
642 | if (!ok) return; | |
643 | tolON = Max(tolFOR,tolEG); | |
644 | tolON *= 1.e2;//*****CAREFULL***** : xpu040998, cto 904 A3 | |
645 | gp_Vec ngFOR; ok = FUN_tool_nggeomF(parEG,EG,FOR,ngFOR,tolON); | |
646 | if (!ok) return; | |
647 | gp_Dir xxFOR; ok = FUN_tool_getxx(FOR,EG,parEG,ngFOR,xxFOR); | |
648 | if (!ok) return; | |
649 | // ntFS, ntFOR, ntdot : | |
650 | gp_Dir ntFS(ngFS); if (M_REVERSED(oFS)) ntFS.Reverse(); | |
651 | gp_Dir ntFOR(ngFOR); if (M_REVERSED(oFOR)) ntFOR.Reverse(); | |
652 | Standard_Real ntdot = ntFOR.Dot(ntFS); | |
653 | ||
654 | // xpu180698 : Kpart=FOR tangent to FS at EG | |
655 | Standard_Boolean Kpart = (OTFE == TopAbs_EXTERNAL) || (OTFE == TopAbs_INTERNAL); | |
656 | if (Kpart) { | |
657 | Standard_Boolean Ktg = (Abs(1-Abs(ntdot)) < tola*1.e2); | |
658 | Kpart = Ktg; | |
659 | } | |
660 | if (Kpart) { | |
661 | gp_Pnt2d UVfor,UVfs; ok = FUN_tool_paronEF(EG,parEG,FOR,UVfor,tolFOR); | |
662 | if (!ok) return; | |
663 | gp_Pnt Pfor,Pfs; FUN_tool_value(UVfor,FOR,Pfor); | |
664 | tolON = Max(Max(tolFOR,tolFS),tolEG) * 10.; | |
665 | Standard_Real d; | |
666 | ||
667 | BRepAdaptor_Surface BSfor(FOR); GeomAbs_SurfaceType STfor = BSfor.GetType(); | |
668 | BRepAdaptor_Surface BSfs(FS); GeomAbs_SurfaceType STfs = BSfs.GetType(); | |
669 | Standard_Integer kpart = FUN_Kpart(STfor,STfs); | |
670 | if (kpart == 0) { | |
671 | // MSV: general case, such as BSpline or Bezier surface or two cylinders. | |
672 | // We should detect if FOR and FS have different curvature in section | |
673 | // by plane perpendicular to EG at point parEG. | |
674 | Standard_Real crvFOR,crvFS; | |
675 | if (!ComputeFaceCrvtInSec(FOR,UVfor,xxFOR,crvFOR)) return; | |
676 | if (!FUN_tool_projPonF(Pfor,FS,UVfs,d)) return; | |
677 | if (!ComputeFaceCrvtInSec(FS,UVfs,xxFOR,crvFS)) return; | |
678 | if (M_REVERSED(oFOR)) crvFOR = -crvFOR; | |
679 | if (M_REVERSED(oFS)) crvFS = -crvFS; | |
680 | if (ntdot < 0.) crvFS = -crvFS; | |
681 | Standard_Real eps = Precision::Confusion(); | |
682 | Standard_Real absCrvFOR = Abs(crvFOR), absCrvFS = Abs(crvFS); | |
683 | if (absCrvFOR <= eps && absCrvFS <= eps) return; | |
684 | if (absCrvFOR > eps && absCrvFS > eps) { | |
685 | Standard_Real tolR = tolON; | |
686 | Standard_Real rcrvFOR = 1./crvFOR, rcrvFS = 1./crvFS; | |
687 | if (Abs(rcrvFOR - rcrvFS) <= tolR) return; | |
688 | } | |
689 | // if we are here the curvatures are different | |
690 | } | |
691 | // SO : | |
692 | Standard_Boolean SO = (ntdot > 0.); | |
693 | // Pfor : | |
694 | Pfor.Translate(xxFOR.XYZ()*tolON*10.); | |
695 | ok = FUN_tool_projPonF(Pfor,FOR,UVfor,d); | |
696 | if (!ok) return; | |
697 | FUN_tool_value(UVfor,FOR,Pfor); | |
698 | // Pfs : | |
699 | ok = FUN_tool_projPonF(Pfor,FS,UVfs,d); | |
700 | if (!ok) return; | |
701 | FUN_tool_value(UVfs,FS,Pfs); | |
702 | // Dforfs : | |
703 | gp_Dir Dforfs(gp_Vec(Pfor,Pfs)); | |
704 | ||
705 | Standard_Boolean keep = Standard_True; | |
706 | Standard_Real dot = Dforfs.Dot(ntFOR); // xpu250698 | |
707 | if (SO) { | |
708 | Standard_Boolean so2and3 = (dot > 0); // xpu250698 | |
709 | Standard_Boolean so2 = so2and3; // xpu250698 | |
710 | ||
711 | if (opeFus) keep = !so2; | |
712 | if (opeCom) keep = so2; | |
713 | if (opeCut) { | |
714 | if (TBFOR == TopAbs_OUT) keep = !so2; | |
715 | else keep = so2; | |
716 | } | |
717 | } // SO | |
718 | else { | |
719 | Standard_Boolean do1and2 = (dot > 0); // xpu250698 | |
720 | Standard_Boolean do1 = do1and2; // xpu250698 | |
721 | ||
722 | if (opeFus) keep = do1; | |
723 | if (opeCom) keep = !do1; | |
724 | if (opeCut) { | |
725 | if (TBFOR == TopAbs_OUT) keep = do1; | |
726 | else keep = !do1; | |
727 | } | |
728 | } // !SO | |
729 | if (!keep) return; | |
730 | } //Kpart | |
731 | else { | |
732 | // dot : | |
733 | Standard_Real dot = ntFS.Dot(xxFOR); | |
734 | Standard_Boolean positive = (dot > 0); | |
735 | ||
736 | Standard_Boolean keep = Standard_True; | |
737 | if (opeFus) { | |
738 | keep = positive; | |
739 | } | |
740 | if (opeCom) { | |
741 | keep = !positive; | |
742 | } | |
743 | if (opeCut) { | |
744 | if (positive) keep = (TBFOR == TopAbs_OUT); | |
745 | else keep = (TBFOR != TopAbs_OUT); | |
746 | } | |
747 | if (!keep) return; | |
748 | } | |
749 | ||
750 | TopoDS_Face newF = FOR; | |
751 | TopoDS_Shape newE = EspON; | |
752 | TopAbs_Orientation neworiE; FUN_tool_orientEinFFORWARD(EG,newF,neworiE); | |
753 | ||
754 | if (hsdFOR) { | |
755 | //xpu260698 : cto902A5 : fonds de poche (FOR=f14,GI=e24,refFOR=f13) | |
756 | Standard_Boolean reverse = Standard_False; | |
757 | if (!FORisref) { | |
758 | // xpu170698 : PRO13555 (FOR=f19,GI=e10,FS=f15) | |
759 | Standard_Boolean FORDO = (cFOR == TopOpeBRepDS_DIFFORIENTED); | |
760 | if (FORDO) reverse = !reverse; | |
761 | if (oFOR != orefFOR) reverse = !reverse; | |
762 | } | |
763 | ||
764 | if (opeFus) {//nyixpu260698 | |
765 | } | |
766 | if (opeCom) {//nyixpu260698 | |
767 | } | |
768 | if (opeCut) { | |
769 | if (TBFOR == TopAbs_IN) { | |
770 | // xpu290798 : cto902C1 (FOR19,FS16,GI22) f9ou is DO f19in | |
771 | // sp(f9)+sp(f19) are in same WES, e22on is OUT f9 => | |
772 | // do NOT reverse neworiE | |
773 | // reverse = Standard_True; | |
774 | } | |
775 | else {} | |
776 | } | |
777 | if (reverse) neworiE = TopAbs::Complement(neworiE); | |
778 | } // hsdFOR | |
779 | ||
780 | newE.Orientation(neworiE); | |
0797d9d3 | 781 | #ifdef OCCT_DEBUG |
7fd59977 | 782 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap0 GFillON","WES+ EspON "); |
783 | if (tE) FUN_cout(newE); | |
784 | #endif | |
785 | myPWES->AddStartElement(newE); | |
786 | return; | |
787 | } //yap0 | |
788 | ||
789 | //========================================= | |
790 | if ( yapc1 ) { | |
0797d9d3 | 791 | #ifdef OCCT_DEBUG |
7fd59977 | 792 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yapc1 GFillON"); |
793 | if (tE) {cout<<"yapc1(FOR"<<iFOR<<" FS"<<iFS<<" EG"<<GI<<") "; | |
794 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
795 | #endif | |
796 | const TopoDS_Edge& e3d = TopoDS::Edge(BDS.Shape(ie3d)); | |
797 | ||
798 | // e3d = SameDomain3d de EG, arete de FOR, qui contient EspON | |
799 | TopOpeBRepDS_Config cf; Standard_Boolean cfok = FDS_Config3d(EspON,e3d,cf); | |
800 | if (!cfok) return; | |
801 | ||
802 | TopAbs_Orientation oe3dk = oe3d; | |
803 | // Standard_Boolean samegeom = ::TopOpeBRepBuild_FUN_aresamegeom(EG,e3d); | |
804 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
805 | if (!ok) return; //nyiRAISE | |
806 | Standard_Boolean samegeom; ok = FUN_tool_curvesSO(EG,parEG,e3d,samegeom); | |
807 | if (!ok) return; //nyiRAISE | |
0797d9d3 | 808 | #ifdef OCCT_DEBUG |
7fd59977 | 809 | if (!TopOpeBRepBuild_GetcontextNOSG()) { |
810 | #endif | |
811 | if (!samegeom) oe3dk = TopAbs::Complement(oe3dk); | |
0797d9d3 | 812 | #ifdef OCCT_DEBUG |
7fd59977 | 813 | } |
814 | #endif | |
815 | ||
816 | Standard_Boolean keep3d = Standard_False; | |
817 | if (oe3dk == TopAbs_FORWARD) keep3d = (TFEaft == TB1); | |
818 | else if (oe3dk == TopAbs_REVERSED) keep3d = (TFEbef == TB1); | |
819 | else if (oe3dk == TopAbs_INTERNAL) keep3d = Standard_True; | |
820 | else if (oe3dk == TopAbs_EXTERNAL) keep3d = Standard_False; | |
821 | ||
0797d9d3 | 822 | #ifdef OCCT_DEBUG |
7fd59977 | 823 | // if(tEFOR) {cout<<endl<<"yapc1 keep3d : "<<keep3d<<endl;debfillonfemess3d(iFOR,iEG);} |
824 | #endif | |
825 | ||
826 | if (keep3d) { | |
827 | TopAbs_Orientation neworiE = oe3d; | |
828 | if (cf == TopOpeBRepDS_DIFFORIENTED) neworiE = TopAbs::Complement(neworiE); | |
829 | TopoDS_Shape newE = EspON; | |
830 | newE.Orientation(neworiE); | |
831 | ||
0797d9d3 | 832 | #ifdef OCCT_DEBUG |
7fd59977 | 833 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yapc1 GFillON","WES+ EspON "); |
834 | if (tE) FUN_cout(newE); | |
835 | #endif | |
836 | myPWES->AddStartElement(newE); | |
837 | } | |
838 | ||
839 | return; | |
840 | } // yapc1 | |
841 | ||
842 | //========================================= | |
843 | if ( yapc2 ) { | |
0797d9d3 | 844 | #ifdef OCCT_DEBUG |
7fd59977 | 845 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yapc2 GFillON"); |
846 | if (tE) {cout<<"yapc2(FOR"<<iFOR<<" FS"<<iFS<<" EG"<<GI<<") "; | |
847 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
848 | #endif | |
849 | ||
850 | Standard_Boolean keep = Standard_False; | |
851 | if (EGBoundFOR) keep=FUN_keepEON(*myPB,EG,FOR,FS,EGBoundFOR,TFE,TB1,TB2); | |
852 | else keep=Standard_True; | |
853 | if ( !keep ) return; | |
854 | ||
855 | TopAbs_Orientation neworiE = TFE.Orientation(TB1); | |
856 | Standard_Boolean giveoEinFOR = EGBoundFOR && (!isclosedFF) && (M_EXTERNAL(neworiE) || M_INTERNAL(neworiE)); | |
857 | if (giveoEinFOR) FUN_tool_orientEinFFORWARD(EG,FOR,neworiE); | |
858 | ||
859 | // xpu230798 : cto902A3 (iFOR=5,GI=3,iFCX=6) | |
860 | // (iFOR=20,GI=3,iFCX=6) | |
861 | if (yapc2b && (!M_EXTERNAL(neworiE))){ | |
862 | TopOpeBRepTool_ShapeClassifier& PSC = FSC_GetPSC(FOR); | |
863 | TopAbs_State state2d = FSC_StateEonFace(EspON,0.345,FOR,PSC); | |
864 | if (state2d != TopAbs_IN) return; | |
865 | } | |
866 | ||
867 | TopoDS_Shape newE=EspON; | |
868 | Standard_Boolean addFORREV = Standard_False; | |
869 | TopAbs_Orientation neworiEk = TopAbs_EXTERNAL; | |
870 | if (!isclosedFF) neworiEk = neworiE; | |
871 | else if (M_FORWARD(neworiE) || M_REVERSED(neworiE)) neworiEk = neworiE; | |
872 | else if (M_INTERNAL(neworiE)) addFORREV = Standard_True; | |
873 | newE.Orientation(neworiEk); | |
874 | ||
0797d9d3 | 875 | #ifdef OCCT_DEBUG |
7fd59977 | 876 | if (tEFOR) { |
877 | if (!isclosedFF) | |
878 | debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yapc2 GFillON","WES+ EspON not closed"); | |
879 | else if (M_FORWARD(neworiE) || M_REVERSED(neworiE)) | |
880 | debaddpwes(iFOR,TB1,iEG,neworiEk,myPB,myPWES,"yapc2 GFillON closed","WES+ EspON F|R"); | |
881 | else if (M_INTERNAL(neworiE)) { | |
882 | debaddpwes(iFOR,TB1,iEG,TopAbs_FORWARD, myPB,myPWES,"yapc2 GFillON closed","WES+ EspON INTERNAL"); | |
883 | debaddpwes(iFOR,TB1,iEG,TopAbs_REVERSED,myPB,myPWES,"yapc2 GFillON closed","WES+ EspON INTERNAL"); | |
884 | } | |
885 | } | |
886 | if (tE) { | |
887 | if (addFORREV) { | |
888 | newE.Orientation(TopAbs_FORWARD); FUN_cout(newE); | |
889 | newE.Orientation(TopAbs_REVERSED); FUN_cout(newE); | |
890 | } | |
891 | else FUN_cout(newE); | |
892 | } | |
893 | #endif | |
894 | ||
895 | if (addFORREV) { | |
896 | newE.Orientation(TopAbs_FORWARD); | |
897 | // Standard_Boolean ok = FUN_tool_correctCLO(TopoDS::Edge(newE),FOR); // xpu201198 cto016* | |
898 | myPWES->AddStartElement(newE); | |
899 | ||
900 | newE.Orientation(TopAbs_REVERSED); | |
901 | // ok = FUN_tool_correctCLO(TopoDS::Edge(newE),FOR); // xpu201198 cto016* | |
902 | myPWES->AddStartElement(newE); | |
903 | } | |
904 | else { | |
905 | // Standard_Boolean ok = FUN_tool_correctCLO(TopoDS::Edge(newE),FOR); // xpu201198 cto016* | |
906 | myPWES->AddStartElement(newE); | |
907 | } | |
908 | return; | |
909 | } // yapc2 | |
910 | ||
911 | //========================================= | |
912 | if ( yapc3 ) { | |
0797d9d3 | 913 | #ifdef OCCT_DEBUG |
7fd59977 | 914 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yapc3 GFillON"); |
915 | if (tE) {cout<<"yapc3(FOR"<<iFOR<<" FS"<<iFS<<" EG"<<GI<<") "; | |
916 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
917 | #endif | |
918 | ||
919 | Standard_Boolean keep = Standard_False; | |
920 | if (EGBoundFOR) keep=FUN_keepEON(*myPB,EG,FOR,FS,EGBoundFOR,TFE,TB1,TB2); | |
921 | else keep=Standard_True; | |
922 | if ( !keep ) return; | |
923 | ||
924 | TopAbs_Orientation neworiE = TFE.Orientation(TB1); | |
925 | Standard_Boolean giveoEinFOR = EGBoundFOR && !isclosedFF && (M_EXTERNAL(neworiE) || M_INTERNAL(neworiE)); | |
926 | if (giveoEinFOR) FUN_tool_orientEinFFORWARD(EG,FOR,neworiE); | |
927 | ||
928 | TopoDS_Shape newE=EspON; | |
929 | Standard_Boolean addFORREV = Standard_False; | |
930 | TopAbs_Orientation neworiEk = TopAbs_EXTERNAL; | |
931 | ||
932 | // xpu110798 : cto902B4 (FOR6,EG15,FS17) | |
933 | if (M_INTERNAL(OTFE) || M_EXTERNAL(OTFE)) { | |
934 | Standard_Boolean SO = Standard_False; // "approximate same oriented (FOR,FS)" | |
935 | // parEG : | |
936 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
937 | if (!ok) return;// nyiRAISE | |
938 | // ntFS : | |
939 | gp_Pnt2d uvFS; ok = FUN_tool_paronEF(EG,parEG,FS,uvFS,tolFS); // !EGBoundFOR | |
940 | if (!ok) return;// nyiRAISE | |
941 | gp_Vec ngFS = FUN_tool_nggeomF(uvFS,FS); | |
942 | gp_Dir ntFS(ngFS); if (M_REVERSED(oFS)) ntFS.Reverse(); | |
943 | // ntFOR : | |
944 | gp_Pnt2d uvFOR; ok = FUN_tool_parF(EG,parEG,FOR,uvFOR,tolFOR); | |
945 | if (!ok) return;// nyiRAISE | |
946 | gp_Vec ngFOR = FUN_tool_nggeomF(uvFOR,FOR); | |
947 | gp_Dir ntFOR(ngFOR); if (M_REVERSED(oFOR)) ntFOR.Reverse(); | |
948 | ||
949 | Standard_Real dot = ntFOR.Dot(ntFS); | |
950 | Standard_Boolean nulldot = (Abs(dot) < tola); | |
951 | if (nulldot) { | |
952 | // xxFS : | |
953 | gp_Dir xxFS; ok = FUN_tool_getxx(FS,EG,parEG,ngFS,xxFS); | |
954 | if (!ok) return;// nyiRAISE | |
955 | Standard_Real dot2 = ntFOR.Dot(xxFS); | |
956 | SO = (dot2 < 0.); | |
957 | } | |
958 | else { | |
959 | SO = (dot > 0.); | |
960 | } | |
961 | ||
962 | Standard_Boolean unkeepclo = Standard_False; | |
963 | if (SO && M_EXTERNAL(OTFE) && opeCom) unkeepclo = Standard_True; | |
964 | if (SO && M_INTERNAL(OTFE) && opeFus) unkeepclo = Standard_True; | |
965 | addFORREV = !unkeepclo; | |
966 | } | |
967 | ||
968 | if (!addFORREV) { | |
969 | neworiEk = neworiE; | |
970 | Standard_Boolean samegeom; Standard_Boolean ok = FUN_tool_curvesSO(eON,EG,samegeom); | |
971 | if (!ok) return; // nyiRAISE | |
972 | Standard_Boolean reverse = (!samegeom); | |
0797d9d3 | 973 | #ifdef OCCT_DEBUG |
7fd59977 | 974 | if (TopOpeBRepBuild_GetcontextNOSG()) |
975 | // MSV 21.03.2002: restore the genaral behaviour, since the function | |
976 | // FUN_UNKFstasta was corrected. | |
0797d9d3 | 977 | reverse = Standard_False; //we exclude this line from #ifdef OCCT_DEBUG because |
7fd59977 | 978 | //in optimised mode this line will never be included , and that follows to regressions |
979 | //MZV-12-05-2000 | |
980 | #endif | |
981 | ||
982 | if (reverse) neworiEk = TopAbs::Complement(neworiEk); | |
983 | newE.Orientation(neworiEk); | |
984 | } | |
985 | ||
0797d9d3 | 986 | #ifdef OCCT_DEBUG |
7fd59977 | 987 | if (tEFOR) { |
988 | if (!addFORREV) | |
989 | debaddpwes(iFOR,TB1,iEG,neworiEk,myPB,myPWES,"yapc3 GFillON","WES+ EspON "); | |
990 | else { | |
991 | debaddpwes(iFOR,TB1,iEG,TopAbs_FORWARD, myPB,myPWES,"yapc3 GFillON closed","WES+ EspON "); | |
992 | debaddpwes(iFOR,TB1,iEG,TopAbs_REVERSED,myPB,myPWES,"yapc3 GFillON closed","WES+ EspON "); | |
993 | } | |
994 | } | |
995 | #endif | |
996 | ||
997 | if (addFORREV) { | |
998 | newE.Orientation(TopAbs_FORWARD); myPWES->AddStartElement(newE); | |
999 | newE.Orientation(TopAbs_REVERSED); myPWES->AddStartElement(newE); | |
1000 | } | |
1001 | else { | |
1002 | myPWES->AddStartElement(newE); | |
1003 | } | |
1004 | return; | |
1005 | } // yapc3 | |
1006 | ||
1007 | if (nlfcx == 0) return; | |
1008 | const TopoDS_Face& FCX=TopoDS::Face(lfcx.First()); Standard_Integer iFCX=BDS.Shape(FCX); | |
1009 | ||
1010 | // faces samedomain de FCX | |
1011 | TopTools_ListOfShape LFSO,LFDO,LFSO1,LFDO1,LFSO2,LFDO2; | |
1012 | myPB->GFindSamDomSODO(FCX,LFSO,LFDO); | |
1013 | Standard_Integer rankFCX=myPB->GShapeRank(FCX),rankX=(rankFCX)?((rankFCX==1)?2:1):0; | |
1014 | // DEB : rankFCX doit etre=rankFS | |
1015 | ||
1016 | // LFSO2,LFDO2=faces samedomain de FCX dans le shape oppose (rankX) | |
1017 | // rankX=shape oppose=shape de FOR. | |
1018 | myPB->GFindSameRank(LFSO,rankFCX,LFSO1); myPB->GFindSameRank(LFDO,rankFCX,LFDO1); | |
1019 | myPB->GFindSameRank(LFSO,rankX,LFSO2); myPB->GFindSameRank(LFDO,rankX,LFDO2); | |
1020 | ||
1021 | // FFinSO=appartenance de FOR a l'ensemble des faces sameoriented de FCX=LFSO2 | |
1022 | Standard_Boolean FFinSDSO=Standard_False; | |
1023 | { | |
1024 | for(TopTools_ListIteratorOfListOfShape i(LFSO2);i.More();i.Next()) { | |
1025 | const TopoDS_Shape& F=i.Value(); | |
1026 | if (F.IsSame(FOR)) {FFinSDSO=Standard_True;break;} | |
1027 | } | |
1028 | } | |
1029 | // FFinDO=appartenance de FOR a l'ensemble des faces difforiented de FCX=LFDO2 | |
1030 | Standard_Boolean FFinSDDO=Standard_False; | |
1031 | { | |
1032 | for(TopTools_ListIteratorOfListOfShape i(LFDO2);i.More();i.Next()) { | |
1033 | const TopoDS_Shape& F=i.Value(); | |
1034 | if (F.IsSame(FOR)) {FFinSDDO=Standard_True;break;} | |
1035 | } | |
1036 | } | |
1037 | // FFinSD=appartenance de FOR a l'ensemble des faces samedomain de FCX | |
1038 | Standard_Boolean FFinSD=(FFinSDSO || FFinSDDO); | |
1039 | ||
1040 | TopAbs_Orientation oFCX = BDS.Shape(iFCX).Orientation(); | |
1041 | TopOpeBRepDS_Config cFCX = BDS.SameDomainOri(iFCX); | |
1042 | Standard_Integer irefFCX = BDS.SameDomainRef(FCX); | |
1043 | TopAbs_Orientation orefFCX = BDS.Shape(irefFCX).Orientation(); | |
1044 | Standard_Boolean FCXisref = (irefFCX == iFCX); | |
1045 | ||
0797d9d3 | 1046 | #ifdef OCCT_DEBUG |
7fd59977 | 1047 | // Standard_Real tolFCX = factor*BRep_Tool::Tolerance(FCX); //NYITOLXPU |
1048 | #endif | |
1049 | ||
1050 | TopAbs_Orientation oegFCXF;Standard_Boolean EGBoundFCX = FUN_tool_orientEinFFORWARD(EG,FCX,oegFCXF); | |
1051 | TopAbs_Orientation oegFCX ; | |
1052 | FUN_tool_orientEinF(EG,FCX,oegFCX); | |
1053 | ||
1054 | if (!EGBoundFOR && !espONesd) { //xpu220998 : ctocylcongA1 (FOR10,FS19,EG8) | |
1055 | gp_Pnt ptON; Standard_Boolean ok = FUN_tool_value(parON,eON,ptON); | |
1056 | if (!ok) return; //nyiRAISE | |
1057 | Standard_Real d=1.; gp_Pnt2d uvFOR; ok = FUN_tool_projPonboundedF(ptON,FOR,uvFOR,d); | |
1058 | if (!ok) return; //nyiRAISE | |
1059 | Standard_Real tolON = Max(tolEG,tolFOR);//xpu291098 cto900L7(f7,e7on) | |
1060 | //xpu051198 PRO12953(f6,e4on) | |
1061 | tolON *= 1.e2;//*****CAREFULL***** : xpu040998, cto 904 A3 | |
1062 | Standard_Boolean eONFOR = (d < tolON); | |
1063 | if (!eONFOR) return; | |
1064 | } | |
1065 | ||
1066 | Standard_Boolean yap1 = Standard_True; | |
1067 | yap1 = yap1 && FFinSD; | |
1068 | yap1 = yap1 && (!EGBoundFOR); | |
1069 | yap1 = yap1 && EGBoundFCX; | |
1070 | yap1 = yap1 && eghassd3dON; | |
1071 | ||
1072 | Standard_Boolean yap2 = Standard_True; | |
1073 | yap2 = yap2 && FFinSD; | |
1074 | yap2 = yap2 && (!EGBoundFOR); | |
1075 | yap2 = yap2 && EGBoundFCX;// yap2 = yap2 && !eghassdON; | |
1076 | yap2 = yap2 && !eghassd;// yap2 = yap2 && !eghassd3dON; | |
1077 | ||
1078 | Standard_Boolean yap1b = Standard_True; | |
1079 | yap1b = yap1b && FFinSD; | |
1080 | yap1b = yap1b && (!EGBoundFOR); | |
1081 | yap1b = yap1b && EGBoundFCX; | |
1082 | yap1b = yap1b && eghassd3d; | |
1083 | yap1b = yap1b && !eghassd3dON; | |
1084 | yap1b = yap1b && eONFS; //xpu240898 | |
1085 | if (yap1b) { | |
1086 | yap2 = Standard_True; // xpu220998 : ctocylcongA1 yap1b(FOR12,FS5,EG8) | |
1087 | } | |
1088 | ||
1089 | Standard_Boolean yap6 = Standard_True; // cto001F3 : f18ou,EG=e23 | |
1090 | yap6 = yap6 && FFinSD; | |
1091 | yap6 = yap6 && (!EGBoundFOR); | |
1092 | yap6 = yap6 && EGBoundFCX; | |
1093 | yap6 = yap6 && eghassdON; | |
1094 | yap6 = yap6 && !eghassd3d;// yap6 = yap6 && !eghassd3dON; | |
1095 | ||
1096 | Standard_Boolean yap6b = Standard_True; | |
1097 | yap6b = yap6b && FFinSD; | |
1098 | yap6b = yap6b && (!EGBoundFOR); | |
1099 | yap6b = yap6b && EGBoundFCX; | |
1100 | yap6b = yap6b && eghassd; | |
1101 | yap6b = yap6b && !eghassdON; | |
1102 | yap6b = yap6b && eONFS; //xpu240898 | |
1103 | yap6b = yap6b && !eghassd3d;// yap6b = yap6b && !eghassd3dON; | |
1104 | if (yap6b) { | |
0797d9d3 | 1105 | #ifdef OCCT_DEBUG |
7fd59977 | 1106 | // FUN_RaiseON(); |
1107 | #endif | |
1108 | yap2 = Standard_True; | |
1109 | } | |
1110 | ||
1111 | // CTS20205 spOUT(f30), e4 = eghassd3dON | |
1112 | // mais f30 !sdm lfcx(e4) | |
1113 | Standard_Boolean eghassd3fcx = eghassdON; | |
1114 | eghassd3fcx = eghassd3fcx && !FUN_ds_sdm(BDS,FOR,FS); | |
1115 | eghassd3fcx = eghassd3fcx && !FFinSD; //!FUN_ds_sdm(BDS,FOR,FCX) | |
1116 | Standard_Boolean yap5 = Standard_True; | |
1117 | yap5 = yap5 && !EGBoundFOR; | |
1118 | yap5 = yap5 && eghassd3fcx; | |
1119 | ||
1120 | Standard_Boolean yap3 = Standard_True; | |
1121 | yap3 = yap3 && !FFinSD; | |
1122 | yap3 = yap3 && !EGBoundFOR; | |
1123 | yap3 = yap3 && eghassd3dON; | |
1124 | ||
1125 | Standard_Boolean yap4 = Standard_True; | |
1126 | yap4 = yap4 && !FFinSD; | |
1127 | yap4 = yap4 && isrest; | |
1128 | yap4 = yap4 && !yap5; | |
1129 | yap4 = yap4 && !hsdFOR; //xpu290598 | |
1130 | ||
1131 | Standard_Boolean yap3b = Standard_True; | |
1132 | yap3b = yap3b && !FFinSD; | |
1133 | yap3b = yap3b && !EGBoundFOR; | |
1134 | yap3b = yap3b && eghassd3d; | |
1135 | yap3b = yap3b && !eghassd3dON; | |
1136 | yap3b = yap3b && eONFS; //xpu240898 | |
1137 | if (yap3b) { | |
1138 | yap4 = Standard_True; //xpu191098 : cto016F3(yap3b(FOR7,EG4)) | |
1139 | } | |
1140 | ||
1141 | //xpu290598 | |
1142 | Standard_Boolean yap7 = Standard_True; | |
1143 | yap7 = yap7 && !FFinSD; | |
1144 | yap7 = yap7 && isrest; | |
1145 | yap7 = yap7 && !yap5; | |
1146 | yap7 = yap7 && hsdFOR; | |
1147 | ||
1148 | TopAbs_State staFOR = TB1; | |
1149 | TopAbs_State staFS = (rankFS == rankFOR) ? TB1 : TB2; | |
1150 | ||
0797d9d3 | 1151 | #ifdef OCCT_DEBUG |
7fd59977 | 1152 | // if(tEFOR) cout<<endl<<"yap1 yap2 yap3 yap4 = "; |
1153 | // if(tEFOR) cout<<yap1<<" "<<yap2<<" "<<yap3<<" "<<yap4<<endl<<endl; | |
1154 | // if(tEFOR) debfillonfemess(iFOR,iEG); | |
1155 | #endif | |
1156 | ||
1157 | //========================================= | |
1158 | if ( yap1 ) { | |
0797d9d3 | 1159 | #ifdef OCCT_DEBUG |
7fd59977 | 1160 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap1 GFillON"); |
1161 | if (tE) {cout<<"yap1(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1162 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1163 | ||
1164 | #endif | |
1165 | ||
1166 | // FF est samedomain avec FCX | |
1167 | // on evalue la transition de FOR par rapport a la matiere 2d de la face FCX | |
1168 | // au lieu de la transition par rapport a la matiere 3d de la face FS | |
1169 | // EG est une arete de FCX, oegFCXF=O.T. de EG dans FCX orientee FORWARD | |
1170 | // EG a des aretes 3d same domain : le3 | |
1171 | ||
1172 | TopAbs_State staFCX = staFS; // FS et FCX connexes par EG => meme shape origine => meme etat | |
1173 | Standard_Boolean b3d = Standard_False; Standard_Boolean b2d = Standard_False; | |
1174 | ||
1175 | // staFOR : etat demande sur FOR | |
1176 | Standard_Boolean b3de3 = Standard_False; Standard_Boolean b2de3 = Standard_False; | |
1177 | ||
1178 | const TopoDS_Edge& e3 = TopoDS::Edge(le3.First()); Standard_Integer ie3 = BDS.Shape(e3); | |
1179 | Standard_Boolean ssif = Standard_False; Handle(TopOpeBRepDS_ShapeShapeInterference) ssie3; | |
1180 | TopOpeBRepDS_ListIteratorOfListOfInterference itssi(BDS.ShapeInterferences(FCX)); | |
1181 | for (;itssi.More();itssi.Next()) { | |
1182 | const Handle(TopOpeBRepDS_ShapeShapeInterference)& ssi = Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(itssi.Value()); if (ssi.IsNull()) continue; | |
1183 | TopOpeBRepDS_Kind GT1,ST1; Standard_Integer G1,S1; FDS_data(ssi,GT1,G1,ST1,S1); | |
1184 | Standard_Boolean cond = (GT1 == TopOpeBRepDS_EDGE && ST1 == TopOpeBRepDS_FACE); | |
1185 | cond = cond && (G1 == ie3); | |
1186 | // NYI cond = cond && e(S1 est une face connexe a iFOR par ie3) | |
1187 | if (cond) { ssif = Standard_True; ssie3 = ssi; break; } | |
1188 | } | |
1189 | ||
1190 | TopOpeBRepDS_Transition TFEe3; TopAbs_State TFEe3bef = TFEe3.Before(); TopAbs_State TFEe3aft = TFEe3.After(); | |
96a95605 | 1191 | TopAbs_Orientation oe3FORF = TopAbs_FORWARD; |
7fd59977 | 1192 | if (ssif) { |
1193 | TFEe3 = ssie3->Transition(); | |
1194 | TFEe3bef = TFEe3.Before(); | |
96a95605 | 1195 | FUN_tool_orientEinFFORWARD(e3,FOR,oe3FORF); |
7fd59977 | 1196 | } |
1197 | ||
1198 | if (FFinSDSO) { | |
1199 | if ( oFOR != oFCX ) { | |
1200 | oegFCXF = TopAbs::Complement(oegFCXF); | |
1201 | oe3FORF = TopAbs::Complement(oe3FORF); | |
1202 | } | |
1203 | TopOpeBRepDS_Transition T1(oegFCXF); TopAbs_State T1aft = T1.After(); TopAbs_State T1bef = T1.Before(); | |
1204 | if (oegFCXF == TopAbs_FORWARD) b3d = (TFEaft == staFCX); | |
1205 | else if (oegFCXF == TopAbs_REVERSED) b3d = (TFEbef == staFCX); | |
1206 | else FUN_coutmess("DEBUG GFillONPartsWES2_1 orientation != F,R\n"); | |
1207 | if (oegFCXF == TopAbs_FORWARD) b2d = (T1aft == TopAbs_IN); | |
1208 | else if (oegFCXF == TopAbs_REVERSED) b2d = (T1bef == TopAbs_IN); | |
1209 | else FUN_coutmess("DEBUG GFillONPartsWES2_2 orientation != F,R\n"); | |
1210 | ||
1211 | if (ssif) { | |
1212 | TopOpeBRepDS_Transition T11(oe3FORF); TopAbs_State T11aft = T11.After(); TopAbs_State T11bef = T11.Before(); | |
1213 | if (oe3FORF == TopAbs_FORWARD) b3de3 = (TFEe3aft == staFOR); | |
1214 | else if (oe3FORF == TopAbs_REVERSED) b3de3 = (TFEe3bef == staFOR); | |
1215 | else FUN_coutmess("DEBUG GFillONPartsWES2_1 orientation != F,R\n"); | |
1216 | if (oe3FORF == TopAbs_FORWARD) b2de3 = (T11aft == TopAbs_IN); | |
1217 | else if (oe3FORF == TopAbs_REVERSED) b2de3 = (T11bef == TopAbs_IN); | |
1218 | else FUN_coutmess("DEBUG GFillONPartsWES2_2 orientation != F,R\n"); | |
1219 | } | |
1220 | } | |
1221 | ||
1222 | if (FFinSDDO) { | |
1223 | if ( oFOR == oFCX ) { | |
1224 | oegFCXF = TopAbs::Complement(oegFCXF); | |
1225 | oe3FORF = TopAbs::Complement(oe3FORF); | |
1226 | } | |
1227 | TopOpeBRepDS_Transition T2(oegFCXF); TopAbs_State Taft = T2.After(); TopAbs_State Tbef = T2.Before(); | |
1228 | if (oegFCXF == TopAbs_FORWARD) b3d = (TFEaft == staFCX); | |
1229 | else if (oegFCXF == TopAbs_REVERSED) b3d = (TFEbef == staFCX); | |
1230 | else FUN_coutmess("DEBUG GFillONPartsWES2_3 orientation != F,R\n"); | |
1231 | if (oegFCXF == TopAbs_FORWARD) b2d = (Taft == TopAbs_IN); | |
1232 | else if (oegFCXF == TopAbs_REVERSED) b2d = (Tbef == TopAbs_IN); | |
1233 | else FUN_coutmess("DEBUG GFillONPartsWES2_4 orientation != F,R\n"); | |
1234 | ||
1235 | if (ssif) { | |
1236 | TopOpeBRepDS_Transition T22(oe3FORF); TopAbs_State T22aft = T22.After(); TopAbs_State T22bef = T22.Before(); | |
1237 | if (oe3FORF == TopAbs_FORWARD) b3de3 = (TFEe3aft == staFOR); | |
1238 | else if (oe3FORF == TopAbs_REVERSED) b3de3 = (TFEe3bef == staFOR); | |
1239 | else FUN_coutmess("DEBUG GFillONPartsWES2_3 orientation != F,R\n"); | |
1240 | if (oe3FORF == TopAbs_FORWARD) b2de3 = (T22aft == TopAbs_IN); | |
1241 | else if (oe3FORF == TopAbs_REVERSED) b2de3 = (T22bef == TopAbs_IN); | |
1242 | else FUN_coutmess("DEBUG GFillONPartsWES2_4 orientation != F,R\n"); | |
1243 | } | |
1244 | } | |
1245 | ||
1246 | Standard_Boolean b = (b3d && b2d && b3de3 && b2de3); | |
1247 | if (!b) return; | |
1248 | ||
1249 | // on garde EspON pour la reconstruction de la face FOR | |
1250 | // si elle est IN/ON la face FOR (EGBoundFOR = 0 ==> projection) | |
1251 | TopOpeBRepTool_ShapeClassifier& PSC = FSC_GetPSC(FOR); | |
1252 | TopAbs_State state2d = FSC_StateEonFace(EspON,0.345,FOR,PSC); | |
1253 | Standard_Boolean isin = (state2d == TopAbs_IN); | |
1254 | if (!isin) return; | |
1255 | ||
1256 | TopAbs_State TBEG = TB1; | |
1257 | TopAbs_Orientation neworiE = TFE.Orientation(TBEG); | |
1258 | ||
1259 | // if (FCXisref && FFinSDDO) { | |
1260 | if (FCXisref && !EGBoundFOR) { | |
1261 | FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); | |
1262 | Standard_Boolean rev = myPB->Reverse(staFCX,staFOR); | |
1263 | neworiE = myPB->Orient(neworiE,rev); | |
1264 | } | |
1265 | // xpu280798 : never occurs as yap1 -> !EGBoundFOR | |
1266 | // else if (FORisref && EGBoundFOR) { | |
1267 | // FUN_tool_orientEinFFORWARD(EG,FOR,neworiE); | |
1268 | // Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); | |
1269 | // neworiE = myPB->Orient(neworiE,rev); | |
1270 | // } | |
1271 | else if (FORisref && !EGBoundFOR) { | |
1272 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); | |
1273 | FUN_tool_orientEinFFORWARD(Esd,TopoDS::Face(FOR),neworiE); | |
1274 | Standard_Boolean reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd); | |
1275 | if (reverse) neworiE = TopAbs::Complement(neworiE); | |
1276 | Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); | |
1277 | neworiE = myPB->Orient(neworiE,rev); | |
1278 | } | |
1279 | else if (!EGBoundFOR) { // xpu210898 | |
1280 | Standard_Integer rankrefFOR = BDS.AncestorRank(irefFOR); | |
1281 | if (rankrefFOR == rankFCX) | |
1282 | FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); | |
1283 | else if (rankrefFOR == rankFOR) { | |
1284 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); | |
1285 | FUN_tool_orientEinFFORWARD(Esd,TopoDS::Face(FOR),neworiE); | |
1286 | Standard_Boolean reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd); | |
1287 | if (reverse) neworiE = TopAbs::Complement(neworiE); | |
1288 | } | |
1289 | Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); | |
1290 | neworiE = myPB->Orient(neworiE,rev); | |
1291 | } | |
1292 | ||
1293 | TopoDS_Shape newE = EspON; | |
1294 | newE.Orientation(neworiE); | |
1295 | ||
0797d9d3 | 1296 | #ifdef OCCT_DEBUG |
7fd59977 | 1297 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap1 GFillON","WES+ EspON "); |
1298 | if (tE) FUN_cout(newE); | |
1299 | #endif | |
1300 | myPWES->AddStartElement(newE); | |
1301 | ||
1302 | return; | |
1303 | } // yap1 | |
1304 | ||
1305 | //========================================= | |
1306 | if ( yap2 ) { | |
0797d9d3 | 1307 | #ifdef OCCT_DEBUG |
7fd59977 | 1308 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap2 GFillON"); |
1309 | if (tE) {cout<<"yap2(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1310 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1311 | #endif | |
1312 | ||
1313 | // FF est samedomain avec FCX | |
1314 | // on evalue la transition de FOR par rapport a la matiere 2d de la face FCX | |
1315 | // au lieu de la transition par rapport a la matiere 3d de la face FS | |
1316 | // EG est une arete de FCX, oegFCXF=O.T. de EG dans FCX orientee FORWARD | |
1317 | ||
1318 | TopAbs_State staFCX = staFS; // FS et FCX connexes par EG => meme shape origine => meme etat | |
1319 | Standard_Boolean b3d = Standard_False; Standard_Boolean b2d = Standard_False; | |
1320 | Standard_Boolean b = (b3d && b2d); | |
1321 | ||
1322 | if (FFinSDSO) { | |
1323 | if ( oFOR != oFCX ) { | |
1324 | // orientation topologique de EG dans la face mere | |
1325 | oegFCXF = TopAbs::Complement(oegFCXF); | |
1326 | } | |
1327 | TopOpeBRepDS_Transition T1(oegFCXF); TopAbs_State Taft = T1.After(); TopAbs_State Tbef = T1.Before(); | |
1328 | if (oegFCXF == TopAbs_FORWARD) b3d = (TFEaft == staFCX); | |
1329 | else if (oegFCXF == TopAbs_REVERSED) b3d = (TFEbef == staFCX); | |
1330 | else FUN_coutmess("DEBUG GFillONPartsWES2_1 orientation != F,R\n"); | |
1331 | if (oegFCXF == TopAbs_FORWARD) b2d = (Taft == TopAbs_IN); | |
1332 | else if (oegFCXF == TopAbs_REVERSED) b2d = (Tbef == TopAbs_IN); | |
1333 | else FUN_coutmess("DEBUG GFillONPartsWES2_2 orientation != F,R\n"); | |
1334 | } | |
1335 | if (FFinSDDO) { | |
1336 | if ( oFOR == oFCX ) { | |
1337 | // orientation topologique de EG dans la face mere | |
1338 | oegFCXF = TopAbs::Complement(oegFCXF); | |
1339 | } | |
1340 | TopOpeBRepDS_Transition T2(oegFCXF); TopAbs_State Taft = T2.After(); TopAbs_State Tbef = T2.Before(); | |
1341 | if (oegFCXF == TopAbs_FORWARD) b3d = (TFEaft == staFCX); | |
1342 | else if (oegFCXF == TopAbs_REVERSED) b3d = (TFEbef == staFCX); | |
1343 | else FUN_coutmess("DEBUG GFillONPartsWES2_3 orientation != F,R\n"); | |
1344 | if (oegFCXF == TopAbs_FORWARD) b2d = (Taft == TopAbs_IN); | |
1345 | else if (oegFCXF == TopAbs_REVERSED) b2d = (Tbef == TopAbs_IN); | |
1346 | else FUN_coutmess("DEBUG GFillONPartsWES2_4 orientation != F,R\n"); | |
1347 | } | |
0797d9d3 | 1348 | //#ifdef OCCT_DEBUG |
7fd59977 | 1349 | // if(tEFOR) {cout<<endl<<"yap2 : b3d,b2d "<<b3d<<","<<b2d<<endl;debfillonfemess(iFOR,iEG);} |
1350 | //#endif | |
1351 | ||
1352 | // bcl1;bcl2; c12;tsp(f9),tspON(e7) | |
1353 | if (ComOfCut) {b3d=Standard_True; b2d=Standard_True;} //xpu200598 | |
1354 | ||
1355 | gp_Vec ngFS,ngFOR; | |
1d47d8d0 | 1356 | Standard_Real parEG = 0.; |
7fd59977 | 1357 | // bcl1;bcl2; tsp(f9),tspON(e7) |
1358 | Standard_Boolean sdm = FUN_ds_sdm(BDS,BDS.Shape(iFOR),BDS.Shape(iFS)); | |
1359 | Standard_Boolean isfafa = sdm; // such interferences are computed IN fafa case | |
1360 | if (!isfafa ) { | |
1361 | // parEG : | |
1362 | Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
1363 | if (!ok) return; | |
1364 | // xxFS : | |
1365 | gp_Pnt2d uvFS; ok = FUN_tool_parF(EG,parEG,FS,uvFS,tolFS); | |
1366 | if (!ok) return;// nyiRAISE | |
1367 | ngFS = FUN_tool_nggeomF(uvFS,FS); | |
1368 | gp_Dir xxFS; ok = FUN_tool_getxx(FS,EG,parEG,ngFS,xxFS); | |
1369 | if (!ok) return;// nyiRAISE | |
1370 | // ntFOR : | |
1371 | gp_Pnt2d uvFOR; ok = FUN_tool_parF(EG,parEG,FOR,uvFOR,tolFOR); | |
1372 | if (!ok) return;// nyiRAISE | |
1373 | ngFOR = FUN_tool_nggeomF(uvFOR,FOR); | |
1374 | gp_Dir ntFOR(ngFOR); if (M_REVERSED(oFOR)) ntFOR.Reverse(); | |
1375 | ||
1376 | Standard_Real dot = xxFS.Dot(ntFOR); | |
1377 | //xpu040698 : FS tg to FCX at EG - CTS20578 (FOR=F8,EG=E6,FS=F4) - | |
1378 | Standard_Boolean nulldot = (Abs(dot) < tola); | |
1379 | if (nulldot) { // approximate xxFS : | |
1380 | gp_Pnt2d newuvFS; | |
1381 | gp_Vec2d dxx; ok = FUN_tool_getdxx(FS,EG,parEG,dxx); | |
1382 | if (!ok) return; | |
1383 | newuvFS = uvFS.Translated(dxx * 0.25); | |
1384 | gp_Dir newngFS = FUN_tool_nggeomF(newuvFS,FS); | |
1385 | ok = FUN_tool_getxx(FS,EG,parEG,newngFS,xxFS); | |
1386 | if (!ok) return; | |
1387 | dot = xxFS.Dot(ntFOR); | |
1388 | } | |
1389 | //xpu040698 | |
1390 | ||
1391 | TopAbs_State TBFS = FUN_build_TB(myPB,rankFS); | |
1392 | Standard_Boolean positive = (dot > 0); | |
1393 | ||
1394 | Standard_Boolean keep = Standard_True; | |
1395 | if (FFinSDSO) { | |
1396 | if (opeFus) keep = positive; //xpu090698 : PRO14033 (iFOR=15,GI=10,iFS=9) | |
1397 | if (opeCom) keep = Standard_True; | |
1398 | if (opeCut) { | |
1399 | if (positive) keep = (TBFS == TopAbs_OUT); //xpu230698 cto100G1 | |
1400 | else keep = (TBFS == TopAbs_IN); | |
1401 | } | |
1402 | } | |
1403 | if (FFinSDDO) { | |
1404 | if (opeFus) { | |
1405 | keep = positive; | |
1406 | //xpu050698 : (fuse = OU/IN + IN/OU) -CTS20578- | |
1407 | if (keep) { | |
1408 | Standard_Integer rkOU = (TB1 == TopAbs_OUT) ? 1 : 2; | |
1409 | Standard_Integer rkfspOU = (rankFOR == rkOU) ? 1 : 2; | |
1410 | Standard_Boolean spOUFOR = (rankFOR == rkfspOU); | |
1411 | keep = spOUFOR; | |
1412 | } | |
1413 | } | |
1414 | if (opeCom) keep = !positive; | |
1415 | if (opeCut) { | |
1416 | Standard_Boolean FORmoinsFS = (TBFS == TopAbs_IN); | |
1417 | if (positive) { | |
1418 | if (FORmoinsFS) keep = Standard_True; | |
1419 | else keep = ComOfCut; | |
1420 | // if (TBFS == TopAbs_OUT) keep = Standard_True; | |
1421 | // else keep = (rankFS == 1); | |
1422 | } | |
1423 | else { | |
1424 | // keep = !FORmoinsFS; // xpu230698 : cto100A1 | |
1425 | // keep = Standard_False; | |
1426 | if (!FORmoinsFS) keep = Standard_True; // xpu230698 : cto100A1 | |
1427 | else keep = ComOfCut; //xpu120898 PRO12859 (FOR26,FS12,FCX18,EG14) | |
1428 | } | |
1429 | } | |
1430 | } | |
0797d9d3 | 1431 | //#ifdef OCCT_DEBUG |
7fd59977 | 1432 | // if(tEFOR) {cout<<endl<<"yap2 : keep "<<keep<<endl;debfillonfemess(iFOR,iEG);} |
1433 | //#endif | |
1434 | if (!keep) return; | |
1435 | } // !isfafa | |
1436 | else { | |
1437 | if (!b) return; | |
1438 | } | |
1439 | ||
1440 | // on garde EspON pour la reconstruction de la face FOR | |
1441 | // si elle est IN/ON la face FOR (EGBoundFOR = 0 ==> projection) | |
1442 | TopOpeBRepTool_ShapeClassifier& PSC = FSC_GetPSC(FOR); | |
1443 | TopAbs_State state2d = FSC_StateEonFace(EspON,0.345,FOR,PSC); | |
1444 | Standard_Boolean isin = (state2d == TopAbs_IN); | |
1445 | if (!isin) return; | |
1446 | ||
1447 | TopAbs_State TBEG = TB1; | |
1448 | TopAbs_Orientation neworiE = TFE.Orientation(TBEG); | |
1449 | ||
1450 | FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); | |
1451 | Standard_Boolean forw=M_FORWARD(neworiE), reve=M_REVERSED(neworiE); | |
1452 | Standard_Boolean ok = forw || reve; | |
1453 | if (FFinSDSO && ok) { | |
1454 | if (opeCut) { | |
1455 | neworiE = TopAbs::Complement(neworiE); | |
1456 | } | |
1457 | } // FFinSDSO && ok | |
1458 | ||
1459 | // bcl1;bcl2; tsp(f9) | |
1460 | if (FFinSDDO && ok) { | |
1461 | if (opeCut) { | |
1462 | if (!ComOfCut) { | |
1463 | // TopAbs_State TBEG = (rankEG == 1)? TB1 : TB2; | |
1464 | // if (TBEG == TopAbs_IN) neworiE = TopAbs::Complement(neworiE); | |
1465 | neworiE = TopAbs::Complement(neworiE); // xpu270898 : cto905E2 (FOR33,FCX16,EG19) | |
1466 | } | |
1467 | else if (ComOfCut) { | |
1468 | // rien a faire | |
1469 | } | |
1470 | } | |
1471 | if (opeFus) { | |
1472 | // en principe , l'operation locale est tjrs = OUT,IN | |
1473 | neworiE = TopAbs::Complement(neworiE); | |
1474 | } | |
1475 | if (opeCom) { | |
1476 | // SDDO et oT anti// => oG // | |
1477 | // xxFCX : | |
1478 | gp_Dir xxFCX; ok = FUN_tool_getxx(FCX,EG,parEG,xxFCX); | |
1479 | if (!ok) return;// nyiRAISE | |
1480 | // ntFS : | |
1481 | gp_Dir ntFS(ngFS); | |
1482 | if (M_REVERSED(oFS)) ntFS.Reverse(); | |
1483 | ||
1484 | Standard_Real dot = xxFCX.Dot(ntFS); | |
1485 | Standard_Boolean toreverse = (dot > 0); | |
1486 | ||
1487 | if (toreverse) neworiE = TopAbs::Complement(neworiE); | |
1488 | } | |
1489 | } // FFinSDDO && ok | |
1490 | ||
1491 | Standard_Boolean reverse = Standard_False; //xpu270598 : reverse=false=>FCX has same geom ori | |
1492 | if (!FCXisref) { //xpu270598 | |
1493 | if (cFCX == TopOpeBRepDS_DIFFORIENTED) reverse = Standard_True; | |
1494 | if (oFCX != orefFCX) reverse = !reverse; | |
1495 | } //xpu270598 | |
1496 | if (reverse) neworiE = TopAbs::Complement(neworiE); // xpu270598 | |
1497 | ||
1498 | TopoDS_Shape newE = EspON; | |
1499 | newE.Orientation(neworiE); | |
1500 | ||
0797d9d3 | 1501 | #ifdef OCCT_DEBUG |
7fd59977 | 1502 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap2 GFillON","WES+ EspON "); |
1503 | if (tE) FUN_cout(newE); | |
1504 | #endif | |
1505 | myPWES->AddStartElement(newE); | |
1506 | ||
1507 | return; | |
1508 | } // yap2 | |
1509 | ||
1510 | //========================================= | |
1511 | if ( yap6 ) { | |
0797d9d3 | 1512 | #ifdef OCCT_DEBUG |
7fd59977 | 1513 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap6 GFillON"); |
1514 | if (tE) {cout<<"yap6(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1515 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1516 | #endif | |
1517 | TopAbs_Orientation neworiE; | |
1518 | // FF est samedomain avec FCX | |
1519 | // on evalue la transition de FOR par rapport a la matiere 2d de la face FCX | |
1520 | // au lieu de la transition par rapport a la matiere 3d de la face FS | |
1521 | // EG est une arete de FCX, oegFCXF=O.T. de EG dans FCX orientee FORWARD | |
1522 | ||
1523 | TopAbs_State staFCX = staFS; // FS et FCX connexes par EG => meme shape origine => meme etat | |
1524 | Standard_Boolean b3d = Standard_False; Standard_Boolean b2d = Standard_False; | |
1525 | Standard_Boolean b = Standard_False; | |
1526 | ||
1527 | Standard_Boolean SO = FFinSDSO;//(FFinSDSO && (oFOR == oFCX)) || (FFinSDDO && (oFOR != oFCX)); | |
1528 | Standard_Boolean DO = FFinSDDO;//(FFinSDSO && (oFOR != oFCX)) || (FFinSDDO && (oFOR == oFCX)); | |
1529 | ||
0797d9d3 | 1530 | #ifdef OCCT_DEBUG |
7fd59977 | 1531 | // Standard_Integer rkToFill = BDS.AncestorRank(myFace); |
1532 | #endif | |
1533 | // Standard_Boolean samerk = (rankEG == rkToFill); | |
1534 | ||
1535 | // TopAbs_Orientation oegFOR; | |
1536 | Standard_Boolean shareG; | |
1537 | Standard_Boolean ok = FUN_ds_shareG(myPB->DataStructure(),iFOR,iFCX,GI, | |
1538 | TopoDS::Edge(EspON),shareG); | |
1539 | if (!ok) return; // nyiFUNRAISE | |
1540 | ||
1541 | if (SO) { | |
1542 | // FOR and FCX share geometric domain. | |
1543 | Standard_Boolean forcekeep = opeFus && shareG && (rankEG ==1); // newnew | |
1544 | ||
1545 | if (opeFus) { | |
1546 | // b = shareG; | |
1547 | // xpu231198 :PRO15946 (FOR11,EG24,FCX20) | |
1548 | // xpu090299 (JAP60247, FOR6,FCX33,EG34) | |
1549 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); | |
1550 | TopTools_ListOfShape lfor; FDSCNX_FaceEdgeConnexFaces(FOR,Esd,HDS,lfor); | |
1551 | Standard_Integer nfor = lfor.Extent(); | |
1552 | if (nfor < 1) b = shareG; //Esd is FOR's closing edge | |
1553 | else if (nfor > 1) return;//NYIRaise (unvalid shape) | |
1554 | else { | |
1555 | const TopoDS_Face& FF = TopoDS::Face(lfor.First()); | |
1556 | Standard_Real tola1 = Precision::Angular()*1.e2;//nyitolxpu | |
1557 | Standard_Real parEG; Standard_Boolean ok1 = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
1558 | if (!ok1) return; | |
1559 | Standard_Real matfs; ok1 = TopOpeBRepTool_TOOL::Matter(FS,FCX,EG,parEG,tola1,matfs); | |
1560 | if (!ok1) return; | |
1561 | ||
1562 | Standard_Real tolEsd = BRep_Tool::Tolerance(Esd)*factor; //NYITOLXPU | |
1563 | Standard_Real parEsd; Standard_Boolean ok2 = FUN_tool_parE(eON,parON,Esd,parEsd,tolEsd); | |
1564 | if (!ok2) return; | |
1565 | Standard_Real matfor; ok2 = TopOpeBRepTool_TOOL::Matter(FOR,FF,Esd,parEsd,tola1,matfor); | |
1566 | if (!ok2) return; | |
1567 | ||
1568 | Standard_Real sum = matfs+matfor; | |
c6541a0c D |
1569 | Standard_Boolean sumisPI = (Abs(sum-M_PI) < tola1); |
1570 | Standard_Boolean fsinfPI = (matfs < M_PI); | |
1571 | Standard_Boolean forinfPI = (matfor < M_PI); | |
7fd59977 | 1572 | if (sumisPI) b = Standard_False; |
c6541a0c D |
1573 | else if (sum < M_PI) b = Standard_True; |
1574 | else { //sum > M_PI | |
7fd59977 | 1575 | if (fsinfPI && forinfPI) b = Standard_False; |
1576 | else { // (!fsinfPI) || (!forinfPI) | |
1577 | Standard_Boolean sammat = (Abs(matfs-matfor)<tola1); | |
1578 | if (sammat) b = Standard_False; | |
1579 | else b = (matfs < matfor); | |
1580 | } | |
1581 | } | |
1582 | if (b) forcekeep = Standard_True; | |
1583 | } | |
1584 | // NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYIXPU | |
1585 | /*if (shareG) b = Standard_True; | |
1586 | else { | |
1587 | // xpu231198 :PRO15946 (FOR11,EG24,FCX20) | |
1588 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
1589 | if (!ok) return; | |
1590 | gp_Dir xxFCX; ok = FUN_tool_getxx(FCX,EG,parEG,xxFCX); | |
1591 | if (!ok) return;// nyiRAISE | |
1592 | gp_Vec ntFS; ok = FUN_tool_nggeomF(parEG,EG,FS,ntFS,tolFS); | |
1593 | if (!ok) return;// nyiRAISE | |
1594 | if (M_REVERSED(oFS)) ntFS.Reverse(); | |
1595 | ||
1596 | Standard_Real dot = ntFS.Dot(xxFCX); | |
1597 | if (Abs(dot) < tola) b = Standard_False; // xpu231198nyi tangent config | |
1598 | else {b = (dot <0.); if (b) forcekeep=Standard_True;} | |
1599 | }//!shareG*/ | |
1600 | } | |
1601 | else if (opeCut) b = (!shareG); | |
1602 | else if (opeCom) b = shareG && (rankEG ==1); | |
1603 | if (b) { // nyi : a revoir | |
1604 | if ( oFOR != oFCX ) { | |
1605 | // orientation topologique de EG dans la face mere | |
1606 | oegFCXF = TopAbs::Complement(oegFCXF); | |
1607 | } | |
1608 | TopOpeBRepDS_Transition T1(oegFCXF); TopAbs_State Taft = T1.After(); TopAbs_State Tbef = T1.Before(); | |
1609 | if (oegFCXF == TopAbs_FORWARD) b3d = (TFEaft == staFCX); | |
1610 | else if (oegFCXF == TopAbs_REVERSED) b3d = (TFEbef == staFCX); | |
1611 | if (oegFCXF == TopAbs_FORWARD) b2d = (Taft == TopAbs_IN); | |
1612 | else if (oegFCXF == TopAbs_REVERSED) b2d = (Tbef == TopAbs_IN); | |
1613 | b = (b3d && b2d); | |
1614 | } | |
1615 | if (forcekeep) b = Standard_True; // newnew | |
1616 | } | |
1617 | if (DO) { // we do NOT keep the splitON | |
1618 | if (opeFus) b = (!shareG); // cto001D2 spOU(f18) | |
1619 | if (opeCut) { | |
1620 | Standard_Integer rankREF = opec12? 1 : 2; | |
1621 | Standard_Boolean binin=Standard_False, binou=Standard_False; | |
1622 | if (TB1 == TB2) binin = (rankEG == rankREF); // partie IN/IN | |
1623 | else { | |
1624 | //xpu291098 cto001D3 (f17ou) | |
1625 | binou = (rankFOR == 1)&&(TBFOR == TopAbs_OUT)&&(!shareG); | |
1626 | if (binou) { | |
1627 | // xpu181198 CTS21302(FOR22,EG9,FCX5) | |
1628 | // ntOOFOR : | |
1629 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); // rkEsd=rkFOR | |
1630 | TopTools_ListOfShape lfcFk; FDSCNX_FaceEdgeConnexFaces(FOR,Esd,HDS,lfcFk); | |
1631 | if (lfcFk.Extent() != 1) return; // shape bizarre | |
1632 | Standard_Real parEsd; ok = FUN_tool_parE(eON,parON,Esd,parEsd,tolEG); | |
1633 | if (!ok) return; | |
1634 | const TopoDS_Face& OOFOR = TopoDS::Face(lfcFk.First()); | |
1635 | gp_Pnt2d uv; Standard_Real dummy=0; | |
1636 | ok = FUN_tool_paronEF(Esd,parEsd,OOFOR,uv,dummy); //rkEsd=rkOOFOR | |
1637 | gp_Vec ntOOFOR = FUN_tool_nggeomF(uv,OOFOR); | |
1638 | if (OOFOR.Orientation() == TopAbs_REVERSED) ntOOFOR.Reverse(); | |
1639 | // xxFCX : | |
0797d9d3 | 1640 | #ifdef OCCT_DEBUG |
7fd59977 | 1641 | // Standard_Real t1 =factor*BRep_Tool::Tolerance(Esd); |
1642 | #endif | |
1643 | Standard_Real parEG; ok = FUN_tool_parE(Esd,parEsd,EG,parEG); | |
1644 | if (!ok) return; | |
1645 | gp_Dir xxFCX; ok = FUN_tool_getxx(FCX,EG,parEG,xxFCX); | |
1646 | if (!ok) return; | |
1647 | // dot : | |
1648 | Standard_Real dot = ntOOFOR.Dot(xxFCX); | |
1649 | if (Abs(dot) < tola) binou = Standard_True;// nyixpu181198 | |
1650 | else if (dot < 0.) binou = Standard_False; | |
1651 | } | |
1652 | } | |
1653 | b = binin || binou; | |
1654 | } | |
1655 | } | |
1656 | if (!b) return; | |
1657 | ||
1658 | TopAbs_State TBEG = TB1; | |
1659 | neworiE = TFE.Orientation(TBEG); | |
1660 | if (FCXisref && !EGBoundFOR) { | |
1661 | FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); | |
1662 | Standard_Boolean rev = myPB->Reverse(staFCX,staFOR); | |
1663 | neworiE = myPB->Orient(neworiE,rev); | |
1664 | } | |
1665 | else if (FORisref && !EGBoundFOR) { | |
1666 | // xpu280798 : cto902C1 (FOR=f9,FCX=f19,FS,f33,EG,e18) | |
1667 | // as eghassdON : Esd = edge(Iesd) = bound FOR; eON is IN1d(Esd) | |
1668 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); | |
1669 | FUN_tool_orientEinFFORWARD(Esd,TopoDS::Face(FOR),neworiE); | |
1670 | Standard_Boolean reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd); | |
1671 | if (reverse) neworiE = TopAbs::Complement(neworiE); | |
1672 | Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); | |
1673 | neworiE = myPB->Orient(neworiE,rev); | |
1674 | } | |
1675 | else if (!EGBoundFOR) { | |
1676 | // xpu210898 : CTS20875 : yap6(FOR13,GI15,FCX6), !FCXisref && !FORisref | |
1677 | Standard_Integer rankrefFOR = BDS.AncestorRank(irefFOR); | |
1678 | if (rankrefFOR == rankFCX) | |
1679 | FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); | |
1680 | else if (rankrefFOR == rankFOR) { | |
1681 | const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); | |
1682 | FUN_tool_orientEinFFORWARD(Esd,TopoDS::Face(FOR),neworiE); | |
1683 | Standard_Boolean reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd); | |
1684 | if (reverse) neworiE = TopAbs::Complement(neworiE); | |
1685 | } | |
1686 | Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); | |
1687 | neworiE = myPB->Orient(neworiE,rev); | |
1688 | } | |
1689 | ||
1690 | TopoDS_Shape newE = EspON; | |
1691 | newE.Orientation(neworiE); | |
0797d9d3 | 1692 | #ifdef OCCT_DEBUG |
7fd59977 | 1693 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap6 GFillON","WES+ EspON "); |
1694 | if (tE) FUN_cout(newE); | |
1695 | #endif | |
1696 | myPWES->AddStartElement(newE); | |
1697 | ||
1698 | // xpu290798 : cto 902 C1, f9ou,f19in, spON(e7) = spON(e18) | |
1699 | // splits IN and OUT generated on reference surface should be diff oriented | |
1700 | // they share same edge eON which is FORWARD in one, REVERSED in the other | |
1701 | Standard_Boolean addtwice = SO && !shareG && opeCut; | |
1702 | addtwice = addtwice && (M_FORWARD(neworiE) || M_REVERSED(neworiE)); | |
1703 | if (addtwice) { | |
1704 | // we have splitIN | |
1705 | TopoDS_Shape FtospIN = (TBFOR == TopAbs_IN) ? FOR : FCX; | |
1706 | addtwice = Standard_False; | |
1707 | TopExp_Explorer ex; | |
1708 | for (ex.Init(FtospIN,TopAbs_EDGE); ex.More(); ex.Next()){ | |
1709 | // for (TopExp_Explorer ex(FtospIN,TopAbs_EDGE); ex.More(); ex.Next()){ | |
1710 | const TopoDS_Shape& ee = ex.Current(); | |
1711 | if (!BDS.HasShape(ee)) continue; | |
1712 | Standard_Boolean issp = myPB->IsSplit(ee,TopAbs_IN); | |
1713 | if (issp) addtwice = !myPB->Splits(ee,TopAbs_IN).IsEmpty(); | |
1714 | if (addtwice) break; | |
1715 | } | |
1716 | } | |
1717 | if (addtwice) { | |
1718 | neworiE = TopAbs::Complement(neworiE); | |
1719 | newE.Orientation(neworiE); | |
0797d9d3 | 1720 | #ifdef OCCT_DEBUG |
7fd59977 | 1721 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap6 GFillON","WES+ EspON "); |
1722 | if (tE) FUN_cout(newE); | |
1723 | #endif | |
1724 | myPWES->AddStartElement(newE); | |
1725 | } | |
1726 | return; | |
1727 | } // yap6 | |
1728 | ||
1729 | //========================================= | |
1730 | if ( yap3 ) { | |
0797d9d3 | 1731 | #ifdef OCCT_DEBUG |
7fd59977 | 1732 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap3 GFillON"); |
1733 | if (tE) {cout<<"yap3(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1734 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1735 | #endif | |
1736 | ||
1737 | ie3d = ::FUN_findeSD(BDS,eON,EG,FOR,oe3d,3); | |
1738 | if (ie3d == 0) return; | |
1739 | const TopoDS_Edge& e3d = TopoDS::Edge(BDS.Shape(ie3d)); | |
1740 | ||
1741 | TopOpeBRepDS_Config cf; Standard_Boolean cfok = FDS_Config3d(EspON,e3d,cf); | |
1742 | if (!cfok) return; | |
1743 | ||
1744 | TopAbs_Orientation oe3dk = oe3d; | |
1745 | // Standard_Boolean samegeom = ::TopOpeBRepBuild_FUN_aresamegeom(EG,e3d); | |
1746 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
1747 | if (!ok) return; //nyiRAISE | |
1748 | Standard_Boolean samegeom; ok = FUN_tool_curvesSO(EG,parEG,e3d,samegeom); | |
1749 | if (!ok) return; //nyiRAISE | |
0797d9d3 | 1750 | #ifdef OCCT_DEBUG |
7fd59977 | 1751 | if (!TopOpeBRepBuild_GetcontextNOSG()) { |
1752 | #endif | |
1753 | if (!samegeom) oe3dk = TopAbs::Complement(oe3dk); | |
0797d9d3 | 1754 | #ifdef OCCT_DEBUG |
7fd59977 | 1755 | } |
1756 | #endif | |
1757 | ||
1758 | Standard_Boolean keep3d = Standard_False; | |
1759 | // l'etat a construire sur FOR est TB1, | |
1760 | if (oe3dk == TopAbs_FORWARD) keep3d = (TFEaft == TB1); | |
1761 | else if (oe3dk == TopAbs_REVERSED) keep3d = (TFEbef == TB1); | |
1762 | else if (oe3dk == TopAbs_INTERNAL) keep3d = Standard_True; | |
1763 | else if (oe3dk == TopAbs_EXTERNAL) keep3d = Standard_False; | |
1764 | ||
0797d9d3 | 1765 | #ifdef OCCT_DEBUG |
7fd59977 | 1766 | if(tEFOR) {cout<<endl<<"yap3 keep3d : "<<keep3d<<endl;debfillonfemess3d(iFOR,iEG);} |
1767 | #endif | |
1768 | ||
1769 | if (keep3d) { | |
1770 | TopAbs_Orientation neworiE = oe3d; | |
1771 | if (cf == TopOpeBRepDS_DIFFORIENTED) neworiE = TopAbs::Complement(neworiE); | |
1772 | TopoDS_Shape newE = EspON; | |
1773 | newE.Orientation(neworiE); | |
1774 | ||
0797d9d3 | 1775 | #ifdef OCCT_DEBUG |
7fd59977 | 1776 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap3 GFillON","WES+ EspON "); |
1777 | if (tE) FUN_cout(newE); | |
1778 | #endif | |
1779 | myPWES->AddStartElement(newE); | |
1780 | } | |
1781 | ||
1782 | return; | |
1783 | } // yap3 | |
1784 | ||
1785 | //========================================= | |
1786 | if ( yap5 ) { | |
0797d9d3 | 1787 | #ifdef OCCT_DEBUG |
7fd59977 | 1788 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap5 GFillON"); |
1789 | if (tE) {cout<<"yap5(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1790 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1791 | #endif | |
1792 | ie2d = ::FUN_findeSD(BDS,eON,EG,FOR,oe2d,2); | |
1793 | if (ie2d == 0) return; | |
1794 | ||
1795 | const TopoDS_Edge& e2d = TopoDS::Edge(BDS.Shape(ie2d)); | |
1796 | TopOpeBRepDS_Config cf; Standard_Boolean cfok = FDS_Config3d(EspON,e2d,cf); | |
1797 | if (!cfok) return; | |
1798 | ||
1799 | TopAbs_Orientation oe2dk = oe2d; | |
1800 | Standard_Real parEG; Standard_Boolean ok = FUN_tool_parE(eON,parON,EG,parEG,tolEG); | |
1801 | if (!ok) return; // nyiRAISE | |
1802 | Standard_Boolean samegeom; ok = FUN_tool_curvesSO(EG,parEG,e2d,samegeom); | |
1803 | if (!ok) return; // nyiRAISE | |
0797d9d3 | 1804 | #ifdef OCCT_DEBUG |
7fd59977 | 1805 | if (!TopOpeBRepBuild_GetcontextNOSG()) { |
1806 | #endif | |
1807 | if (!samegeom) oe2dk = TopAbs::Complement(oe2dk); | |
0797d9d3 | 1808 | #ifdef OCCT_DEBUG |
7fd59977 | 1809 | } |
1810 | #endif | |
1811 | ||
1812 | Standard_Boolean keep2d = Standard_False; | |
1813 | // l'etat a construire sur FOR est TB1, | |
1814 | if (oe2dk == TopAbs_FORWARD) keep2d = (TFEaft == TB1); | |
1815 | else if (oe2dk == TopAbs_REVERSED) keep2d = (TFEbef == TB1); | |
1816 | else if (oe2dk == TopAbs_INTERNAL) keep2d = Standard_True; | |
1817 | else if (oe2dk == TopAbs_EXTERNAL) keep2d = Standard_False; | |
1818 | ||
1819 | if (keep2d) { | |
1820 | TopAbs_Orientation neworiE = oe2d; | |
1821 | if (cf == TopOpeBRepDS_DIFFORIENTED) neworiE = TopAbs::Complement(neworiE); | |
1822 | TopoDS_Shape newE = EspON; | |
1823 | newE.Orientation(neworiE); | |
1824 | ||
0797d9d3 | 1825 | #ifdef OCCT_DEBUG |
7fd59977 | 1826 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap5 GFillON","WES+ EspON "); |
1827 | if (tE) FUN_cout(newE); | |
1828 | #endif | |
1829 | myPWES->AddStartElement(newE); | |
1830 | } | |
1831 | ||
1832 | return; | |
1833 | } // yap5 | |
1834 | ||
1835 | //========================================= | |
1836 | if ( yap4 ) { | |
0797d9d3 | 1837 | #ifdef OCCT_DEBUG |
7fd59977 | 1838 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap4 GFillON"); |
1839 | if (tE) {cout<<"yap4(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1840 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1841 | #endif | |
1842 | ||
1843 | TopAbs_Orientation oTFE = TFE.Orientation(TB1); | |
1844 | ||
1845 | TopAbs_Orientation neworiE = oTFE; | |
1846 | TopoDS_Shape newE = EspON; | |
1847 | newE.Orientation(neworiE); | |
0797d9d3 | 1848 | #ifdef OCCT_DEBUG |
7fd59977 | 1849 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap4 GFillON","WES+ EspON "); |
1850 | if (tE) FUN_cout(newE); | |
1851 | #endif | |
1852 | myPWES->AddStartElement(newE); | |
1853 | ||
1854 | return; | |
1855 | } // yap4 | |
1856 | ||
1857 | //========================================= | |
1858 | if ( yap7 ) { | |
1859 | // xpu290598 : CTS20212 | |
0797d9d3 | 1860 | #ifdef OCCT_DEBUG |
7fd59977 | 1861 | if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap7 GFillON"); |
1862 | if (tE) {cout<<"yap7(FOR"<<iFOR<<" FCX"<<iFCX<<" EG"<<GI<<") "; | |
1863 | cout<<"TB1=";TopAbs::Print(TB1,cout);cout<<" TB2=";TopAbs::Print(TB2,cout);cout<<endl;} | |
1864 | #endif | |
1865 | Standard_Boolean isbound = Standard_False; | |
1866 | for (TopTools_ListIteratorOfListOfShape it(BDS.ShapeSameDomain(iFOR)); it.More(); it.Next()){ | |
1867 | TopExp_Explorer ex(it.Value(), TopAbs_EDGE); | |
1868 | for (; ex.More(); ex.Next()) { | |
1869 | const TopoDS_Shape& E = ex.Current(); | |
1870 | if (E.IsSame(EG)) { | |
1871 | isbound = Standard_True; | |
1872 | break; | |
1873 | } | |
1874 | } | |
1875 | } | |
1876 | TopAbs_Orientation oTFE = TFE.Orientation(TB1); | |
1877 | TopAbs_Orientation neworiE = oTFE; | |
1878 | ||
1879 | if (ComOfCut) { //CTS20212 : tspIN(f7),tspON(e4) | |
1880 | if (!EGBoundFOR) { | |
1881 | if (!isbound) return; | |
1882 | } | |
1883 | } | |
1884 | ||
1885 | //CTS20212 : tspIN(f7),tspON(e5) | |
1886 | Standard_Boolean samegeomref = Standard_False; | |
1887 | if (FORisref) { | |
1888 | samegeomref = Standard_True; | |
1889 | } | |
1890 | else { | |
1891 | samegeomref = (cFOR == TopOpeBRepDS_SAMEORIENTED); | |
1892 | if (oFOR != orefFOR) samegeomref = !samegeomref; | |
1893 | } | |
1894 | if (!samegeomref) neworiE = TopAbs::Complement(neworiE); | |
1895 | ||
1896 | TopoDS_Shape newE = EspON; | |
1897 | newE.Orientation(neworiE); | |
0797d9d3 | 1898 | #ifdef OCCT_DEBUG |
7fd59977 | 1899 | if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap7 GFillON","WES+ EspON "); |
1900 | if (tE) FUN_cout(newE); | |
1901 | #endif | |
1902 | myPWES->AddStartElement(newE); | |
1903 | ||
1904 | return; | |
1905 | } // yap7 | |
1906 | ||
1907 | } // GFillONPartsWES2 |