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