1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2012 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
8 // This file is part of Open CASCADE Technology software library.
10 // This library is free software; you can redistribute it and/or modify it under
11 // the terms of the GNU Lesser General Public License version 2.1 as published
12 // by the Free Software Foundation, with special exception defined in the file
13 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
14 // distribution for complete text of the license and disclaimer of any warranty.
16 // Alternatively, this file may be used under the terms of Open CASCADE
17 // commercial license or contractual agreement.
19 #include <BOPAlgo_CheckerSI.ixx>
21 #include <BOPDS_DS.hxx>
22 #include <BOPDS_IteratorSI.hxx>
23 #include <BOPInt_Context.hxx>
25 #include <BOPDS_Interf.hxx>
26 #include <TopoDS_Solid.hxx>
27 #include <BRepClass3d_SolidClassifier.hxx>
28 #include <TopoDS_Vertex.hxx>
30 #include <TopAbs_State.hxx>
31 #include <BRep_Tool.hxx>
32 #include <BOPDS_VectorOfInterfVZ.hxx>
35 //=======================================================================
36 //function : PerformVZ
38 //=======================================================================
39 void BOPAlgo_CheckerSI::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);
90 //=======================================================================
91 //function : PerformEZ
93 //=======================================================================
94 void BOPAlgo_CheckerSI::PerformEZ()
96 Standard_Boolean bJustAdd, bHasInterf;
97 Standard_Integer iSize, nE, nZ, i;
101 myIterator->Initialize(TopAbs_EDGE, TopAbs_SOLID);
102 iSize=myIterator->ExpectedLength();
107 BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
108 aEZs.SetStartSize(iSize);
109 aEZs.SetIncrement(iSize);
112 for (; myIterator->More(); myIterator->Next()) {
113 myIterator->Value(nE, nZ, bJustAdd);
118 bHasInterf=myDS->HasInterfShapeSubShapes(nE, nZ);
123 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nE);
129 BOPDS_InterfEZ& aEZ=aEZs(i);
130 aEZ.SetIndices(nE, nZ);
132 myDS->AddInterf(nE, nZ);
135 //=======================================================================
136 //function : PerformFZ
138 //=======================================================================
139 void BOPAlgo_CheckerSI::PerformFZ()
141 Standard_Boolean bJustAdd, bHasInterf;
142 Standard_Integer iSize, nF, nZ, i;
146 myIterator->Initialize(TopAbs_FACE, TopAbs_SOLID);
147 iSize=myIterator->ExpectedLength();
152 BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
153 aFZs.SetStartSize(iSize);
154 aFZs.SetIncrement(iSize);
157 for (; myIterator->More(); myIterator->Next()) {
158 myIterator->Value(nF, nZ, bJustAdd);
163 bHasInterf=myDS->HasInterfShapeSubShapes(nF, nZ);
168 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nF);
174 BOPDS_InterfFZ& aFZ=aFZs(i);
175 aFZ.SetIndices(nF, nZ);
177 myDS->AddInterf(nF, nZ);
180 //=======================================================================
181 //function : PerformZZ
183 //=======================================================================
184 void BOPAlgo_CheckerSI::PerformZZ()
186 Standard_Boolean bJustAdd, bHasInterf, bFlag;
187 Standard_Integer iSize, nZ1, nZ, i;
191 myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
192 iSize=myIterator->ExpectedLength();
197 BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
198 aZZs.SetStartSize(iSize);
199 aZZs.SetIncrement(iSize);
202 bFlag=Standard_False;
204 for (; myIterator->More(); myIterator->Next()) {
205 myIterator->Value(nZ1, nZ, bJustAdd);
210 bHasInterf=myDS->HasInterfShapeSubShapes(nZ, nZ1, bFlag);
212 bHasInterf=myDS->HasInterfShapeSubShapes(nZ1, nZ, bFlag);
219 BOPDS_InterfZZ& aZZ=aZZs(i);
220 aZZ.SetIndices(nZ1, nZ);
222 myDS->AddInterf(nZ1, nZ);