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 <HLRBRep_Data.hxx>
20 #include <HLRBRep_Hider.hxx>
21 #include <HLRBRep_InternalAlgo.hxx>
22 #include <HLRBRep_ShapeBounds.hxx>
23 #include <HLRBRep_ShapeToHLR.hxx>
24 #include <HLRTopoBRep_OutLiner.hxx>
25 #include <Standard_Transient.hxx>
26 #include <Standard_ErrorHandler.hxx>
27 #include <Standard_OutOfRange.hxx>
28 #include <Standard_Stream.hxx>
29 #include <Standard_Type.hxx>
30 #include <TColStd_Array1OfReal.hxx>
33 IMPLEMENT_STANDARD_RTTIEXT(HLRBRep_InternalAlgo,Standard_Transient)
35 extern Standard_Integer nbPtIntersection; // total P.I.
36 extern Standard_Integer nbSegIntersection; // total S.I
37 extern Standard_Integer nbClassification; // total classification
38 extern Standard_Integer nbOkIntersection; // pairs of intersecting edges
39 extern Standard_Integer nbCal1Intersection; // pairs of unrejected edges
40 extern Standard_Integer nbCal2Intersection; // true intersections (not vertex)
41 extern Standard_Integer nbCal3Intersection; // curve-surface intersections
43 static Standard_Integer HLRBRep_InternalAlgo_TRACE = Standard_True;
44 static Standard_Integer HLRBRep_InternalAlgo_TRACE10 = Standard_True;
46 //=======================================================================
47 //function : HLRBRep_InternalAlgo
49 //=======================================================================
51 HLRBRep_InternalAlgo::HLRBRep_InternalAlgo () :
52 myDebug (Standard_False)
56 //=======================================================================
57 //function : HLRBRep_InternalAlgo
59 //=======================================================================
61 HLRBRep_InternalAlgo::
62 HLRBRep_InternalAlgo (const Handle(HLRBRep_InternalAlgo)& A)
64 myDS = A->DataStructure();
65 myProj = A->Projector();
66 myShapes = A->SeqOfShapeBounds();
70 //=======================================================================
71 //function : Projector
73 //=======================================================================
75 void HLRBRep_InternalAlgo::Projector (const HLRAlgo_Projector& P)
80 //=======================================================================
81 //function : Projector
83 //=======================================================================
85 HLRAlgo_Projector & HLRBRep_InternalAlgo::Projector ()
88 //=======================================================================
91 //=======================================================================
93 void HLRBRep_InternalAlgo::Update ()
95 if (!myShapes.IsEmpty()) {
96 Standard_Integer n = myShapes.Length();
97 Handle(HLRBRep_Data) *DS = new Handle(HLRBRep_Data) [n];
99 Standard_Integer i,dv,de,df,nv=0,ne=0,nf=0;
101 for (i = 1; i <= n; i++) {
102 HLRBRep_ShapeBounds& SB = myShapes(i);
105 DS[i-1] = HLRBRep_ShapeToHLR::Load(SB.Shape(),
109 dv = DS[i-1]->NbVertices();
110 de = DS[i-1]->NbEdges ();
111 df = DS[i-1]->NbFaces ();
113 catch(Standard_Failure const& anException) {
116 std::cout << "An exception was caught when preparing the Shape " << i;
117 std::cout << " and computing its OutLines " << std::endl;
118 std::cout << anException << std::endl;
120 DS[i-1] = new HLRBRep_Data(0,0,0);
126 SB = HLRBRep_ShapeBounds
127 (SB.Shape(),SB.ShapeData(),SB.NbOfIso(),1,dv,1,de,1,df);
133 if (n == 1) myDS = DS[0];
135 myDS = new HLRBRep_Data(nv,ne,nf);
140 for (i = 1; i <= n; i++) {
141 HLRBRep_ShapeBounds& SB = myShapes(i);
143 SB.Translate(nv,ne,nf);
144 myDS->Write(DS[i-1],nv,ne,nf);
153 myDS->Update(myProj);
155 HLRAlgo_EdgesBlock::MinMaxIndices ShapMin, ShapMax, MinMaxShap;
156 HLRAlgo_EdgesBlock::MinMaxIndices TheMin, TheMax;
157 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
158 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
160 for (i = 1; i <= n; i++) {
161 Standard_Boolean FirstTime = Standard_True;
162 HLRBRep_ShapeBounds& SB = myShapes(i);
163 Standard_Integer v1,v2,e1,e2,f1,f2;
164 SB.Bounds(v1,v2,e1,e2,f1,f2);
166 for (Standard_Integer e = e1; e <= e2; e++) {
167 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
168 HLRAlgo::DecodeMinMax(ed.MinMax(), TheMin, TheMax);
170 FirstTime = Standard_False;
171 HLRAlgo::CopyMinMax(TheMin, TheMax, ShapMin, ShapMax);
174 HLRAlgo::AddMinMax(TheMin, TheMax, ShapMin, ShapMax);
177 for (Standard_Integer f = f1; f <= f2; f++) {
178 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
179 HLRAlgo::DecodeMinMax(fd.Wires()->MinMax(), TheMin, TheMax);
180 HLRAlgo::AddMinMax(TheMin, TheMax, ShapMin, ShapMax);
182 HLRAlgo::EncodeMinMax(ShapMin, ShapMax, MinMaxShap);
183 SB.UpdateMinMax(MinMaxShap);
188 //=======================================================================
191 //=======================================================================
193 void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
194 const Handle(Standard_Transient)& SData,
195 const Standard_Integer nbIso)
197 myShapes.Append(HLRBRep_ShapeBounds(S,SData,nbIso,0,0,0,0,0,0));
201 //=======================================================================
204 //=======================================================================
206 void HLRBRep_InternalAlgo::Load (const Handle(HLRTopoBRep_OutLiner)& S,
207 const Standard_Integer nbIso)
209 myShapes.Append(HLRBRep_ShapeBounds(S,nbIso,0,0,0,0,0,0));
213 //=======================================================================
216 //=======================================================================
218 Standard_Integer HLRBRep_InternalAlgo::
219 Index (const Handle(HLRTopoBRep_OutLiner)& S) const
221 Standard_Integer n = myShapes.Length();
223 for (Standard_Integer i = 1; i <= n; i++)
224 if (myShapes(i).Shape() == S) return i;
229 //=======================================================================
232 //=======================================================================
234 void HLRBRep_InternalAlgo::Remove (const Standard_Integer I)
236 Standard_OutOfRange_Raise_if
237 (I == 0 || I > myShapes.Length(),
238 "HLRBRep_InternalAlgo::Remove : unknown Shape");
241 myMapOfShapeTool.Clear();
245 //=======================================================================
246 //function : ShapeData
248 //=======================================================================
250 void HLRBRep_InternalAlgo::ShapeData (const Standard_Integer I,
251 const Handle(Standard_Transient)& SData)
253 Standard_OutOfRange_Raise_if
254 (I == 0 || I > myShapes.Length(),
255 "HLRBRep_InternalAlgo::ShapeData : unknown Shape");
257 myShapes(I).ShapeData(SData);
260 //=======================================================================
261 //function : SeqOfShapeBounds
263 //=======================================================================
265 HLRBRep_SeqOfShapeBounds & HLRBRep_InternalAlgo::SeqOfShapeBounds ()
270 //=======================================================================
271 //function : NbShapes
273 //=======================================================================
275 Standard_Integer HLRBRep_InternalAlgo::NbShapes () const
276 { return myShapes.Length(); }
278 //=======================================================================
279 //function : ShapeBounds
281 //=======================================================================
283 HLRBRep_ShapeBounds & HLRBRep_InternalAlgo::
284 ShapeBounds (const Standard_Integer I)
286 Standard_OutOfRange_Raise_if
287 (I == 0 || I > myShapes.Length(),
288 "HLRBRep_InternalAlgo::ShapeBounds : unknown Shape");
293 //=======================================================================
294 //function : InitEdgeStatus
296 //=======================================================================
298 void HLRBRep_InternalAlgo::InitEdgeStatus ()
300 Standard_Boolean visible;
301 HLRBRep_FaceIterator faceIt;
303 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
304 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
305 Standard_Integer ne = myDS->NbEdges();
306 Standard_Integer nf = myDS->NbFaces();
308 for (Standard_Integer e = 1; e <= ne; e++) {
309 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
310 if (ed.Selected()) ed.Status().ShowAll();
312 // for (Standard_Integer f = 1; f <= nf; f++) {
314 for ( f = 1; f <= nf; f++) {
315 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
318 for (faceIt.InitEdge(fd);
321 HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(faceIt.Edge()));
322 if (edf->Selected()) edf->Status().HideAll();
327 for (f = 1; f <= nf; f++) {
328 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
329 visible = Standard_True;
330 if (fd.Selected() && fd.Closed()) {
331 if ( fd.Side()) visible = Standard_False;
332 else if ( !fd.WithOutL()) {
333 switch (fd.Orientation()) {
334 case TopAbs_REVERSED : visible = fd.Back() ; break;
335 case TopAbs_FORWARD : visible = !fd.Back() ; break;
336 case TopAbs_EXTERNAL :
337 case TopAbs_INTERNAL : visible = Standard_True; break;
343 for (faceIt.InitEdge(fd);
346 Standard_Integer E = faceIt.Edge();
347 HLRBRep_EdgeData* edf = &(myDS->EDataArray().ChangeValue(E));
348 if ( edf->Selected() &&
350 edf->Status().ShowAll();
356 //=======================================================================
359 //=======================================================================
361 void HLRBRep_InternalAlgo::Select ()
363 if (!myDS.IsNull()) {
364 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
365 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
366 Standard_Integer ne = myDS->NbEdges();
367 Standard_Integer nf = myDS->NbFaces();
369 for (Standard_Integer e = 1; e <= ne; e++) {
370 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
371 ed.Selected(Standard_True);
374 for (Standard_Integer f = 1; f <= nf; f++) {
375 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
376 fd.Selected(Standard_True);
381 //=======================================================================
384 //=======================================================================
386 void HLRBRep_InternalAlgo::Select (const Standard_Integer I)
388 if (!myDS.IsNull()) {
389 Standard_OutOfRange_Raise_if
390 (I == 0 || I > myShapes.Length(),
391 "HLRBRep_InternalAlgo::Select : unknown Shape");
393 Standard_Integer v1,v2,e1,e2,f1,f2;
394 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
396 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
397 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
398 Standard_Integer ne = myDS->NbEdges();
399 Standard_Integer nf = myDS->NbFaces();
401 for (Standard_Integer e = 1; e <= ne; e++) {
402 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
403 ed.Selected(e >= e1 && e <= e2);
406 for (Standard_Integer f = 1; f <= nf; f++) {
407 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
408 fd.Selected(f >= f1 && f <= f2);
413 //=======================================================================
414 //function : SelectEdge
416 //=======================================================================
418 void HLRBRep_InternalAlgo::SelectEdge (const Standard_Integer I)
420 if (!myDS.IsNull()) {
421 Standard_OutOfRange_Raise_if
422 (I == 0 || I > myShapes.Length(),
423 "HLRBRep_InternalAlgo::SelectEdge : unknown Shape");
425 Standard_Integer v1,v2,e1,e2,f1,f2;
426 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
428 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
429 Standard_Integer ne = myDS->NbEdges();
431 for (Standard_Integer e = 1; e <= ne; e++) {
432 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
433 ed.Selected(e >= e1 && e <= e2);
438 //=======================================================================
439 //function : SelectFace
441 //=======================================================================
443 void HLRBRep_InternalAlgo::SelectFace (const Standard_Integer I)
445 if (!myDS.IsNull()) {
446 Standard_OutOfRange_Raise_if
447 (I == 0 || I > myShapes.Length(),
448 "HLRBRep_InternalAlgo::SelectFace : unknown Shape");
450 Standard_Integer v1,v2,e1,e2,f1,f2;
451 myShapes(I).Bounds(v1,v2,e1,e2,f1,f2);
453 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
454 Standard_Integer nf = myDS->NbFaces();
456 for (Standard_Integer f = 1; f <= nf; f++) {
457 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
458 fd.Selected(f >= f1 && f <= f2);
463 //=======================================================================
466 //=======================================================================
468 void HLRBRep_InternalAlgo::ShowAll ()
470 if (!myDS.IsNull()) {
471 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
472 Standard_Integer ne = myDS->NbEdges();
474 for (Standard_Integer ie = 1; ie <= ne; ie++) {
475 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(ie);
476 ed.Status().ShowAll();
481 //=======================================================================
484 //=======================================================================
486 void HLRBRep_InternalAlgo::ShowAll (const Standard_Integer I)
488 if (!myDS.IsNull()) {
489 Standard_OutOfRange_Raise_if
490 (I == 0 || I > myShapes.Length(),
491 "HLRBRep_InternalAlgo::ShowAll : unknown Shape");
495 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
496 Standard_Integer ne = myDS->NbEdges();
498 for (Standard_Integer e = 1; e <= ne; e++) {
499 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
500 if (ed.Selected()) ed.Status().ShowAll();
505 //=======================================================================
508 //=======================================================================
510 void HLRBRep_InternalAlgo::HideAll ()
512 if (!myDS.IsNull()) {
513 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
514 Standard_Integer ne = myDS->NbEdges();
516 for (Standard_Integer ie = 1; ie <= ne; ie++) {
517 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(ie);
518 ed.Status().HideAll();
523 //=======================================================================
526 //=======================================================================
528 void HLRBRep_InternalAlgo::HideAll (const Standard_Integer I)
530 if (!myDS.IsNull()) {
531 Standard_OutOfRange_Raise_if
532 (I == 0 || I > myShapes.Length(),
533 "HLRBRep_InternalAlgo::HideAll : unknown Shape");
537 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
538 Standard_Integer ne = myDS->NbEdges();
540 for (Standard_Integer e = 1; e <= ne; e++) {
541 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
542 if (ed.Selected()) ed.Status().HideAll();
547 //=======================================================================
548 //function : PartialHide
550 //=======================================================================
552 void HLRBRep_InternalAlgo::PartialHide ()
554 if (!myDS.IsNull()) {
555 Standard_Integer i,n = myShapes.Length();
558 std::cout << " Partial hiding" << std::endl << std::endl;
560 for (i = 1; i <= n; i++)
567 //=======================================================================
570 //=======================================================================
572 void HLRBRep_InternalAlgo::Hide ()
574 if (!myDS.IsNull()) {
575 Standard_Integer i,j,n = myShapes.Length();
578 std::cout << " Total hiding" << std::endl;
580 for (i = 1; i <= n; i++)
583 for (i = 1; i <= n; i++)
584 for (j = 1; j <= n; j++)
585 if (i != j) Hide(i,j);
591 //=======================================================================
594 //=======================================================================
596 void HLRBRep_InternalAlgo::Hide (const Standard_Integer I)
598 if (!myDS.IsNull()) {
599 Standard_OutOfRange_Raise_if
600 (I == 0 || I > myShapes.Length(),
601 "HLRBRep_InternalAlgo::Hide : unknown Shape");
604 std::cout << " hiding the shape " << I << " by itself" << std::endl;
608 HideSelected(I,Standard_True);
612 //=======================================================================
615 //=======================================================================
617 void HLRBRep_InternalAlgo::Hide (const Standard_Integer I,
618 const Standard_Integer J)
620 if (!myDS.IsNull()) {
621 Standard_OutOfRange_Raise_if
622 (I == 0 || I > myShapes.Length() ||
623 J == 0 || J > myShapes.Length(),
624 "HLRBRep_InternalAlgo::Hide : unknown Shapes");
628 HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxShBI = &myShapes(I).MinMax();
629 HLRAlgo_EdgesBlock::MinMaxIndices* MinMaxShBJ = &myShapes(J).MinMax();
630 if (((MinMaxShBJ->Max[0] - MinMaxShBI->Min[0]) & 0x80008000) == 0 &&
631 ((MinMaxShBI->Max[0] - MinMaxShBJ->Min[0]) & 0x80008000) == 0 &&
632 ((MinMaxShBJ->Max[1] - MinMaxShBI->Min[1]) & 0x80008000) == 0 &&
633 ((MinMaxShBI->Max[1] - MinMaxShBJ->Min[1]) & 0x80008000) == 0 &&
634 ((MinMaxShBJ->Max[2] - MinMaxShBI->Min[2]) & 0x80008000) == 0 &&
635 ((MinMaxShBI->Max[2] - MinMaxShBJ->Min[2]) & 0x80008000) == 0 &&
636 ((MinMaxShBJ->Max[3] - MinMaxShBI->Min[3]) & 0x80008000) == 0 &&
637 ((MinMaxShBI->Max[3] - MinMaxShBJ->Min[3]) & 0x80008000) == 0 &&
638 ((MinMaxShBJ->Max[4] - MinMaxShBI->Min[4]) & 0x80008000) == 0 &&
639 ((MinMaxShBI->Max[4] - MinMaxShBJ->Min[4]) & 0x80008000) == 0 &&
640 ((MinMaxShBJ->Max[5] - MinMaxShBI->Min[5]) & 0x80008000) == 0 &&
641 ((MinMaxShBI->Max[5] - MinMaxShBJ->Min[5]) & 0x80008000) == 0 &&
642 ((MinMaxShBJ->Max[6] - MinMaxShBI->Min[6]) & 0x80008000) == 0 &&
643 ((MinMaxShBJ->Max[7] - MinMaxShBI->Min[7]) & 0x80008000) == 0) {
645 std::cout << " hiding the shape " << I;
646 std::cout << " by the shape : " << J << std::endl;
650 HideSelected(I,Standard_False);
656 //=======================================================================
657 //function : HideSelected
659 //=======================================================================
661 void HLRBRep_InternalAlgo::HideSelected (const Standard_Integer I,
662 const Standard_Boolean SideFace)
664 Standard_Integer e,f,j,nbVisEdges,nbSelEdges,nbSelFaces,nbCache;
665 Standard_Integer nbFSide,nbFSimp;
669 nbPtIntersection = 0;
670 nbSegIntersection = 0;
671 nbOkIntersection = 0;
672 nbClassification = 0;
673 nbCal1Intersection = 0;
674 nbCal2Intersection = 0;
675 nbCal3Intersection = 0;
679 HLRBRep_ShapeBounds& SB = myShapes(I);
680 Standard_Integer v1,v2,e1,e2,f1,f2;
681 SB.Bounds(v1,v2,e1,e2,f1,f2);
684 myDS->InitBoundSort(SB.MinMax(),e1,e2);
685 HLRBRep_Hider Cache(myDS);
686 HLRBRep_Array1OfEData& aEDataArray = myDS->EDataArray();
687 HLRBRep_Array1OfFData& aFDataArray = myDS->FDataArray();
688 Standard_Integer ne = myDS->NbEdges();
689 Standard_Integer nf = myDS->NbFaces();
699 for (e = 1; e <= ne; e++) {
700 HLRBRep_EdgeData& ed = aEDataArray.ChangeValue(e);
703 if (!ed.Status().AllHidden()) nbVisEdges++;
707 for (f = 1; f <= nf; f++) {
708 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
711 if (fd.Hiding()) nbCache++;
712 if (fd.Side ()) nbFSide++;
713 if (fd.Simple()) nbFSimp++;
719 std::cout << std::endl;
720 std::cout << "Vertices : " << std::setw(5) << myDS->NbVertices() << std::endl;
721 std::cout << "Edges : " << std::setw(5) << myDS->NbEdges() << " , ";
722 std::cout << "Selected : " << std::setw(5) << nbSelEdges << " , ";
723 std::cout << "Visible : " << std::setw(5) << nbVisEdges << std::endl;
724 std::cout << "Faces : " << std::setw(5) << myDS->NbFaces() << " , ";
725 std::cout << "Selected : " << std::setw(5) << nbSelFaces << " , ";
726 std::cout << "Simple : " << std::setw(5) << nbFSimp << std::endl;
728 std::cout << "Side : " << std::setw(5) << nbFSide << " , ";
729 std::cout << "Cachantes : " << std::setw(5) << nbCache << std::endl << std::endl;
736 Standard_Integer QWE=0,QWEQWE;
742 for (f = 1; f <= nf; f++) {
743 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
746 if(HLRBRep_InternalAlgo_TRACE10) {
754 if (myDebug && HLRBRep_InternalAlgo_TRACE) {
756 std::cout << " OwnHiding " << j << " of face : " << f << std::endl;
767 TColStd_Array1OfInteger Val(1, nf);
768 TColStd_Array1OfReal Size(1, nf);
769 TColStd_Array1OfInteger Index(1, nf);
772 for (f = 1; f <= nf; f++) {
773 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
774 if (fd.Plane()) Val(f) = 10;
775 else if(fd.Cylinder()) Val(f)=9;
776 else if(fd.Cone()) Val(f)=8;
777 else if(fd.Sphere()) Val(f)=7;
778 else if(fd.Torus()) Val(f)=6;
780 if(fd.Cut()) Val(f)-=10;
781 if(fd.Side()) Val(f)-=100;
782 if(fd.WithOutL()) Val(f)-=20;
787 for(Standard_Integer tt=1;tt<=nf;tt++) {
791 //-- ======================================================================
792 /* Standard_Boolean TriOk; //-- a refaire
794 Standard_Integer t,tp1;
796 for(t=1,tp1=2;t<nf;t++,tp1++) {
797 if(Val(Index(t))<Val(Index(tp1))) {
798 Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
799 TriOk=Standard_False;
801 else if(Val(Index(t))==Val(Index(tp1))) {
802 if(Size(Index(t))<Size(Index(tp1))) {
803 Standard_Integer q=Index(t); Index(t)=Index(tp1); Index(tp1)=q;
804 TriOk=Standard_False;
809 while(TriOk==Standard_False);
811 //-- ======================================================================
813 Standard_Integer i,ir,k,l;
814 Standard_Integer rra;
833 if(Val(Index(k)) > Val(Index(k+1)))
835 else if(Val(Index(k)) == Val(Index(k+1))) {
836 if(Size(Index(k)) > Size(Index(k+1)))
840 if(Val(rra) > Val(Index(k))) {
845 else if((Val(rra) == Val(Index(k))) && (Size(rra) > Size(Index(k)))) {
861 for (f = 1; f <= nf; f++) {
862 Standard_Integer fi = Index(f);
863 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(fi);
866 if(HLRBRep_InternalAlgo_TRACE10 && HLRBRep_InternalAlgo_TRACE==Standard_False) {
873 else if (myDebug && HLRBRep_InternalAlgo_TRACE) {
876 printf("%6d",fi); fflush(stdout);
877 if(++rty>25) { rty=0; printf("\n"); }
879 Cache.Hide(fi,myMapOfShapeTool);
888 for (f = 1; f <= nf; f++) {
889 HLRBRep_FaceData& fd = aFDataArray.ChangeValue(f);
890 if (fd.Selected() && fd.Simple())
895 std::cout << "Simple Faces : ";
896 std::cout << nbFSimp << "\n";
897 std::cout << "Intersections calculees : ";
898 std::cout << nbCal2Intersection << "\n";
899 std::cout << "Intersections Ok : ";
900 std::cout << nbOkIntersection << "\n";
901 std::cout << "Points : ";
902 std::cout << nbPtIntersection << "\n";
903 std::cout << "Segments : ";
904 std::cout << nbSegIntersection << "\n";
905 std::cout << "Classification : ";
906 std::cout << nbClassification << "\n";
907 std::cout << "Intersections curve-surface : ";
908 std::cout << nbCal3Intersection << "\n";
909 std::cout << std::endl << std::endl;
915 //=======================================================================
918 //=======================================================================
920 void HLRBRep_InternalAlgo::Debug (const Standard_Boolean deb)
923 //=======================================================================
926 //=======================================================================
928 Standard_Boolean HLRBRep_InternalAlgo::Debug () const
931 //=======================================================================
932 //function : DataStructure
934 //=======================================================================
936 Handle(HLRBRep_Data) HLRBRep_InternalAlgo::DataStructure () const