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.
17 #include <Standard_Stream.hxx>
18 #include <HLRBRep_InternalAlgo.ixx>
20 #include <Standard_ErrorHandler.hxx>
21 #include <TColStd_Array1OfReal.hxx>
22 #include <HLRAlgo.hxx>
23 #include <HLRBRep_ShapeToHLR.hxx>
24 #include <HLRBRep_Hider.hxx>
27 extern Standard_Integer nbPtIntersection; // total P.I.
28 extern Standard_Integer nbSegIntersection; // total S.I
29 extern Standard_Integer nbClassification; // total classification
30 extern Standard_Integer nbOkIntersection; // pairs of intersecting edges
31 extern Standard_Integer nbCal1Intersection; // pairs of unrejected edges
32 extern Standard_Integer nbCal2Intersection; // true intersections (not vertex)
33 extern Standard_Integer nbCal3Intersection; // curve-surface intersections
35 static Standard_Integer TRACE = Standard_True;
36 static Standard_Integer TRACE10 = Standard_True;
38 #define MinShBI1 MinMaxShBI[ 0]
39 #define MinShBI2 MinMaxShBI[ 1]
40 #define MinShBI3 MinMaxShBI[ 2]
41 #define MinShBI4 MinMaxShBI[ 3]
42 #define MinShBI5 MinMaxShBI[ 4]
43 #define MinShBI6 MinMaxShBI[ 5]
44 #define MinShBI7 MinMaxShBI[ 6]
45 #define MinShBI8 MinMaxShBI[ 7]
46 #define MaxShBI1 MinMaxShBI[ 8]
47 #define MaxShBI2 MinMaxShBI[ 9]
48 #define MaxShBI3 MinMaxShBI[10]
49 #define MaxShBI4 MinMaxShBI[11]
50 #define MaxShBI5 MinMaxShBI[12]
51 #define MaxShBI6 MinMaxShBI[13]
52 #define MaxShBI7 MinMaxShBI[14]
53 #define MaxShBI8 MinMaxShBI[15]
55 #define MinShBJ1 MinMaxShBJ[ 0]
56 #define MinShBJ2 MinMaxShBJ[ 1]
57 #define MinShBJ3 MinMaxShBJ[ 2]
58 #define MinShBJ4 MinMaxShBJ[ 3]
59 #define MinShBJ5 MinMaxShBJ[ 4]
60 #define MinShBJ6 MinMaxShBJ[ 5]
61 #define MinShBJ7 MinMaxShBJ[ 6]
62 #define MinShBJ8 MinMaxShBJ[ 7]
63 #define MaxShBJ1 MinMaxShBJ[ 8]
64 #define MaxShBJ2 MinMaxShBJ[ 9]
65 #define MaxShBJ3 MinMaxShBJ[10]
66 #define MaxShBJ4 MinMaxShBJ[11]
67 #define MaxShBJ5 MinMaxShBJ[12]
68 #define MaxShBJ6 MinMaxShBJ[13]
69 #define MaxShBJ7 MinMaxShBJ[14]
70 #define MaxShBJ8 MinMaxShBJ[15]
72 //=======================================================================
73 //function : HLRBRep_InternalAlgo
75 //=======================================================================
77 HLRBRep_InternalAlgo::HLRBRep_InternalAlgo () :
78 myDebug (Standard_False)
82 //=======================================================================
83 //function : HLRBRep_InternalAlgo
85 //=======================================================================
87 HLRBRep_InternalAlgo::
88 HLRBRep_InternalAlgo (const Handle(HLRBRep_InternalAlgo)& A)
90 myDS = A->DataStructure();
91 myProj = A->Projector();
92 myShapes = A->SeqOfShapeBounds();
96 //=======================================================================
97 //function : Projector
99 //=======================================================================
101 void HLRBRep_InternalAlgo::Projector (const HLRAlgo_Projector& P)
106 //=======================================================================
107 //function : Projector
109 //=======================================================================
111 HLRAlgo_Projector & HLRBRep_InternalAlgo::Projector ()
114 //=======================================================================
117 //=======================================================================
119 void HLRBRep_InternalAlgo::Update ()
121 if (!myShapes.IsEmpty()) {
122 Standard_Integer n = myShapes.Length();
123 Handle(HLRBRep_Data) *DS = new Handle(HLRBRep_Data) [n];
125 Standard_Integer i,dv,de,df,nv=0,ne=0,nf=0;
127 for (i = 1; i <= n; i++) {
128 HLRBRep_ShapeBounds& SB = myShapes(i);
131 DS[i-1] = HLRBRep_ShapeToHLR::Load(SB.Shape(),
135 dv = DS[i-1]->NbVertices();
136 de = DS[i-1]->NbEdges ();
137 df = DS[i-1]->NbFaces ();
139 catch(Standard_Failure) {
142 cout << "An exception was catched when preparing the Shape " << i;
143 cout << " and computing its OutLines " << endl;
144 Handle(Standard_Failure) fail = Standard_Failure::Caught();
145 cout << fail << endl;
147 DS[i-1] = new HLRBRep_Data(0,0,0);
153 SB = HLRBRep_ShapeBounds
154 (SB.Shape(),SB.ShapeData(),SB.NbOfIso(),1,dv,1,de,1,df);
160 if (n == 1) myDS = DS[0];
162 myDS = new HLRBRep_Data(nv,ne,nf);
167 for (i = 1; i <= n; i++) {
168 HLRBRep_ShapeBounds& SB = myShapes(i);
170 SB.Translate(nv,ne,nf);
171 myDS->Write(DS[i-1],nv,ne,nf);
180 myDS->Update(myProj);
182 Standard_Integer ShapMin[16],ShapMax[16],MinMaxShap[16];
183 Standard_Integer TheMin[16],TheMax[16];
185 for (i = 1; i <= n; i++) {
186 Standard_Boolean FirstTime = Standard_True;
187 HLRBRep_ShapeBounds& SB = myShapes(i);
188 Standard_Integer v1,v2,e1,e2,f1,f2;
189 SB.Bounds(v1,v2,e1,e2,f1,f2);
191 HLRBRep_EdgeData* ed = &(myDS->EDataArray (). ChangeValue(e1 - 1));
192 HLRBRep_FaceData* fd = &(myDS->FDataArray (). ChangeValue(f1 - 1));
196 for (Standard_Integer e = e1; e <= e2; e++) {
197 HLRAlgo::DecodeMinMax(ed->MinMax(),
198 (Standard_Address)TheMin,
199 (Standard_Address)TheMax);
201 FirstTime = Standard_False;
202 HLRAlgo::CopyMinMax((Standard_Address)TheMin,
203 (Standard_Address)TheMax,
204 (Standard_Address)ShapMin,
205 (Standard_Address)ShapMax);
208 HLRAlgo::AddMinMax((Standard_Address)TheMin,
209 (Standard_Address)TheMax,
210 (Standard_Address)ShapMin,
211 (Standard_Address)ShapMax);
215 for (Standard_Integer f = f1; f <= f2; f++) {
216 HLRAlgo::DecodeMinMax(fd->Wires()->MinMax(),
217 (Standard_Address)TheMin,
218 (Standard_Address)TheMax);
219 HLRAlgo::AddMinMax((Standard_Address)TheMin,
220 (Standard_Address)TheMax,
221 (Standard_Address)ShapMin,
222 (Standard_Address)ShapMax);
225 HLRAlgo::EncodeMinMax((Standard_Address)ShapMin,
226 (Standard_Address)ShapMax,
227 (Standard_Address)MinMaxShap);
228 SB.UpdateMinMax((Standard_Address)MinMaxShap);
233 //=======================================================================
236 //=======================================================================
238 void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
239 const Handle(MMgt_TShared)& SData,
240 const Standard_Integer nbIso)
242 myShapes.Append(HLRBRep_ShapeBounds(S,SData,nbIso,0,0,0,0,0,0));
246 //=======================================================================
249 //=======================================================================
251 void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
252 const Standard_Integer nbIso)
254 myShapes.Append(HLRBRep_ShapeBounds(S,nbIso,0,0,0,0,0,0));
258 //=======================================================================
261 //=======================================================================
263 Standard_Integer HLRBRep_InternalAlgo::
264 Index (const Handle(HLRTopoBRep_OutLiner)& S) const
266 Standard_Integer n = myShapes.Length();
268 for (Standard_Integer i = 1; i <= n; i++)
269 if (myShapes(i).Shape() == S) return i;
274 //=======================================================================
277 //=======================================================================
279 void HLRBRep_InternalAlgo::Remove (const Standard_Integer I)
281 Standard_OutOfRange_Raise_if
282 (I == 0 || I > myShapes.Length(),
283 "HLRBRep_InternalAlgo::Remove : unknown Shape");
286 myMapOfShapeTool.Clear();
290 //=======================================================================
291 //function : ShapeData
293 //=======================================================================
295 void HLRBRep_InternalAlgo::ShapeData (const Standard_Integer I,
296 const Handle(MMgt_TShared)& SData)
298 Standard_OutOfRange_Raise_if
299 (I == 0 || I > myShapes.Length(),
300 "HLRBRep_InternalAlgo::ShapeData : unknown Shape");
302 myShapes(I).ShapeData(SData);
305 //=======================================================================
306 //function : SeqOfShapeBounds
308 //=======================================================================
310 HLRBRep_SeqOfShapeBounds & HLRBRep_InternalAlgo::SeqOfShapeBounds ()
315 //=======================================================================
316 //function : NbShapes
318 //=======================================================================
320 Standard_Integer HLRBRep_InternalAlgo::NbShapes () const
321 { return myShapes.Length(); }
323 //=======================================================================
324 //function : ShapeBounds
326 //=======================================================================
328 HLRBRep_ShapeBounds & HLRBRep_InternalAlgo::
329 ShapeBounds (const Standard_Integer I)
331 Standard_OutOfRange_Raise_if
332 (I == 0 || I > myShapes.Length(),
333 "HLRBRep_InternalAlgo::ShapeBounds : unknown Shape");
338 //=======================================================================
339 //function : InitEdgeStatus
341 //=======================================================================
343 void HLRBRep_InternalAlgo::InitEdgeStatus ()
345 Standard_Boolean visible;
346 HLRBRep_FaceIterator faceIt;
348 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
349 HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
350 Standard_Integer ne = myDS->NbEdges();
351 Standard_Integer nf = myDS->NbFaces();
353 for (Standard_Integer e = 1; e <= ne; e++) {
354 if (ed->Selected()) ed->Status().ShowAll();
357 // for (Standard_Integer f = 1; f <= nf; f++) {
359 for ( f = 1; f <= nf; f++) {
360 if (fd->Selected()) {
362 for (faceIt.InitEdge(*fd);
365 HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(faceIt.Edge()));
366 if (edf->Selected()) edf->Status().HideAll();
372 fd = &(myDS->FDataArray().ChangeValue(1));
374 for (f = 1; f <= nf; f++) {
375 visible = Standard_True;
376 if (fd->Selected() && fd->Closed()) {
377 if ( fd->Side()) visible = Standard_False;
378 else if ( !fd->WithOutL()) {
379 switch (fd->Orientation()) {
380 case TopAbs_REVERSED : visible = fd->Back() ; break;
381 case TopAbs_FORWARD : visible = !fd->Back() ; break;
382 case TopAbs_EXTERNAL :
383 case TopAbs_INTERNAL : visible = Standard_True; break;
389 for (faceIt.InitEdge(*fd);
392 Standard_Integer E = faceIt.Edge();
393 HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(E));
394 if ( edf->Selected() &&
396 edf->Status().ShowAll();
403 //=======================================================================
406 //=======================================================================
408 void HLRBRep_InternalAlgo::Select ()
410 if (!myDS.IsNull()) {
411 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
412 HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
413 Standard_Integer ne = myDS->NbEdges();
414 Standard_Integer nf = myDS->NbFaces();
416 for (Standard_Integer e = 1; e <= ne; e++) {
417 ed->Selected(Standard_True);
421 for (Standard_Integer f = 1; f <= nf; f++) {
422 fd->Selected(Standard_True);
428 //=======================================================================
431 //=======================================================================
433 void HLRBRep_InternalAlgo::Select (const Standard_Integer I)
435 if (!myDS.IsNull()) {
436 Standard_OutOfRange_Raise_if
437 (I == 0 || I > myShapes.Length(),
438 "HLRBRep_InternalAlgo::Select : unknown Shape");
440 Standard_Integer v1,v2,e1,e2,f1,f2;
441 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
443 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
444 HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
445 Standard_Integer ne = myDS->NbEdges();
446 Standard_Integer nf = myDS->NbFaces();
448 for (Standard_Integer e = 1; e <= ne; e++) {
449 ed->Selected(e >= e1 && e <= e2);
453 for (Standard_Integer f = 1; f <= nf; f++) {
454 fd->Selected(f >= f1 && f <= f2);
460 //=======================================================================
461 //function : SelectEdge
463 //=======================================================================
465 void HLRBRep_InternalAlgo::SelectEdge (const Standard_Integer I)
467 if (!myDS.IsNull()) {
468 Standard_OutOfRange_Raise_if
469 (I == 0 || I > myShapes.Length(),
470 "HLRBRep_InternalAlgo::SelectEdge : unknown Shape");
472 Standard_Integer v1,v2,e1,e2,f1,f2;
473 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
475 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
476 Standard_Integer ne = myDS->NbEdges();
478 for (Standard_Integer e = 1; e <= ne; e++) {
479 ed->Selected(e >= e1 && e <= e2);
485 //=======================================================================
486 //function : SelectFace
488 //=======================================================================
490 void HLRBRep_InternalAlgo::SelectFace (const Standard_Integer I)
492 if (!myDS.IsNull()) {
493 Standard_OutOfRange_Raise_if
494 (I == 0 || I > myShapes.Length(),
495 "HLRBRep_InternalAlgo::SelectFace : unknown Shape");
497 Standard_Integer v1,v2,e1,e2,f1,f2;
498 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
500 HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
501 Standard_Integer nf = myDS->NbFaces();
503 for (Standard_Integer f = 1; f <= nf; f++) {
504 fd->Selected(f >= f1 && f <= f2);
510 //=======================================================================
513 //=======================================================================
515 void HLRBRep_InternalAlgo::ShowAll ()
517 if (!myDS.IsNull()) {
518 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
519 Standard_Integer ne = myDS->NbEdges();
521 for (Standard_Integer ie = 1; ie <= ne; ie++) {
522 ed->Status().ShowAll();
528 //=======================================================================
531 //=======================================================================
533 void HLRBRep_InternalAlgo::ShowAll (const Standard_Integer I)
535 if (!myDS.IsNull()) {
536 Standard_OutOfRange_Raise_if
537 (I == 0 || I > myShapes.Length(),
538 "HLRBRep_InternalAlgo::ShowAll : unknown Shape");
542 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
543 Standard_Integer ne = myDS->NbEdges();
545 for (Standard_Integer e = 1; e <= ne; e++) {
546 if (ed->Selected()) ed->Status().ShowAll();
552 //=======================================================================
555 //=======================================================================
557 void HLRBRep_InternalAlgo::HideAll ()
559 if (!myDS.IsNull()) {
560 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
561 Standard_Integer ne = myDS->NbEdges();
563 for (Standard_Integer ie = 1; ie <= ne; ie++) {
564 ed->Status().HideAll();
570 //=======================================================================
573 //=======================================================================
575 void HLRBRep_InternalAlgo::HideAll (const Standard_Integer I)
577 if (!myDS.IsNull()) {
578 Standard_OutOfRange_Raise_if
579 (I == 0 || I > myShapes.Length(),
580 "HLRBRep_InternalAlgo::HideAll : unknown Shape");
584 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
585 Standard_Integer ne = myDS->NbEdges();
587 for (Standard_Integer e = 1; e <= ne; e++) {
588 if (ed->Selected()) ed->Status().HideAll();
594 //=======================================================================
595 //function : PartialHide
597 //=======================================================================
599 void HLRBRep_InternalAlgo::PartialHide ()
601 if (!myDS.IsNull()) {
602 Standard_Integer i,n = myShapes.Length();
605 cout << " Partial hiding" << endl << endl;
607 for (i = 1; i <= n; i++)
614 //=======================================================================
617 //=======================================================================
619 void HLRBRep_InternalAlgo::Hide ()
621 if (!myDS.IsNull()) {
622 Standard_Integer i,j,n = myShapes.Length();
625 cout << " Total hiding" << endl;
627 for (i = 1; i <= n; i++)
630 for (i = 1; i <= n; i++)
631 for (j = 1; j <= n; j++)
632 if (i != j) Hide(i,j);
638 //=======================================================================
641 //=======================================================================
643 void HLRBRep_InternalAlgo::Hide (const Standard_Integer I)
645 if (!myDS.IsNull()) {
646 Standard_OutOfRange_Raise_if
647 (I == 0 || I > myShapes.Length(),
648 "HLRBRep_InternalAlgo::Hide : unknown Shape");
651 cout << " hiding the shape " << I << " by itself" << endl;
655 HideSelected(I,Standard_True);
659 //=======================================================================
662 //=======================================================================
664 void HLRBRep_InternalAlgo::Hide (const Standard_Integer I,
665 const Standard_Integer J)
667 if (!myDS.IsNull()) {
668 Standard_OutOfRange_Raise_if
669 (I == 0 || I > myShapes.Length() ||
670 J == 0 || J > myShapes.Length(),
671 "HLRBRep_InternalAlgo::Hide : unknown Shapes");
675 Standard_Integer* MinMaxShBI =
676 (Standard_Integer*)myShapes(I).MinMax();
677 Standard_Integer* MinMaxShBJ =
678 (Standard_Integer*)myShapes(J).MinMax();
679 if (((MaxShBJ1 - MinShBI1) & 0x80008000) == 0 &&
680 ((MaxShBI1 - MinShBJ1) & 0x80008000) == 0 &&
681 ((MaxShBJ2 - MinShBI2) & 0x80008000) == 0 &&
682 ((MaxShBI2 - MinShBJ2) & 0x80008000) == 0 &&
683 ((MaxShBJ3 - MinShBI3) & 0x80008000) == 0 &&
684 ((MaxShBI3 - MinShBJ3) & 0x80008000) == 0 &&
685 ((MaxShBJ4 - MinShBI4) & 0x80008000) == 0 &&
686 ((MaxShBI4 - MinShBJ4) & 0x80008000) == 0 &&
687 ((MaxShBJ5 - MinShBI5) & 0x80008000) == 0 &&
688 ((MaxShBI5 - MinShBJ5) & 0x80008000) == 0 &&
689 ((MaxShBJ6 - MinShBI6) & 0x80008000) == 0 &&
690 ((MaxShBI6 - MinShBJ6) & 0x80008000) == 0 &&
691 ((MaxShBJ7 - MinShBI7) & 0x80008000) == 0 &&
692 ((MaxShBJ8 - MinShBI8) & 0x80008000) == 0) {
694 cout << " hiding the shape " << I;
695 cout << " by the shape : " << J << endl;
699 HideSelected(I,Standard_False);
705 //=======================================================================
706 //function : HideSelected
708 //=======================================================================
710 void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
711 const Standard_Boolean SideFace)
713 Standard_Integer e,f,j,nbVisEdges,nbSelEdges,nbSelFaces,nbCache;
714 Standard_Integer nbFSide,nbFSimp;
718 nbPtIntersection = 0;
719 nbSegIntersection = 0;
720 nbOkIntersection = 0;
721 nbClassification = 0;
722 nbCal1Intersection = 0;
723 nbCal2Intersection = 0;
724 nbCal3Intersection = 0;
728 HLRBRep_ShapeBounds& SB = myShapes(I);
729 Standard_Integer v1,v2,e1,e2,f1,f2;
730 SB.Bounds(v1,v2,e1,e2,f1,f2);
733 myDS->InitBoundSort(SB.MinMax(),e1,e2);
734 HLRBRep_Hider Cache(myDS);
735 HLRBRep_EdgeData* ed = &(myDS->EDataArray().ChangeValue(1));
736 HLRBRep_FaceData* fd = &(myDS->FDataArray().ChangeValue(1));
737 Standard_Integer ne = myDS->NbEdges();
738 Standard_Integer nf = myDS->NbFaces();
748 for (e = 1; e <= ne; e++) {
749 if (ed->Selected()) {
751 if (!ed->Status().AllHidden()) nbVisEdges++;
756 for (f = 1; f <= nf; f++) {
757 if (fd->Selected()) {
759 if (fd->Hiding()) nbCache++;
760 if (fd->Side ()) nbFSide++;
761 if (fd->Simple()) nbFSimp++;
769 cout << "Vertices : " << setw(5) << myDS->NbVertices() << endl;
770 cout << "Edges : " << setw(5) << myDS->NbEdges() << " , ";
771 cout << "Selected : " << setw(5) << nbSelEdges << " , ";
772 cout << "Visibles : " << setw(5) << nbVisEdges << endl;
773 cout << "Faces : " << setw(5) << myDS->NbFaces() << " , ";
774 cout << "Selected : " << setw(5) << nbSelFaces << " , ";
775 cout << "Simple : " << setw(5) << nbFSimp << endl;
777 cout << "Side : " << setw(5) << nbFSide << " , ";
778 cout << "Cachantes : " << setw(5) << nbCache << endl << endl;
782 Standard_Integer QWE=0,QWEQWE;
787 fd = &(myDS->FDataArray().ChangeValue(1));
789 for (f = 1; f <= nf; f++) {
790 if (fd->Selected()) {
800 if (myDebug && TRACE) {
802 cout << " OwnHiding " << j << " of face : " << f << endl;
814 TColStd_Array1OfInteger Val(1, nf);
815 TColStd_Array1OfReal Size(1, nf);
816 TColStd_Array1OfInteger Index(1, nf);
819 fd = &(myDS->FDataArray().ChangeValue(1));
820 for (f = 1; f <= nf; f++) {
821 if(fd->Plane()) Val(f)=10;
822 else if(fd->Cylinder()) Val(f)=9;
823 else if(fd->Cone()) Val(f)=8;
824 else if(fd->Sphere()) Val(f)=7;
825 else if(fd->Torus()) Val(f)=6;
827 if(fd->Cut()) Val(f)-=10;
828 if(fd->Side()) Val(f)-=100;
829 if(fd->WithOutL()) Val(f)-=20;
835 for(Standard_Integer tt=1;tt<=nf;tt++) {
839 //-- ======================================================================
840 /* Standard_Boolean TriOk; //-- a refaire
842 Standard_Integer t,tp1;
844 for(t=1,tp1=2;t<nf;t++,tp1++) {
845 if(Val(Index(t))<Val(Index(tp1))) {
846 Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
847 TriOk=Standard_False;
849 else if(Val(Index(t))==Val(Index(tp1))) {
850 if(Size(Index(t))<Size(Index(tp1))) {
851 Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
852 TriOk=Standard_False;
857 while(TriOk==Standard_False);
859 //-- ======================================================================
861 Standard_Integer i,ir,j,l;
862 Standard_Integer rra;
881 if(Val(Index(j)) > Val(Index(j+1)))
883 else if(Val(Index(j)) == Val(Index(j+1))) {
884 if(Size(Index(j)) > Size(Index(j+1)))
888 if(Val(rra) > Val(Index(j))) {
893 else if((Val(rra) == Val(Index(j))) && (Size(rra) > Size(Index(j)))) {
907 HLRBRep_Array1OfFData& FD = myDS->FDataArray();
910 for (f = 1; f <= nf; f++) {
911 Standard_Integer fi = Index(f);
912 fd=&(FD.ChangeValue(fi));
913 if (fd->Selected()) {
915 if(TRACE10 && TRACE==Standard_False) {
922 else if (myDebug && TRACE) {
925 printf("%6d",fi); fflush(stdout);
926 if(++rty>25) { rty=0; printf("\n"); }
928 Cache.Hide(fi,myMapOfShapeTool);
935 fd = &(myDS->FDataArray().ChangeValue(1));
938 for (f = 1; f <= nf; f++) {
939 if (fd->Selected() && fd->Simple())
945 cout << "Simple Faces : ";
946 cout << nbFSimp << "\n";
947 cout << "Intersections calculees : ";
948 cout << nbCal2Intersection << "\n";
949 cout << "Intersections Ok : ";
950 cout << nbOkIntersection << "\n";
952 cout << nbPtIntersection << "\n";
953 cout << "Segments : ";
954 cout << nbSegIntersection << "\n";
955 cout << "Classification : ";
956 cout << nbClassification << "\n";
957 cout << "Intersections curve-surface : ";
958 cout << nbCal3Intersection << "\n";
959 cout << endl << endl;
965 //=======================================================================
968 //=======================================================================
970 void HLRBRep_InternalAlgo::Debug (const Standard_Boolean deb)
973 //=======================================================================
976 //=======================================================================
978 Standard_Boolean HLRBRep_InternalAlgo::Debug () const
981 //=======================================================================
982 //function : DataStructure
984 //=======================================================================
986 Handle(HLRBRep_Data) HLRBRep_InternalAlgo::DataStructure () const