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;
49 myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
50 iSize=myIterator->ExpectedLength();
55 BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
56 aVZs.SetIncrement(iSize);
58 for (; myIterator->More(); myIterator->Next()) {
59 myIterator->Value(nV, nZ, bJustAdd);
64 const BOPDS_ShapeInfo& aSIV=myDS->ShapeInfo(nV);
65 const BOPDS_ShapeInfo& aSIZ=myDS->ShapeInfo(nZ);
67 const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aSIV.Shape());
68 const TopoDS_Solid& aZ=*((TopoDS_Solid*)&aSIZ.Shape());
70 BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aZ);
72 aPV=BRep_Tool::Pnt(aV);
73 aTol=BRep_Tool::Tolerance(aV);
75 aSC.Perform(aPV, aTol);
78 if (aState==TopAbs_IN) {
79 BOPDS_InterfVZ& aVZ=aVZs.Append1();
80 aVZ.SetIndices(nV, nZ);
82 myDS->AddInterf(nV, nZ);
86 //=======================================================================
87 //function : PerformEZ
89 //=======================================================================
90 void BOPAlgo_PaveFiller::PerformEZ()
92 Standard_Boolean bJustAdd, bHasInterf;
93 Standard_Integer iSize, nE, nZ;
97 myIterator->Initialize(TopAbs_EDGE, TopAbs_SOLID);
98 iSize=myIterator->ExpectedLength();
103 BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
104 aEZs.SetIncrement(iSize);
106 for (; myIterator->More(); myIterator->Next()) {
107 myIterator->Value(nE, nZ, bJustAdd);
112 bHasInterf=myDS->HasInterfShapeSubShapes(nE, nZ);
117 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nE);
122 BOPDS_InterfEZ& aEZ=aEZs.Append1();
123 aEZ.SetIndices(nE, nZ);
125 myDS->AddInterf(nE, nZ);
128 //=======================================================================
129 //function : PerformFZ
131 //=======================================================================
132 void BOPAlgo_PaveFiller::PerformFZ()
134 Standard_Boolean bJustAdd, bHasInterf;
135 Standard_Integer iSize, nF, nZ;
139 myIterator->Initialize(TopAbs_FACE, TopAbs_SOLID);
140 iSize=myIterator->ExpectedLength();
145 BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
146 aFZs.SetIncrement(iSize);
148 for (; myIterator->More(); myIterator->Next()) {
149 myIterator->Value(nF, nZ, bJustAdd);
154 bHasInterf=myDS->HasInterfShapeSubShapes(nF, nZ);
159 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nF);
164 BOPDS_InterfFZ& aFZ=aFZs.Append1();
165 aFZ.SetIndices(nF, nZ);
167 myDS->AddInterf(nF, nZ);
170 //=======================================================================
171 //function : PerformZZ
173 //=======================================================================
174 void BOPAlgo_PaveFiller::PerformZZ()
176 Standard_Boolean bJustAdd, bHasInterf, bFlag;
177 Standard_Integer iSize, nZ1, nZ;
181 myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
182 iSize=myIterator->ExpectedLength();
187 BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
188 aZZs.SetIncrement(iSize);
190 bFlag=Standard_False;
192 for (; myIterator->More(); myIterator->Next()) {
193 myIterator->Value(nZ1, nZ, bJustAdd);
198 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nZ1, bFlag);
200 bHasInterf=myDS->HasInterfShapeSubShapes(nZ1, nZ, bFlag);
206 BOPDS_InterfZZ& aZZ=aZZs.Append1();
207 aZZ.SetIndices(nZ1, nZ);
209 myDS->AddInterf(nZ1, nZ);