1 // Created on: 1994-03-30
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #define MARCHEPASSIUNESEULEFACE 0
29 class StatistiquesBRepClass3d {
31 long unsigned NbConstrVide;
33 long unsigned NbConstrShape;
34 long unsigned NbConstrShapePnt;
35 long unsigned NbPerform;
36 long unsigned NbPerformRejection;
37 long unsigned NbPerformInfinitePoint;
38 long unsigned NbDestroy;
40 StatistiquesBRepClass3d() {
41 NbConstrVide=NbLoad=NbConstrShape=NbConstrShapePnt=NbPerform=NbPerformInfinitePoint=NbDestroy=0;
43 ~StatistiquesBRepClass3d() {
44 printf("\n--- Statistiques BRepClass3d:\n");
46 printf("\nConstructeurVide : %10lu",NbConstrVide);
47 printf("\nConstructeur(Shape) : %10lu",NbConstrShape);
48 printf("\nLoad(Shape) : %10lu",NbLoad);
49 printf("\nPerform(pnt3d) : %10lu",NbPerform);
50 printf("\nPerform(pnt3d) REJ : %10lu",NbPerformRejection);
51 printf("\nPerformInfinitePoint: %10lu",NbPerformInfinitePoint);
52 printf("\nDestroy : %10lu",NbDestroy );
56 static StatistiquesBRepClass3d STAT;
60 #include <BRepClass3d_SolidClassifier.hxx>
62 #include <TopoDS_Shape.hxx>
64 BRepClass3d_SolidClassifier::BRepClass3d_SolidClassifier()
66 aSolidLoaded=isaholeinspace=Standard_False;
73 void BRepClass3d_SolidClassifier::Load(const TopoDS_Shape& S) {
82 explorer.InitShape(S);
83 aSolidLoaded = Standard_True;
86 #if MARCHEPASSIUNESEULEFACE
87 PerformInfinitePoint(1e-7);
88 if(State()==TopAbs_OUT) {
89 isaholeinspace=Standard_False;
92 isaholeinspace=Standard_True;
97 BRepClass3d_SolidClassifier::BRepClass3d_SolidClassifier(const TopoDS_Shape& S)
98 : aSolidLoaded(Standard_True),
100 isaholeinspace(Standard_False)
103 STAT.NbConstrShape++;
105 #if MARCHEPASSIUNESEULEFACE
106 PerformInfinitePoint(1e-7);
107 if(State()==TopAbs_OUT) {
108 isaholeinspace=Standard_False;
111 isaholeinspace=Standard_True;
116 BRepClass3d_SolidClassifier::BRepClass3d_SolidClassifier(const TopoDS_Shape& S,
118 const Standard_Real Tol)
121 STAT.NbConstrShapePnt++;
123 aSolidLoaded = Standard_True;
124 #if MARCHEPASSIUNESEULEFACE
125 PerformInfinitePoint(1e-7);
126 if(State()==TopAbs_OUT) {
127 isaholeinspace=Standard_False;
130 isaholeinspace=Standard_True;
133 if(isaholeinspace==Standard_False) {
134 if(explorer.Box().IsOut(P)) {
142 if(explorer.Box().IsOut(P)) {
155 void BRepClass3d_SolidClassifier::Perform(const gp_Pnt& P,const Standard_Real Tol) {
159 #if MARCHEPASSIUNESEULEFACE
161 if(isaholeinspace==Standard_False) {
162 if(explorer.Box().IsOut(P)) {
165 STAT.NbPerformRejection++;
170 BRepClass3d_SClassifier::Perform(explorer,P,Tol);
174 if(explorer.Box().IsOut(P)) {
177 STAT.NbPerformRejection++;
182 BRepClass3d_SClassifier::Perform(explorer,P,Tol);
187 BRepClass3d_SClassifier::Perform(explorer,P,Tol);
191 void BRepClass3d_SolidClassifier::PerformInfinitePoint(const Standard_Real Tol) {
193 STAT.NbPerformInfinitePoint++;
197 BRepClass3d_SClassifier::PerformInfinitePoint(explorer,Tol);
198 if(State()==TopAbs_OUT)
199 isaholeinspace=Standard_False;
201 isaholeinspace=Standard_True;
207 void BRepClass3d_SolidClassifier::Destroy() {
214 aSolidLoaded = Standard_False;