0022922: Clean up warnings on uninitialized / unused variables
[occt.git] / src / BRepClass3d / BRepClass3d_SolidClassifier.cxx
CommitLineData
7fd59977 1// File: BRepClass3d_SolidClassifier.cxx
2// Created: Wed Mar 30 18:28:29 1994
3// Author: Laurent BUCHARD
4// <lbr@fuegox>
5//-Copyright: Matra Datavision 1994
6
7
8
9#define MARCHEPASSIUNESEULEFACE 0
10
11
12#ifdef DEB
13#define LBRCOMPT 0
14#else
15#define LBRCOMPT 0
16#endif
17
18#if LBRCOMPT
19#include <stdio.h>
20
21class StatistiquesBRepClass3d {
22public:
23 long unsigned NbConstrVide;
24 long unsigned NbLoad;
25 long unsigned NbConstrShape;
26 long unsigned NbConstrShapePnt;
27 long unsigned NbPerform;
28 long unsigned NbPerformRejection;
29 long unsigned NbPerformInfinitePoint;
30 long unsigned NbDestroy;
31public:
32 StatistiquesBRepClass3d() {
33 NbConstrVide=NbLoad=NbConstrShape=NbConstrShapePnt=NbPerform=NbPerformInfinitePoint=NbDestroy=0;
34 }
35 ~StatistiquesBRepClass3d() {
36 printf("\n--- Statistiques BRepClass3d:\n");
37
38 printf("\nConstructeurVide : %10lu",NbConstrVide);
39 printf("\nConstructeur(Shape) : %10lu",NbConstrShape);
40 printf("\nLoad(Shape) : %10lu",NbLoad);
41 printf("\nPerform(pnt3d) : %10lu",NbPerform);
42 printf("\nPerform(pnt3d) REJ : %10lu",NbPerformRejection);
43 printf("\nPerformInfinitePoint: %10lu",NbPerformInfinitePoint);
44 printf("\nDestroy : %10lu",NbDestroy );
45 }
46};
47
48static StatistiquesBRepClass3d STAT;
49#endif
50
51
52
53#include <BRepClass3d_SolidClassifier.ixx>
54
55#include <TopoDS_Shape.hxx>
56
57BRepClass3d_SolidClassifier::BRepClass3d_SolidClassifier()
58{
59 aSolidLoaded=isaholeinspace=Standard_False;
60#if LBRCOMPT
61 STAT.NbConstrVide++;
62#endif
63}
64
65
66void BRepClass3d_SolidClassifier::Load(const TopoDS_Shape& S) {
67
68#if LBRCOMPT
69 STAT.NbLoad++;
70#endif
71
72 if(aSolidLoaded) {
73 explorer.Destroy();
74 }
75 explorer.InitShape(S);
76 aSolidLoaded = Standard_True;
77
78
79#if MARCHEPASSIUNESEULEFACE
80 PerformInfinitePoint(1e-7);
81 if(State()==TopAbs_OUT) {
82 isaholeinspace=Standard_False;
83 }
84 else {
85 isaholeinspace=Standard_True;
86 }
87#endif
88}
89
90BRepClass3d_SolidClassifier::BRepClass3d_SolidClassifier(const TopoDS_Shape& S)
91: aSolidLoaded(Standard_True),explorer(S)
92{
93#if LBRCOMPT
94 STAT.NbConstrShape++;
95#endif
96#if MARCHEPASSIUNESEULEFACE
97 PerformInfinitePoint(1e-7);
98 if(State()==TopAbs_OUT) {
99 isaholeinspace=Standard_False;
100 }
101 else {
102 isaholeinspace=Standard_True;
103 }
104#endif
105}
106
107BRepClass3d_SolidClassifier::BRepClass3d_SolidClassifier(const TopoDS_Shape& S,
108 const gp_Pnt& P,
109 const Standard_Real Tol)
110: explorer(S) {
111#if LBRCOMPT
112 STAT.NbConstrShapePnt++;
113#endif
114 aSolidLoaded = Standard_True;
115#if MARCHEPASSIUNESEULEFACE
116 PerformInfinitePoint(1e-7);
117 if(State()==TopAbs_OUT) {
118 isaholeinspace=Standard_False;
119 }
120 else {
121 isaholeinspace=Standard_True;
122 }
123
124 if(isaholeinspace==Standard_False) {
125 if(explorer.Box().IsOut(P)) {
126 ForceOut();
127 }
128 else {
129 Perform(P,Tol);
130 }
131 }
132 else {
133 if(explorer.Box().IsOut(P)) {
134 ForceIn();
135 }
136 else {
137 Perform(P,Tol);
138 }
139 }
140#else
141 Perform(P,Tol);
142#endif
143}
144
145
146void BRepClass3d_SolidClassifier::Perform(const gp_Pnt& P,const Standard_Real Tol) {
147#if LBRCOMPT
148 STAT.NbPerform++;
149#endif
150#if MARCHEPASSIUNESEULEFACE
151 if(aSolidLoaded) {
152 if(isaholeinspace==Standard_False) {
153 if(explorer.Box().IsOut(P)) {
154 ForceOut();
155#if LBRCOMPT
156 STAT.NbPerformRejection++;
157#endif
158
159 }
160 else {
161 BRepClass3d_SClassifier::Perform(explorer,P,Tol);
162 }
163 }
164 else {
165 if(explorer.Box().IsOut(P)) {
166 ForceIn();
167#if LBRCOMPT
168 STAT.NbPerformRejection++;
169#endif
170
171 }
172 else {
173 BRepClass3d_SClassifier::Perform(explorer,P,Tol);
174 }
175 }
176 }
177#else
178 BRepClass3d_SClassifier::Perform(explorer,P,Tol);
179#endif
180}
181
182void BRepClass3d_SolidClassifier::PerformInfinitePoint(const Standard_Real Tol) {
183#if LBRCOMPT
184 STAT.NbPerformInfinitePoint++;
185#endif
186
187 if(aSolidLoaded) {
188 BRepClass3d_SClassifier::PerformInfinitePoint(explorer,Tol);
189 if(State()==TopAbs_OUT)
190 isaholeinspace=Standard_False;
191 else
192 isaholeinspace=Standard_True;
193 }
194}
195
196
197
198void BRepClass3d_SolidClassifier::Destroy() {
199#if LBRCOMPT
200 STAT.NbDestroy++;
201#endif
202
203 if(aSolidLoaded) {
204 explorer.Destroy();
205 aSolidLoaded = Standard_False;
206 }
207}
208
209
210