Commit | Line | Data |
---|---|---|
733a0e55 S |
1 | // File: HLRAlgo_PolyAlgo.cxx |
2 | // Created: Fri May 5 15:58:19 1995 | |
3 | // Author: Christophe MARION | |
4 | // Copyright: OPEN CASCADE 2000 | |
5 | ||
7fd59977 | 6 | #ifndef No_Exception |
7 | //#define No_Exception | |
8 | #endif | |
9 | #include <HLRAlgo_PolyAlgo.ixx> | |
10 | #include <HLRAlgo_PolyShellData.hxx> | |
11 | #include <HLRAlgo_PolyData.hxx> | |
12 | #include <HLRAlgo_ListOfBPoint.hxx> | |
13 | #include <HLRAlgo_BiPoint.hxx> | |
14 | #include <Precision.hxx> | |
15 | ||
16 | #define EMskGrALin1 ((Standard_Boolean) 8) | |
17 | #define EMskGrALin2 ((Standard_Boolean) 16) | |
18 | #define EMskGrALin3 ((Standard_Boolean) 32) | |
19 | #define FMskHiding ((Standard_Boolean) 256) | |
20 | ||
21 | #define TriNode1 ((Standard_Integer*)TriIndices)[0] | |
22 | #define TriNode2 ((Standard_Integer*)TriIndices)[1] | |
23 | #define TriNode3 ((Standard_Integer*)TriIndices)[2] | |
24 | #define TriFlags ((Standard_Boolean*)TriIndices)[3] | |
25 | ||
26 | #define XV1 myRealPtr[0] | |
27 | #define XV2 myRealPtr[1] | |
28 | #define XV3 myRealPtr[2] | |
29 | #define YV1 myRealPtr[3] | |
30 | #define YV2 myRealPtr[4] | |
31 | #define YV3 myRealPtr[5] | |
32 | #define Param myRealPtr[6] | |
33 | #define myTolParam myRealPtr[7] | |
34 | #define myTolAngular myRealPtr[8] | |
35 | #define myTolerance myRealPtr[9] | |
36 | ||
37 | #define PntX1 ((Standard_Real*)Coordinates)[ 0] | |
38 | #define PntY1 ((Standard_Real*)Coordinates)[ 1] | |
39 | #define PntZ1 ((Standard_Real*)Coordinates)[ 2] | |
40 | #define PntX2 ((Standard_Real*)Coordinates)[ 3] | |
41 | #define PntY2 ((Standard_Real*)Coordinates)[ 4] | |
42 | #define PntZ2 ((Standard_Real*)Coordinates)[ 5] | |
43 | #define PntXP1 ((Standard_Real*)Coordinates)[ 6] | |
44 | #define PntYP1 ((Standard_Real*)Coordinates)[ 7] | |
45 | #define PntZP1 ((Standard_Real*)Coordinates)[ 8] | |
46 | #define PntXP2 ((Standard_Real*)Coordinates)[ 9] | |
47 | #define PntYP2 ((Standard_Real*)Coordinates)[10] | |
48 | #define PntZP2 ((Standard_Real*)Coordinates)[11] | |
49 | ||
50 | #define TotXMin ((Standard_Real*)TotMinMax)[0] | |
51 | #define TotYMin ((Standard_Real*)TotMinMax)[1] | |
52 | #define TotZMin ((Standard_Real*)TotMinMax)[2] | |
53 | #define TotXMax ((Standard_Real*)TotMinMax)[3] | |
54 | #define TotYMax ((Standard_Real*)TotMinMax)[4] | |
55 | #define TotZMax ((Standard_Real*)TotMinMax)[5] | |
56 | ||
57 | #define ShapeIndex ((Standard_Integer*)IndexPtr)[0] | |
58 | #define FaceConex1 ((Standard_Integer*)IndexPtr)[1] | |
59 | #define Face1Pt1 ((Standard_Integer*)IndexPtr)[2] | |
60 | #define Face1Pt2 ((Standard_Integer*)IndexPtr)[3] | |
61 | #define FaceConex2 ((Standard_Integer*)IndexPtr)[4] | |
62 | #define Face2Pt1 ((Standard_Integer*)IndexPtr)[5] | |
63 | #define Face2Pt2 ((Standard_Integer*)IndexPtr)[6] | |
64 | #define MinSeg ((Standard_Integer*)IndexPtr)[7] | |
65 | #define MaxSeg ((Standard_Integer*)IndexPtr)[8] | |
66 | #define SegFlags ((Standard_Integer*)IndexPtr)[9] | |
67 | ||
68 | #define MinShell ((Standard_Integer*)ShellIndices)[0] | |
69 | #define MaxShell ((Standard_Integer*)ShellIndices)[1] | |
70 | ||
71 | #define FIndex ((Standard_Integer*)PolyTIndices)[0] | |
72 | #define MinPolyT ((Standard_Integer*)PolyTIndices)[1] | |
73 | #define MaxPolyT ((Standard_Integer*)PolyTIndices)[2] | |
74 | ||
75 | //static Standard_Integer ERROR = Standard_False; | |
76 | ||
77 | //======================================================================= | |
78 | //function : HLRAlgo_PolyAlgo | |
79 | //purpose : | |
80 | //======================================================================= | |
81 | ||
82 | HLRAlgo_PolyAlgo::HLRAlgo_PolyAlgo () | |
83 | { | |
84 | myTolParam = 0.00000001; | |
85 | myTolAngular = 0.0001; | |
86 | } | |
87 | ||
88 | //======================================================================= | |
89 | //function : Init | |
90 | //purpose : | |
91 | //======================================================================= | |
92 | ||
93 | void | |
94 | HLRAlgo_PolyAlgo::Init (const Handle(TColStd_HArray1OfTransient)& HShell) | |
95 | { myHShell = HShell; } | |
96 | ||
97 | //======================================================================= | |
98 | //function : Clear | |
99 | //purpose : | |
100 | //======================================================================= | |
101 | ||
102 | void HLRAlgo_PolyAlgo::Clear () | |
103 | { | |
104 | if (!myHShell.IsNull()) { | |
105 | myHShell.Nullify(); | |
106 | } | |
107 | myNbrShell = 0; | |
108 | } | |
109 | ||
110 | //======================================================================= | |
111 | //function : Update | |
112 | //purpose : | |
113 | //======================================================================= | |
114 | ||
115 | void HLRAlgo_PolyAlgo::Update () | |
116 | { | |
117 | Standard_Integer i,j; | |
118 | Standard_Integer nxMin,nyMin,nzMin,nxMax,nyMax,nzMax; | |
119 | Standard_Real xShellMin,yShellMin,zShellMin; | |
120 | Standard_Real xShellMax,yShellMax,zShellMax; | |
121 | Standard_Real xPolyTMin,yPolyTMin,zPolyTMin; | |
122 | Standard_Real xPolyTMax,yPolyTMax,zPolyTMax; | |
123 | Standard_Real xTrianMin,yTrianMin,zTrianMin; | |
124 | Standard_Real xTrianMax,yTrianMax,zTrianMax; | |
125 | Standard_Real xSegmnMin,ySegmnMin,zSegmnMin; | |
126 | Standard_Real xSegmnMax,ySegmnMax,zSegmnMax; | |
127 | Standard_Real TotMinMax[6]; | |
128 | Standard_Real Big = Precision::Infinite(); | |
129 | TotMinMax[0] = Big; | |
130 | TotMinMax[1] = Big; | |
131 | TotMinMax[2] = Big; | |
132 | TotMinMax[3] = -Big; | |
133 | TotMinMax[4] = -Big; | |
134 | TotMinMax[5] = -Big; | |
135 | TColStd_Array1OfTransient& Shell = myHShell->ChangeArray1(); | |
136 | myNbrShell = Shell.Upper(); | |
137 | Handle(HLRAlgo_PolyShellData)* psd1 = | |
138 | (Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1)); | |
139 | ||
140 | for (i = 1; i <= myNbrShell; i++) { | |
141 | (*psd1)->UpdateGlobalMinMax(&TotMinMax); | |
142 | psd1++; | |
143 | } | |
144 | ||
145 | Standard_Real dx = TotMinMax[3] - TotMinMax[0]; | |
146 | Standard_Real dy = TotMinMax[4] - TotMinMax[1]; | |
147 | Standard_Real dz = TotMinMax[5] - TotMinMax[2]; | |
148 | Standard_Real precad = dx; | |
149 | if (precad < dy) precad = dy; | |
150 | if (precad < dz) precad = dz; | |
151 | myTolerance = precad * myTolParam; | |
152 | precad = precad * 0.01; | |
153 | Standard_Real SurDX = 1020 / (dx + precad); | |
154 | Standard_Real SurDY = 1020 / (dy + precad); | |
155 | Standard_Real SurDZ = 508 / (dz + precad); | |
156 | precad = precad * 0.5; | |
157 | Standard_Real DecaX = - TotMinMax[0] + precad; | |
158 | Standard_Real DecaY = - TotMinMax[1] + precad; | |
159 | Standard_Real DecaZ = - TotMinMax[2] + precad; | |
160 | ||
161 | Handle(HLRAlgo_PolyShellData)* psd2 = | |
162 | (Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1)); | |
163 | ||
164 | for (i = 1; i <= myNbrShell; i++) { | |
165 | const Standard_Address ShellIndices = (*psd2)->Indices(); | |
166 | xShellMin = Big; | |
167 | yShellMin = Big; | |
168 | zShellMin = Big; | |
169 | xShellMax = -Big; | |
170 | yShellMax = -Big; | |
171 | zShellMax = -Big; | |
172 | ||
173 | for (mySegListIt.Initialize((*psd2)->Edges()); | |
174 | mySegListIt.More(); | |
175 | mySegListIt.Next()) { | |
176 | HLRAlgo_BiPoint& BP = mySegListIt.Value(); | |
177 | const Standard_Address Coordinates = BP.Coordinates(); | |
178 | const Standard_Address IndexPtr = BP.Indices(); | |
179 | if (PntXP1 < PntXP2) { xSegmnMin = PntXP1; xSegmnMax = PntXP2; } | |
180 | else { xSegmnMin = PntXP2; xSegmnMax = PntXP1; } | |
181 | if (PntYP1 < PntYP2) { ySegmnMin = PntYP1; ySegmnMax = PntYP2; } | |
182 | else { ySegmnMin = PntYP2; ySegmnMax = PntYP1; } | |
183 | if (PntZP1 < PntZP2) { zSegmnMin = PntZP1; zSegmnMax = PntZP2; } | |
184 | else { zSegmnMin = PntZP2; zSegmnMax = PntZP1; } | |
185 | nxMin = (Standard_Integer)((DecaX + xSegmnMin) * SurDX); | |
186 | nyMin = (Standard_Integer)((DecaY + ySegmnMin) * SurDY); | |
187 | nzMin = (Standard_Integer)((DecaZ + zSegmnMin) * SurDZ); | |
188 | nxMax = (Standard_Integer)((DecaX + xSegmnMax) * SurDX); | |
189 | nyMax = (Standard_Integer)((DecaY + ySegmnMax) * SurDY); | |
190 | nzMax = (Standard_Integer)((DecaZ + zSegmnMax) * SurDZ); | |
191 | MinSeg = nyMin + (nxMin << 11); | |
192 | MinSeg <<= 10; | |
193 | MinSeg += nzMin; | |
194 | MaxSeg = nyMax + (nxMax << 11); | |
195 | MaxSeg <<= 10; | |
196 | MaxSeg += nzMax + 0x00000200; | |
197 | if (xShellMin > xSegmnMin) xShellMin = xSegmnMin; | |
198 | if (xShellMax < xSegmnMax) xShellMax = xSegmnMax; | |
199 | if (yShellMin > ySegmnMin) yShellMin = ySegmnMin; | |
200 | if (yShellMax < ySegmnMax) yShellMax = ySegmnMax; | |
201 | if (zShellMin > zSegmnMin) zShellMin = zSegmnMin; | |
202 | if (zShellMax < zSegmnMax) zShellMax = zSegmnMax; | |
203 | } | |
204 | TColStd_Array1OfTransient& Polyg = (*psd2)->PolyData(); | |
205 | Standard_Integer nbFace = Polyg.Upper(); | |
206 | Standard_Integer nbFaHi = 0; | |
207 | Handle(HLRAlgo_PolyData)* pd; | |
208 | if(nbFace > 0) pd = (Handle(HLRAlgo_PolyData)*)&(Polyg.ChangeValue(1)); | |
209 | ||
210 | for (j = 1; j <= nbFace; j++) { | |
211 | if ((*pd)->Hiding()) { | |
212 | nbFaHi++; | |
213 | xPolyTMin = Big; | |
214 | yPolyTMin = Big; | |
215 | zPolyTMin = Big; | |
216 | xPolyTMax = -Big; | |
217 | yPolyTMax = -Big; | |
218 | zPolyTMax = -Big; | |
219 | Standard_Integer otheri,nbHide = 0;//min,max; | |
220 | Standard_Real X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3; | |
221 | Standard_Real dn,dnx,dny,dnz,dx1,dy1,dz1,dx2,dy2,dz2,dx3,dy3; | |
222 | Standard_Real adx1,ady1,adx2,ady2,adx3,ady3; | |
7fd59977 | 223 | Standard_Real a =0.,b =0.,c =0.,d =0.; |
7fd59977 | 224 | const Standard_Address PolyTIndices = (*pd)->Indices(); |
225 | TColgp_Array1OfXYZ & Nodes = (*pd)->Nodes(); | |
226 | HLRAlgo_Array1OfTData& TData = (*pd)->TData(); | |
227 | HLRAlgo_Array1OfPHDat& PHDat = (*pd)->PHDat(); | |
228 | Standard_Integer nbT = TData.Upper(); | |
229 | HLRAlgo_TriangleData* TD = &(TData.ChangeValue(1)); | |
230 | ||
231 | for (otheri = 1; otheri <= nbT; otheri++) { | |
232 | const Standard_Address TriIndices = TD->Indices(); | |
233 | if (TriFlags & FMskHiding) { | |
234 | const gp_XYZ& P1 = Nodes(TriNode1); | |
235 | const gp_XYZ& P2 = Nodes(TriNode2); | |
236 | const gp_XYZ& P3 = Nodes(TriNode3); | |
237 | X1 = P1.X(); | |
238 | Y1 = P1.Y(); | |
239 | Z1 = P1.Z(); | |
240 | X2 = P2.X(); | |
241 | Y2 = P2.Y(); | |
242 | Z2 = P2.Z(); | |
243 | X3 = P3.X(); | |
244 | Y3 = P3.Y(); | |
245 | Z3 = P3.Z(); | |
246 | xTrianMax = xTrianMin = X1; | |
247 | yTrianMax = yTrianMin = Y1; | |
248 | zTrianMax = zTrianMin = Z1; | |
249 | if (xTrianMin > X2) xTrianMin = X2; | |
250 | else if (xTrianMax < X2) xTrianMax = X2; | |
251 | if (yTrianMin > Y2) yTrianMin = Y2; | |
252 | else if (yTrianMax < Y2) yTrianMax = Y2; | |
253 | if (zTrianMin > Z2) zTrianMin = Z2; | |
254 | else if (zTrianMax < Z2) zTrianMax = Z2; | |
255 | if (xTrianMin > X3) xTrianMin = X3; | |
256 | else if (xTrianMax < X3) xTrianMax = X3; | |
257 | if (yTrianMin > Y3) yTrianMin = Y3; | |
258 | else if (yTrianMax < Y3) yTrianMax = Y3; | |
259 | if (zTrianMin > Z3) zTrianMin = Z3; | |
260 | else if (zTrianMax < Z3) zTrianMax = Z3; | |
261 | nxMin = (Standard_Integer)((DecaX + xTrianMin) * SurDX); | |
262 | nyMin = (Standard_Integer)((DecaY + yTrianMin) * SurDY); | |
263 | nzMin = (Standard_Integer)((DecaZ + zTrianMin) * SurDZ); | |
264 | nxMax = (Standard_Integer)((DecaX + xTrianMax) * SurDX); | |
265 | nyMax = (Standard_Integer)((DecaY + yTrianMax) * SurDY); | |
266 | nzMax = (Standard_Integer)((DecaZ + zTrianMax) * SurDZ); | |
267 | Standard_Integer MinTrian,MaxTrian; | |
268 | MinTrian = nyMin + (nxMin << 11); | |
269 | MinTrian <<= 10; | |
270 | MinTrian += nzMin - 0x00000200; | |
271 | MaxTrian = nyMax + (nxMax << 11); | |
272 | MaxTrian <<= 10; | |
273 | MaxTrian += nzMax; | |
274 | dx1 = X2 - X1; | |
275 | dy1 = Y2 - Y1; | |
276 | dz1 = Z2 - Z1; | |
277 | dx2 = X3 - X2; | |
278 | dy2 = Y3 - Y2; | |
279 | dz2 = Z3 - Z2; | |
280 | dx3 = X1 - X3; | |
281 | dy3 = Y1 - Y3; | |
282 | dnx = dy1 * dz2 - dy2 * dz1; | |
283 | dny = dz1 * dx2 - dz2 * dx1; | |
284 | dnz = dx1 * dy2 - dx2 * dy1; | |
285 | dn = sqrt(dnx * dnx + dny * dny + dnz * dnz); | |
286 | if (dn > 0) { | |
287 | a = dnx / dn; | |
288 | b = dny / dn; | |
289 | c = dnz / dn; | |
290 | } | |
291 | d = a * X1 + b * Y1 + c * Z1; | |
292 | nbHide++; | |
293 | PHDat(nbHide).Set(otheri,MinTrian,MaxTrian,a,b,c,d); | |
294 | adx1 = dx1; | |
295 | ady1 = dy1; | |
296 | if (dx1 < 0) adx1 = -dx1; | |
297 | if (dy1 < 0) ady1 = -dy1; | |
298 | adx2 = dx2; | |
299 | ady2 = dy2; | |
300 | if (dx2 < 0) adx2 = -dx2; | |
301 | if (dy2 < 0) ady2 = -dy2; | |
302 | adx3 = dx3; | |
303 | ady3 = dy3; | |
304 | if (dx3 < 0) adx3 = -dx3; | |
305 | if (dy3 < 0) ady3 = -dy3; | |
306 | if (adx1 > ady1) TriFlags |= EMskGrALin1; | |
307 | else TriFlags &= ~EMskGrALin1; | |
308 | if (adx2 > ady2) TriFlags |= EMskGrALin2; | |
309 | else TriFlags &= ~EMskGrALin2; | |
310 | if (adx3 > ady3) TriFlags |= EMskGrALin3; | |
311 | else TriFlags &= ~EMskGrALin3; | |
312 | if (xPolyTMin > xTrianMin) xPolyTMin = xTrianMin; | |
313 | if (xPolyTMax < xTrianMax) xPolyTMax = xTrianMax; | |
314 | if (yPolyTMin > yTrianMin) yPolyTMin = yTrianMin; | |
315 | if (yPolyTMax < yTrianMax) yPolyTMax = yTrianMax; | |
316 | if (zPolyTMin > zTrianMin) zPolyTMin = zTrianMin; | |
317 | if (zPolyTMax < zTrianMax) zPolyTMax = zTrianMax; | |
318 | } | |
319 | TD++; | |
320 | } | |
321 | nxMin = (Standard_Integer)((DecaX + xPolyTMin) * SurDX); | |
322 | nyMin = (Standard_Integer)((DecaY + yPolyTMin) * SurDY); | |
323 | nzMin = (Standard_Integer)((DecaZ + zPolyTMin) * SurDZ); | |
324 | nxMax = (Standard_Integer)((DecaX + xPolyTMax) * SurDX); | |
325 | nyMax = (Standard_Integer)((DecaY + yPolyTMax) * SurDY); | |
326 | nzMax = (Standard_Integer)((DecaZ + zPolyTMax) * SurDZ); | |
327 | MinPolyT = nyMin + (nxMin << 11); | |
328 | MinPolyT <<= 10; | |
329 | MinPolyT += nzMin - 0x00000200; | |
330 | MaxPolyT = nyMax + (nxMax << 11); | |
331 | MaxPolyT <<= 10; | |
332 | MaxPolyT += nzMax; | |
333 | if (xShellMin > xPolyTMin) xShellMin = xPolyTMin; | |
334 | if (xShellMax < xPolyTMax) xShellMax = xPolyTMax; | |
335 | if (yShellMin > yPolyTMin) yShellMin = yPolyTMin; | |
336 | if (yShellMax < yPolyTMax) yShellMax = yPolyTMax; | |
337 | if (zShellMin > zPolyTMin) zShellMin = zPolyTMin; | |
338 | if (zShellMax < zPolyTMax) zShellMax = zPolyTMax; | |
339 | } | |
340 | pd++; | |
341 | } | |
342 | if (nbFaHi > 0) { | |
343 | nxMin = (Standard_Integer)((DecaX + xShellMin) * SurDX); | |
344 | nyMin = (Standard_Integer)((DecaY + yShellMin) * SurDY); | |
345 | nzMin = (Standard_Integer)((DecaZ + zShellMin) * SurDZ); | |
346 | nxMax = (Standard_Integer)((DecaX + xShellMax) * SurDX); | |
347 | nyMax = (Standard_Integer)((DecaY + yShellMax) * SurDY); | |
348 | nzMax = (Standard_Integer)((DecaZ + zShellMax) * SurDZ); | |
349 | MinShell = nyMin + (nxMin << 11); | |
350 | MinShell <<= 10; | |
351 | MinShell += nzMin - 0x00000200; | |
352 | MaxShell = nyMax + (nxMax << 11); | |
353 | MaxShell <<= 10; | |
354 | MaxShell += nzMax; | |
355 | (*psd2)->UpdateHiding(nbFaHi); | |
356 | TColStd_Array1OfTransient& PolHi = (*psd2)->HidingPolyData(); | |
357 | pd = (Handle(HLRAlgo_PolyData)*)&(Polyg.ChangeValue(1)); | |
358 | Handle(HLRAlgo_PolyData)* phd = | |
359 | (Handle(HLRAlgo_PolyData)*)&(PolHi.ChangeValue(1)); | |
360 | ||
361 | for (j = 1; j <= nbFace; j++) { | |
362 | if ((*pd)->Hiding()) { | |
363 | *phd = *pd; | |
364 | phd++; | |
365 | } | |
366 | pd++; | |
367 | } | |
368 | } | |
369 | else { | |
370 | (*psd2)->UpdateHiding(0); | |
371 | MinShell = 0; | |
372 | MaxShell = 0; | |
373 | } | |
374 | psd2++; | |
375 | } | |
376 | } | |
377 | ||
378 | //======================================================================= | |
379 | //function : NextHide | |
380 | //purpose : | |
381 | //======================================================================= | |
382 | ||
383 | void HLRAlgo_PolyAlgo::NextHide () | |
384 | { | |
385 | myFound = Standard_False; | |
386 | if (myCurShell != 0) { | |
387 | mySegListIt.Next(); | |
388 | if (mySegListIt.More()) myFound = Standard_True; | |
389 | } | |
390 | if (!myFound) { | |
391 | myCurShell++; | |
392 | ||
393 | //POP ADN pour que cela marche sur WNT | |
394 | // while (myCurShell <= myNbrShell && !myFound) { | |
395 | // mySegListIt.Initialize((*(Handle(HLRAlgo_PolyShellData)*)& | |
396 | // (myHShell->ChangeValue(myCurShell))) | |
397 | // ->Edges()); | |
398 | while (myCurShell <= myNbrShell && !myFound) { | |
399 | Handle(HLRAlgo_PolyShellData) data = | |
400 | Handle(HLRAlgo_PolyShellData)::DownCast(myHShell->Value(myCurShell)); | |
401 | mySegListIt.Initialize(data->Edges()); | |
402 | if (mySegListIt.More()) myFound = Standard_True; | |
403 | else myCurShell++; | |
404 | } | |
405 | } | |
406 | } | |
407 | ||
408 | //======================================================================= | |
409 | //function : Hide | |
410 | //purpose : | |
411 | //======================================================================= | |
412 | ||
413 | void HLRAlgo_PolyAlgo::Hide (Standard_Address& Coordinates, | |
414 | HLRAlgo_EdgeStatus& status, | |
415 | Standard_Integer& Index, | |
416 | Standard_Boolean& reg1, | |
417 | Standard_Boolean& regn, | |
418 | Standard_Boolean& outl, | |
419 | Standard_Boolean& intl) | |
420 | { | |
421 | HLRAlgo_BiPoint& BP = mySegListIt.Value(); | |
422 | Coordinates = BP.Coordinates(); | |
423 | const Standard_Address IndexPtr = BP.Indices(); | |
424 | status = HLRAlgo_EdgeStatus(0.,(Standard_ShortReal)myTolParam,1.,(Standard_ShortReal)myTolParam); | |
425 | Index = ShapeIndex; | |
426 | reg1 = BP.Rg1Line(); | |
427 | regn = BP.RgNLine(); | |
428 | outl = BP.OutLine(); | |
429 | intl = BP.IntLine(); | |
430 | if (BP.Hidden()) | |
431 | status.HideAll(); | |
432 | else { | |
433 | Standard_Boolean HidingShell; | |
434 | TColStd_Array1OfTransient& Shell = myHShell->ChangeArray1(); | |
435 | Handle(HLRAlgo_PolyShellData)* psd = | |
436 | (Handle(HLRAlgo_PolyShellData)*)&(Shell.ChangeValue(1)); | |
437 | ||
438 | for (Standard_Integer s = 1; s <= myNbrShell; s++) { | |
439 | if ((*psd)->Hiding()) { | |
440 | const Standard_Address ShellIndices = (*psd)->Indices(); | |
441 | if (((MaxShell - MinSeg) & 0x80100200) == 0 && | |
442 | ((MaxSeg - MinShell) & 0x80100000) == 0) { | |
443 | HidingShell = (s == myCurShell); | |
444 | TColStd_Array1OfTransient& Face = (*psd)->HidingPolyData(); | |
445 | Standard_Integer nbFace = Face.Upper(); | |
446 | Handle(HLRAlgo_PolyData)* pd = | |
447 | (Handle(HLRAlgo_PolyData)*)&(Face.ChangeValue(1)); | |
448 | ||
449 | for (Standard_Integer f = 1; f <= nbFace; f++) { | |
450 | (*pd)->HideByPolyData(Coordinates, | |
451 | (Standard_Address)myRealPtr, | |
452 | IndexPtr, | |
453 | HidingShell, | |
454 | status); | |
455 | pd++; | |
456 | } | |
457 | } | |
458 | } | |
459 | psd++; | |
460 | } | |
461 | } | |
462 | } | |
463 | ||
464 | //======================================================================= | |
465 | //function : NextShow | |
466 | //purpose : | |
467 | //======================================================================= | |
468 | ||
469 | void HLRAlgo_PolyAlgo::NextShow () | |
470 | { | |
471 | myFound = Standard_False; | |
472 | if (myCurShell != 0) { | |
473 | mySegListIt.Next(); | |
474 | if (mySegListIt.More()) myFound = Standard_True; | |
475 | } | |
476 | if (!myFound) { | |
477 | myCurShell++; | |
478 | ||
479 | while (myCurShell <= myNbrShell && !myFound) { | |
480 | mySegListIt.Initialize((*(Handle(HLRAlgo_PolyShellData)*)& | |
481 | (myHShell->ChangeValue(myCurShell))) | |
482 | ->Edges()); | |
483 | if (mySegListIt.More()) myFound = Standard_True; | |
484 | else myCurShell++; | |
485 | } | |
486 | } | |
487 | } | |
488 | ||
489 | //======================================================================= | |
490 | //function : Show | |
491 | //purpose : | |
492 | //======================================================================= | |
493 | ||
494 | void HLRAlgo_PolyAlgo::Show (Standard_Address& Coordinates, | |
495 | Standard_Integer& Index, | |
496 | Standard_Boolean& reg1, | |
497 | Standard_Boolean& regn, | |
498 | Standard_Boolean& outl, | |
499 | Standard_Boolean& intl) | |
500 | { | |
501 | HLRAlgo_BiPoint& BP = mySegListIt.Value(); | |
502 | Standard_Address IndexPtr = BP.Indices(); | |
503 | Coordinates = BP.Coordinates(); | |
504 | Index = ShapeIndex; | |
505 | reg1 = BP.Rg1Line(); | |
506 | regn = BP.RgNLine(); | |
507 | outl = BP.OutLine(); | |
508 | intl = BP.IntLine(); | |
509 | } | |
510 |