1 // Created on: 1997-04-17
2 // Created by: Christophe MARION
3 // Copyright (c) 1997-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.
18 #include <HLRAlgo.hxx>
19 #include <HLRAlgo_Projector.hxx>
20 #include <HLRBRep_Data.hxx>
21 #include <HLRBRep_Hider.hxx>
22 #include <HLRBRep_InternalAlgo.hxx>
23 #include <HLRBRep_ShapeBounds.hxx>
24 #include <HLRBRep_ShapeToHLR.hxx>
25 #include <HLRTopoBRep_OutLiner.hxx>
26 #include <MMgt_TShared.hxx>
27 #include <Standard_ErrorHandler.hxx>
28 #include <Standard_OutOfRange.hxx>
29 #include <Standard_Stream.hxx>
30 #include <Standard_Type.hxx>
31 #include <TColStd_Array1OfReal.hxx>
34 IMPLEMENT_STANDARD_RTTIEXT(HLRBRep_InternalAlgo,MMgt_TShared)
36 extern Standard_Integer nbPtIntersection; // total P.I.
37 extern Standard_Integer nbSegIntersection; // total S.I
38 extern Standard_Integer nbClassification; // total classification
39 extern Standard_Integer nbOkIntersection; // pairs of intersecting edges
40 extern Standard_Integer nbCal1Intersection; // pairs of unrejected edges
41 extern Standard_Integer nbCal2Intersection; // true intersections (not vertex)
42 extern Standard_Integer nbCal3Intersection; // curve-surface intersections
44 static Standard_Integer TRACE = Standard_True;
45 static Standard_Integer TRACE10 = Standard_True;
47 #define MinShBI1 MinMaxShBI[ 0]
48 #define MinShBI2 MinMaxShBI[ 1]
49 #define MinShBI3 MinMaxShBI[ 2]
50 #define MinShBI4 MinMaxShBI[ 3]
51 #define MinShBI5 MinMaxShBI[ 4]
52 #define MinShBI6 MinMaxShBI[ 5]
53 #define MinShBI7 MinMaxShBI[ 6]
54 #define MinShBI8 MinMaxShBI[ 7]
55 #define MaxShBI1 MinMaxShBI[ 8]
56 #define MaxShBI2 MinMaxShBI[ 9]
57 #define MaxShBI3 MinMaxShBI[10]
58 #define MaxShBI4 MinMaxShBI[11]
59 #define MaxShBI5 MinMaxShBI[12]
60 #define MaxShBI6 MinMaxShBI[13]
61 #define MaxShBI7 MinMaxShBI[14]
62 #define MaxShBI8 MinMaxShBI[15]
64 #define MinShBJ1 MinMaxShBJ[ 0]
65 #define MinShBJ2 MinMaxShBJ[ 1]
66 #define MinShBJ3 MinMaxShBJ[ 2]
67 #define MinShBJ4 MinMaxShBJ[ 3]
68 #define MinShBJ5 MinMaxShBJ[ 4]
69 #define MinShBJ6 MinMaxShBJ[ 5]
70 #define MinShBJ7 MinMaxShBJ[ 6]
71 #define MinShBJ8 MinMaxShBJ[ 7]
72 #define MaxShBJ1 MinMaxShBJ[ 8]
73 #define MaxShBJ2 MinMaxShBJ[ 9]
74 #define MaxShBJ3 MinMaxShBJ[10]
75 #define MaxShBJ4 MinMaxShBJ[11]
76 #define MaxShBJ5 MinMaxShBJ[12]
77 #define MaxShBJ6 MinMaxShBJ[13]
78 #define MaxShBJ7 MinMaxShBJ[14]
79 #define MaxShBJ8 MinMaxShBJ[15]
81 //=======================================================================
82 //function : HLRBRep_InternalAlgo
84 //=======================================================================
86 HLRBRep_InternalAlgo::HLRBRep_InternalAlgo () :
87 myDebug (Standard_False)
91 //=======================================================================
92 //function : HLRBRep_InternalAlgo
94 //=======================================================================
96 HLRBRep_InternalAlgo::
97 HLRBRep_InternalAlgo (const Handle(HLRBRep_InternalAlgo)& A)
99 myDS = A->DataStructure();
100 myProj = A->Projector();
101 myShapes = A->SeqOfShapeBounds();
102 myDebug = A->Debug();
105 //=======================================================================
106 //function : Projector
108 //=======================================================================
110 void HLRBRep_InternalAlgo::Projector (const HLRAlgo_Projector& P)
115 //=======================================================================
116 //function : Projector
118 //=======================================================================
120 HLRAlgo_Projector & HLRBRep_InternalAlgo::Projector ()
123 //=======================================================================
126 //=======================================================================
128 void HLRBRep_InternalAlgo::Update ()
130 if (!myShapes.IsEmpty()) {
131 Standard_Integer n = myShapes.Length();
132 Handle(HLRBRep_Data) *DS = new Handle(HLRBRep_Data) [n];
134 Standard_Integer i,dv,de,df,nv=0,ne=0,nf=0;
136 for (i = 1; i <= n; i++) {
137 HLRBRep_ShapeBounds& SB = myShapes(i);
140 DS[i-1] = HLRBRep_ShapeToHLR::Load(SB.Shape(),
144 dv = DS[i-1]->NbVertices();
145 de = DS[i-1]->NbEdges ();
146 df = DS[i-1]->NbFaces ();
148 catch(Standard_Failure) {
151 cout << "An exception was catched when preparing the Shape " << i;
152 cout << " and computing its OutLines " << endl;
153 Handle(Standard_Failure) fail = Standard_Failure::Caught();
154 cout << fail << endl;
156 DS[i-1] = new HLRBRep_Data(0,0,0);
162 SB = HLRBRep_ShapeBounds
163 (SB.Shape(),SB.ShapeData(),SB.NbOfIso(),1,dv,1,de,1,df);
169 if (n == 1) myDS = DS[0];
171 myDS = new HLRBRep_Data(nv,ne,nf);
176 for (i = 1; i <= n; i++) {
177 HLRBRep_ShapeBounds& SB = myShapes(i);
179 SB.Translate(nv,ne,nf);
180 myDS->Write(DS[i-1],nv,ne,nf);
189 myDS->Update(myProj);
191 Standard_Integer ShapMin[16],ShapMax[16],MinMaxShap[16];
192 Standard_Integer TheMin[16],TheMax[16];
193 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
194 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
196 for (i = 1; i <= n; i++) {
197 Standard_Boolean FirstTime = Standard_True;
198 HLRBRep_ShapeBounds& SB = myShapes(i);
199 Standard_Integer v1,v2,e1,e2,f1,f2;
200 SB.Bounds(v1,v2,e1,e2,f1,f2);
202 for (Standard_Integer e = e1; e <= e2; e++) {
203 HLRBRep_EdgeData ed = aEDataArray.ChangeValue(e);
204 HLRAlgo::DecodeMinMax(ed.MinMax(),
205 (Standard_Address)TheMin,
206 (Standard_Address)TheMax);
208 FirstTime = Standard_False;
209 HLRAlgo::CopyMinMax((Standard_Address)TheMin,
210 (Standard_Address)TheMax,
211 (Standard_Address)ShapMin,
212 (Standard_Address)ShapMax);
215 HLRAlgo::AddMinMax((Standard_Address)TheMin,
216 (Standard_Address)TheMax,
217 (Standard_Address)ShapMin,
218 (Standard_Address)ShapMax);
221 for (Standard_Integer f = f1; f <= f2; f++) {
222 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
223 HLRAlgo::DecodeMinMax(fd.Wires()->MinMax(),
224 (Standard_Address)TheMin,
225 (Standard_Address)TheMax);
226 HLRAlgo::AddMinMax((Standard_Address)TheMin,
227 (Standard_Address)TheMax,
228 (Standard_Address)ShapMin,
229 (Standard_Address)ShapMax);
231 HLRAlgo::EncodeMinMax((Standard_Address)ShapMin,
232 (Standard_Address)ShapMax,
233 (Standard_Address)MinMaxShap);
234 SB.UpdateMinMax((Standard_Address)MinMaxShap);
239 //=======================================================================
242 //=======================================================================
244 void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
245 const Handle(MMgt_TShared)& SData,
246 const Standard_Integer nbIso)
248 myShapes.Append(HLRBRep_ShapeBounds(S,SData,nbIso,0,0,0,0,0,0));
252 //=======================================================================
255 //=======================================================================
257 void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
258 const Standard_Integer nbIso)
260 myShapes.Append(HLRBRep_ShapeBounds(S,nbIso,0,0,0,0,0,0));
264 //=======================================================================
267 //=======================================================================
269 Standard_Integer HLRBRep_InternalAlgo::
270 Index (const Handle(HLRTopoBRep_OutLiner)& S) const
272 Standard_Integer n = myShapes.Length();
274 for (Standard_Integer i = 1; i <= n; i++)
275 if (myShapes(i).Shape() == S) return i;
280 //=======================================================================
283 //=======================================================================
285 void HLRBRep_InternalAlgo::Remove (const Standard_Integer I)
287 Standard_OutOfRange_Raise_if
288 (I == 0 || I > myShapes.Length(),
289 "HLRBRep_InternalAlgo::Remove : unknown Shape");
292 myMapOfShapeTool.Clear();
296 //=======================================================================
297 //function : ShapeData
299 //=======================================================================
301 void HLRBRep_InternalAlgo::ShapeData (const Standard_Integer I,
302 const Handle(MMgt_TShared)& SData)
304 Standard_OutOfRange_Raise_if
305 (I == 0 || I > myShapes.Length(),
306 "HLRBRep_InternalAlgo::ShapeData : unknown Shape");
308 myShapes(I).ShapeData(SData);
311 //=======================================================================
312 //function : SeqOfShapeBounds
314 //=======================================================================
316 HLRBRep_SeqOfShapeBounds & HLRBRep_InternalAlgo::SeqOfShapeBounds ()
321 //=======================================================================
322 //function : NbShapes
324 //=======================================================================
326 Standard_Integer HLRBRep_InternalAlgo::NbShapes () const
327 { return myShapes.Length(); }
329 //=======================================================================
330 //function : ShapeBounds
332 //=======================================================================
334 HLRBRep_ShapeBounds & HLRBRep_InternalAlgo::
335 ShapeBounds (const Standard_Integer I)
337 Standard_OutOfRange_Raise_if
338 (I == 0 || I > myShapes.Length(),
339 "HLRBRep_InternalAlgo::ShapeBounds : unknown Shape");
344 //=======================================================================
345 //function : InitEdgeStatus
347 //=======================================================================
349 void HLRBRep_InternalAlgo::InitEdgeStatus ()
351 Standard_Boolean visible;
352 HLRBRep_FaceIterator faceIt;
354 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
355 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
356 Standard_Integer ne = myDS->NbEdges();
357 Standard_Integer nf = myDS->NbFaces();
359 for (Standard_Integer e = 1; e <= ne; e++) {
360 HLRBRep_EdgeData ed = aEDataArray.ChangeValue(e);
361 if (ed.Selected()) ed.Status().ShowAll();
363 // for (Standard_Integer f = 1; f <= nf; f++) {
365 for ( f = 1; f <= nf; f++) {
366 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
369 for (faceIt.InitEdge(fd);
372 HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(faceIt.Edge()));
373 if (edf->Selected()) edf->Status().HideAll();
378 for (f = 1; f <= nf; f++) {
379 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
380 visible = Standard_True;
381 if (fd.Selected() && fd.Closed()) {
382 if ( fd.Side()) visible = Standard_False;
383 else if ( !fd.WithOutL()) {
384 switch (fd.Orientation()) {
385 case TopAbs_REVERSED : visible = fd.Back() ; break;
386 case TopAbs_FORWARD : visible = !fd.Back() ; break;
387 case TopAbs_EXTERNAL :
388 case TopAbs_INTERNAL : visible = Standard_True; break;
394 for (faceIt.InitEdge(fd);
397 Standard_Integer E = faceIt.Edge();
398 HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(E));
399 if ( edf->Selected() &&
401 edf->Status().ShowAll();
407 //=======================================================================
410 //=======================================================================
412 void HLRBRep_InternalAlgo::Select ()
414 if (!myDS.IsNull()) {
415 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
416 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
417 Standard_Integer ne = myDS->NbEdges();
418 Standard_Integer nf = myDS->NbFaces();
420 for (Standard_Integer e = 1; e <= ne; e++) {
421 HLRBRep_EdgeData ed = aEDataArray.ChangeValue(e);
422 ed.Selected(Standard_True);
425 for (Standard_Integer f = 1; f <= nf; f++) {
426 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
427 fd.Selected(Standard_True);
432 //=======================================================================
435 //=======================================================================
437 void HLRBRep_InternalAlgo::Select (const Standard_Integer I)
439 if (!myDS.IsNull()) {
440 Standard_OutOfRange_Raise_if
441 (I == 0 || I > myShapes.Length(),
442 "HLRBRep_InternalAlgo::Select : unknown Shape");
444 Standard_Integer v1,v2,e1,e2,f1,f2;
445 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
447 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
448 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
449 Standard_Integer ne = myDS->NbEdges();
450 Standard_Integer nf = myDS->NbFaces();
452 for (Standard_Integer e = 1; e <= ne; e++) {
453 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
454 ed.Selected(e >= e1 && e <= e2);
457 for (Standard_Integer f = 1; f <= nf; f++) {
458 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
459 fd.Selected(f >= f1 && f <= f2);
464 //=======================================================================
465 //function : SelectEdge
467 //=======================================================================
469 void HLRBRep_InternalAlgo::SelectEdge (const Standard_Integer I)
471 if (!myDS.IsNull()) {
472 Standard_OutOfRange_Raise_if
473 (I == 0 || I > myShapes.Length(),
474 "HLRBRep_InternalAlgo::SelectEdge : unknown Shape");
476 Standard_Integer v1,v2,e1,e2,f1,f2;
477 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
479 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
480 Standard_Integer ne = myDS->NbEdges();
482 for (Standard_Integer e = 1; e <= ne; e++) {
483 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
484 ed.Selected(e >= e1 && e <= e2);
489 //=======================================================================
490 //function : SelectFace
492 //=======================================================================
494 void HLRBRep_InternalAlgo::SelectFace (const Standard_Integer I)
496 if (!myDS.IsNull()) {
497 Standard_OutOfRange_Raise_if
498 (I == 0 || I > myShapes.Length(),
499 "HLRBRep_InternalAlgo::SelectFace : unknown Shape");
501 Standard_Integer v1,v2,e1,e2,f1,f2;
502 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
504 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
505 Standard_Integer nf = myDS->NbFaces();
507 for (Standard_Integer f = 1; f <= nf; f++) {
508 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
509 fd.Selected(f >= f1 && f <= f2);
514 //=======================================================================
517 //=======================================================================
519 void HLRBRep_InternalAlgo::ShowAll ()
521 if (!myDS.IsNull()) {
522 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
523 Standard_Integer ne = myDS->NbEdges();
525 for (Standard_Integer ie = 1; ie <= ne; ie++) {
526 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(ie);
527 ed.Status().ShowAll();
532 //=======================================================================
535 //=======================================================================
537 void HLRBRep_InternalAlgo::ShowAll (const Standard_Integer I)
539 if (!myDS.IsNull()) {
540 Standard_OutOfRange_Raise_if
541 (I == 0 || I > myShapes.Length(),
542 "HLRBRep_InternalAlgo::ShowAll : unknown Shape");
546 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
547 Standard_Integer ne = myDS->NbEdges();
549 for (Standard_Integer e = 1; e <= ne; e++) {
550 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
551 if (ed.Selected()) ed.Status().ShowAll();
556 //=======================================================================
559 //=======================================================================
561 void HLRBRep_InternalAlgo::HideAll ()
563 if (!myDS.IsNull()) {
564 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
565 Standard_Integer ne = myDS->NbEdges();
567 for (Standard_Integer ie = 1; ie <= ne; ie++) {
568 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(ie);
569 ed.Status().HideAll();
574 //=======================================================================
577 //=======================================================================
579 void HLRBRep_InternalAlgo::HideAll (const Standard_Integer I)
581 if (!myDS.IsNull()) {
582 Standard_OutOfRange_Raise_if
583 (I == 0 || I > myShapes.Length(),
584 "HLRBRep_InternalAlgo::HideAll : unknown Shape");
588 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
589 Standard_Integer ne = myDS->NbEdges();
591 for (Standard_Integer e = 1; e <= ne; e++) {
592 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
593 if (ed.Selected()) ed.Status().HideAll();
598 //=======================================================================
599 //function : PartialHide
601 //=======================================================================
603 void HLRBRep_InternalAlgo::PartialHide ()
605 if (!myDS.IsNull()) {
606 Standard_Integer i,n = myShapes.Length();
609 cout << " Partial hiding" << endl << endl;
611 for (i = 1; i <= n; i++)
618 //=======================================================================
621 //=======================================================================
623 void HLRBRep_InternalAlgo::Hide ()
625 if (!myDS.IsNull()) {
626 Standard_Integer i,j,n = myShapes.Length();
629 cout << " Total hiding" << endl;
631 for (i = 1; i <= n; i++)
634 for (i = 1; i <= n; i++)
635 for (j = 1; j <= n; j++)
636 if (i != j) Hide(i,j);
642 //=======================================================================
645 //=======================================================================
647 void HLRBRep_InternalAlgo::Hide (const Standard_Integer I)
649 if (!myDS.IsNull()) {
650 Standard_OutOfRange_Raise_if
651 (I == 0 || I > myShapes.Length(),
652 "HLRBRep_InternalAlgo::Hide : unknown Shape");
655 cout << " hiding the shape " << I << " by itself" << endl;
659 HideSelected(I,Standard_True);
663 //=======================================================================
666 //=======================================================================
668 void HLRBRep_InternalAlgo::Hide (const Standard_Integer I,
669 const Standard_Integer J)
671 if (!myDS.IsNull()) {
672 Standard_OutOfRange_Raise_if
673 (I == 0 || I > myShapes.Length() ||
674 J == 0 || J > myShapes.Length(),
675 "HLRBRep_InternalAlgo::Hide : unknown Shapes");
679 Standard_Integer* MinMaxShBI =
680 (Standard_Integer*)myShapes(I).MinMax();
681 Standard_Integer* MinMaxShBJ =
682 (Standard_Integer*)myShapes(J).MinMax();
683 if (((MaxShBJ1 - MinShBI1) & 0x80008000) == 0 &&
684 ((MaxShBI1 - MinShBJ1) & 0x80008000) == 0 &&
685 ((MaxShBJ2 - MinShBI2) & 0x80008000) == 0 &&
686 ((MaxShBI2 - MinShBJ2) & 0x80008000) == 0 &&
687 ((MaxShBJ3 - MinShBI3) & 0x80008000) == 0 &&
688 ((MaxShBI3 - MinShBJ3) & 0x80008000) == 0 &&
689 ((MaxShBJ4 - MinShBI4) & 0x80008000) == 0 &&
690 ((MaxShBI4 - MinShBJ4) & 0x80008000) == 0 &&
691 ((MaxShBJ5 - MinShBI5) & 0x80008000) == 0 &&
692 ((MaxShBI5 - MinShBJ5) & 0x80008000) == 0 &&
693 ((MaxShBJ6 - MinShBI6) & 0x80008000) == 0 &&
694 ((MaxShBI6 - MinShBJ6) & 0x80008000) == 0 &&
695 ((MaxShBJ7 - MinShBI7) & 0x80008000) == 0 &&
696 ((MaxShBJ8 - MinShBI8) & 0x80008000) == 0) {
698 cout << " hiding the shape " << I;
699 cout << " by the shape : " << J << endl;
703 HideSelected(I,Standard_False);
709 //=======================================================================
710 //function : HideSelected
712 //=======================================================================
714 void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
715 const Standard_Boolean SideFace)
717 Standard_Integer e,f,j,nbVisEdges,nbSelEdges,nbSelFaces,nbCache;
718 Standard_Integer nbFSide,nbFSimp;
722 nbPtIntersection = 0;
723 nbSegIntersection = 0;
724 nbOkIntersection = 0;
725 nbClassification = 0;
726 nbCal1Intersection = 0;
727 nbCal2Intersection = 0;
728 nbCal3Intersection = 0;
732 HLRBRep_ShapeBounds& SB = myShapes(I);
733 Standard_Integer v1,v2,e1,e2,f1,f2;
734 SB.Bounds(v1,v2,e1,e2,f1,f2);
737 myDS->InitBoundSort(SB.MinMax(),e1,e2);
738 HLRBRep_Hider Cache(myDS);
739 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
740 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
741 Standard_Integer ne = myDS->NbEdges();
742 Standard_Integer nf = myDS->NbFaces();
752 for (e = 1; e <= ne; e++) {
753 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
756 if (!ed.Status().AllHidden()) nbVisEdges++;
760 for (f = 1; f <= nf; f++) {
761 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
764 if (fd.Hiding()) nbCache++;
765 if (fd.Side ()) nbFSide++;
766 if (fd.Simple()) nbFSimp++;
773 cout << "Vertices : " << setw(5) << myDS->NbVertices() << endl;
774 cout << "Edges : " << setw(5) << myDS->NbEdges() << " , ";
775 cout << "Selected : " << setw(5) << nbSelEdges << " , ";
776 cout << "Visibles : " << setw(5) << nbVisEdges << endl;
777 cout << "Faces : " << setw(5) << myDS->NbFaces() << " , ";
778 cout << "Selected : " << setw(5) << nbSelFaces << " , ";
779 cout << "Simple : " << setw(5) << nbFSimp << endl;
781 cout << "Side : " << setw(5) << nbFSide << " , ";
782 cout << "Cachantes : " << setw(5) << nbCache << endl << endl;
789 Standard_Integer QWE=0,QWEQWE;
795 for (f = 1; f <= nf; f++) {
796 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
807 if (myDebug && TRACE) {
809 cout << " OwnHiding " << j << " of face : " << f << endl;
820 TColStd_Array1OfInteger Val(1, nf);
821 TColStd_Array1OfReal Size(1, nf);
822 TColStd_Array1OfInteger Index(1, nf);
825 for (f = 1; f <= nf; f++) {
826 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
827 if (fd.Plane()) Val(f) = 10;
828 else if(fd.Cylinder()) Val(f)=9;
829 else if(fd.Cone()) Val(f)=8;
830 else if(fd.Sphere()) Val(f)=7;
831 else if(fd.Torus()) Val(f)=6;
833 if(fd.Cut()) Val(f)-=10;
834 if(fd.Side()) Val(f)-=100;
835 if(fd.WithOutL()) Val(f)-=20;
840 for(Standard_Integer tt=1;tt<=nf;tt++) {
844 //-- ======================================================================
845 /* Standard_Boolean TriOk; //-- a refaire
847 Standard_Integer t,tp1;
849 for(t=1,tp1=2;t<nf;t++,tp1++) {
850 if(Val(Index(t))<Val(Index(tp1))) {
851 Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
852 TriOk=Standard_False;
854 else if(Val(Index(t))==Val(Index(tp1))) {
855 if(Size(Index(t))<Size(Index(tp1))) {
856 Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
857 TriOk=Standard_False;
862 while(TriOk==Standard_False);
864 //-- ======================================================================
866 Standard_Integer i,ir,k,l;
867 Standard_Integer rra;
886 if(Val(Index(k)) > Val(Index(k+1)))
888 else if(Val(Index(k)) == Val(Index(k+1))) {
889 if(Size(Index(k)) > Size(Index(k+1)))
893 if(Val(rra) > Val(Index(k))) {
898 else if((Val(rra) == Val(Index(k))) && (Size(rra) > Size(Index(k)))) {
914 for (f = 1; f <= nf; f++) {
915 Standard_Integer fi = Index(f);
916 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(fi);
919 if(TRACE10 && TRACE==Standard_False) {
926 else if (myDebug && TRACE) {
929 printf("%6d",fi); fflush(stdout);
930 if(++rty>25) { rty=0; printf("\n"); }
932 Cache.Hide(fi,myMapOfShapeTool);
941 for (f = 1; f <= nf; f++) {
942 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
943 if (fd.Selected() && fd.Simple())
948 cout << "Simple Faces : ";
949 cout << nbFSimp << "\n";
950 cout << "Intersections calculees : ";
951 cout << nbCal2Intersection << "\n";
952 cout << "Intersections Ok : ";
953 cout << nbOkIntersection << "\n";
955 cout << nbPtIntersection << "\n";
956 cout << "Segments : ";
957 cout << nbSegIntersection << "\n";
958 cout << "Classification : ";
959 cout << nbClassification << "\n";
960 cout << "Intersections curve-surface : ";
961 cout << nbCal3Intersection << "\n";
962 cout << endl << endl;
968 //=======================================================================
971 //=======================================================================
973 void HLRBRep_InternalAlgo::Debug (const Standard_Boolean deb)
976 //=======================================================================
979 //=======================================================================
981 Standard_Boolean HLRBRep_InternalAlgo::Debug () const
984 //=======================================================================
985 //function : DataStructure
987 //=======================================================================
989 Handle(HLRBRep_Data) HLRBRep_InternalAlgo::DataStructure () const