1 // Created on: 1993-01-21
2 // Created by: Peter KURNEV
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
21 // File: BRepClass3d.cxx
22 // Created: Thu Sep 20 10:05:46 2012
26 #include <BRepClass3d.ixx>
29 #include <TopAbs_State.hxx>
30 #include <TopAbs_Orientation.hxx>
32 #include <TopoDS_Solid.hxx>
33 #include <TopoDS_Shell.hxx>
34 #include <TopoDS_Iterator.hxx>
36 #include <BRep_Builder.hxx>
37 #include <BRepClass3d_SolidClassifier.hxx>
41 Standard_Boolean IsInternal(const TopoDS_Shell& aSx);
43 //=======================================================================
44 //function : OuterShell
46 //=======================================================================
47 TopoDS_Shell BRepClass3d::OuterShell(const TopoDS_Solid& aSolid)
49 Standard_Boolean bFound;
52 TopoDS_Shell aShell, aDummy;
55 BRepClass3d_SolidClassifier aSC;
57 if (aSolid.IsNull()) {
62 bFound=Standard_False;
64 aIt.Initialize(aSolid);
65 for (; aIt.More(); aIt.Next()) {
66 const TopoDS_Shape& aSx=aIt.Value();
67 if (aSx.ShapeType()==TopAbs_SHELL) {
68 aShell=*((TopoDS_Shell*)&aSx);
69 if (!IsInternal(aShell)) {
72 aBB.Add(aSDx, aShell);
75 aSC.PerformInfinitePoint(aTol);
76 if(aSC.State()==TopAbs_OUT) {
91 //=======================================================================
92 //function : IsInternal
94 //=======================================================================
95 Standard_Boolean IsInternal(const TopoDS_Shell& aSx)
97 Standard_Boolean bInternal;
98 TopAbs_Orientation aOr;
101 bInternal=Standard_False;
104 for (; aIt.More(); aIt.Next()) {
105 const TopoDS_Shape& aSy=aIt.Value();
106 aOr=aSy.Orientation();
107 bInternal=(aOr==TopAbs_INTERNAL);