1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
18 #include <BOPAlgo_PaveFiller.ixx>
22 #include <TopAbs_State.hxx>
24 #include <TopoDS_Vertex.hxx>
25 #include <TopoDS_Solid.hxx>
26 #include <BRep_Tool.hxx>
27 #include <BRepClass3d_SolidClassifier.hxx>
29 #include <IntTools_Context.hxx>
31 #include <BOPDS_DS.hxx>
32 #include <BOPDS_IteratorSI.hxx>
33 #include <BOPDS_Interf.hxx>
35 //=======================================================================
36 //function : PerformVZ
38 //=======================================================================
39 void BOPAlgo_PaveFiller::PerformVZ()
41 Standard_Boolean bJustAdd;
42 Standard_Integer iSize, nV, nZ, i;
49 myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
50 iSize=myIterator->ExpectedLength();
55 BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
56 aVZs.SetStartSize(iSize);
57 aVZs.SetIncrement(iSize);
60 for (; myIterator->More(); myIterator->Next()) {
61 myIterator->Value(nV, nZ, bJustAdd);
66 const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
67 const BOPDS_ShapeInfo& aSIZ=myDS->ShapeInfo(nZ);
69 const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aSIV.Shape());
70 const TopoDS_Solid& aZ=*((TopoDS_Solid*)&aSIZ.Shape());
72 BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aZ);
74 aPV=BRep_Tool::Pnt(aV);
75 aTol=BRep_Tool::Tolerance(aV);
77 aSC.Perform(aPV, aTol);
80 if (aState==TopAbs_IN) {
82 BOPDS_InterfVZ& aVZ=aVZs(i);
83 aVZ.SetIndices(nV, nZ);
85 myDS->AddInterf(nV, nZ);
89 //=======================================================================
90 //function : PerformEZ
92 //=======================================================================
93 void BOPAlgo_PaveFiller::PerformEZ()
95 Standard_Boolean bJustAdd, bHasInterf;
96 Standard_Integer iSize, nE, nZ, i;
100 myIterator->Initialize(TopAbs_EDGE, TopAbs_SOLID);
101 iSize=myIterator->ExpectedLength();
106 BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
107 aEZs.SetStartSize(iSize);
108 aEZs.SetIncrement(iSize);
111 for (; myIterator->More(); myIterator->Next()) {
112 myIterator->Value(nE, nZ, bJustAdd);
117 bHasInterf=myDS->HasInterfShapeSubShapes(nE, nZ);
122 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nE);
128 BOPDS_InterfEZ& aEZ=aEZs(i);
129 aEZ.SetIndices(nE, nZ);
131 myDS->AddInterf(nE, nZ);
134 //=======================================================================
135 //function : PerformFZ
137 //=======================================================================
138 void BOPAlgo_PaveFiller::PerformFZ()
140 Standard_Boolean bJustAdd, bHasInterf;
141 Standard_Integer iSize, nF, nZ, i;
145 myIterator->Initialize(TopAbs_FACE, TopAbs_SOLID);
146 iSize=myIterator->ExpectedLength();
151 BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
152 aFZs.SetStartSize(iSize);
153 aFZs.SetIncrement(iSize);
156 for (; myIterator->More(); myIterator->Next()) {
157 myIterator->Value(nF, nZ, bJustAdd);
162 bHasInterf=myDS->HasInterfShapeSubShapes(nF, nZ);
167 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nF);
173 BOPDS_InterfFZ& aFZ=aFZs(i);
174 aFZ.SetIndices(nF, nZ);
176 myDS->AddInterf(nF, nZ);
179 //=======================================================================
180 //function : PerformZZ
182 //=======================================================================
183 void BOPAlgo_PaveFiller::PerformZZ()
185 Standard_Boolean bJustAdd, bHasInterf, bFlag;
186 Standard_Integer iSize, nZ1, nZ, i;
190 myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
191 iSize=myIterator->ExpectedLength();
196 BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
197 aZZs.SetStartSize(iSize);
198 aZZs.SetIncrement(iSize);
201 bFlag=Standard_False;
203 for (; myIterator->More(); myIterator->Next()) {
204 myIterator->Value(nZ1, nZ, bJustAdd);
209 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nZ1, bFlag);
211 bHasInterf=myDS->HasInterfShapeSubShapes(nZ1, nZ, bFlag);
218 BOPDS_InterfZZ& aZZ=aZZs(i);
219 aZZ.SetIndices(nZ1, nZ);
221 myDS->AddInterf(nZ1, nZ);