1 // Created on: 1992-05-07
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <IntAna_ListOfCurve.hxx>
23 #include <IntAna_ListIteratorOfListOfCurve.hxx>
26 Standard_Boolean ExploreCurve(const gp_Cylinder& aCy,
29 const Standard_Real aTol,
30 IntAna_ListOfCurve& aLC);
32 Standard_Boolean IsToReverse(const gp_Cylinder& Cy1,
33 const gp_Cylinder& Cy2,
34 const Standard_Real Tol);
36 //=======================================================================
37 //function : ProcessBounds
39 //=======================================================================
40 void ProcessBounds(const Handle(IntPatch_ALine)& alig, //-- ligne courante
41 const IntPatch_SequenceOfLine& slin,
42 const IntSurf_Quadric& Quad1,
43 const IntSurf_Quadric& Quad2,
44 Standard_Boolean& procf,
45 const gp_Pnt& ptf, //-- Debut Ligne Courante
46 const Standard_Real first, //-- Paramf
47 Standard_Boolean& procl,
48 const gp_Pnt& ptl, //-- Fin Ligne courante
49 const Standard_Real last, //-- Paraml
50 Standard_Boolean& Multpoint,
51 const Standard_Real Tol)
54 Standard_Real U1,V1,U2,V2;
59 j = slin.Length() + 1;
66 //-- On prend les lignes deja enregistrees
68 while (j <= slin.Length()) {
69 if(slin.Value(j)->ArcType() == IntPatch_Analytic) {
70 const Handle(IntPatch_ALine)& aligold = *((Handle(IntPatch_ALine)*)&slin.Value(j));
73 //-- On prend les vertex des lignes deja enregistrees
75 while (k <= aligold->NbVertex()) {
76 ptsol = aligold->Vertex(k);
78 d=ptf.Distance(ptsol.Value());
80 if (!ptsol.IsMultiple()) {
81 //-- le point ptsol (de aligold) est declare multiple sur aligold
82 Multpoint = Standard_True;
83 ptsol.SetMultiple(Standard_True);
84 aligold->Replace(k,ptsol);
86 ptsol.SetParameter(first);
87 alig->AddVertex(ptsol);
88 alig->SetFirstPoint(alig->NbVertex());
89 procf = Standard_True;
91 //-- On restore le point avec son parametre sur aligold
92 ptsol = aligold->Vertex(k);
97 if (ptl.Distance(ptsol.Value()) <= Tol) {
98 if (!ptsol.IsMultiple()) {
99 Multpoint = Standard_True;
100 ptsol.SetMultiple(Standard_True);
101 aligold->Replace(k,ptsol);
103 ptsol.SetParameter(last);
104 alig->AddVertex(ptsol);
105 alig->SetLastPoint(alig->NbVertex());
106 procl = Standard_True;
108 //-- On restore le point avec son parametre sur aligold
109 ptsol = aligold->Vertex(k);
113 if (procf && procl) {
114 k = aligold->NbVertex()+1;
120 if (procf && procl) {
128 if (!procf && !procl) {
129 Quad1.Parameters(ptf,U1,V1);
130 Quad2.Parameters(ptf,U2,V2);
131 ptsol.SetValue(ptf,Tol,Standard_False);
132 ptsol.SetParameters(U1,V1,U2,V2);
133 ptsol.SetParameter(first);
134 if (ptf.Distance(ptl) <= Tol) {
135 ptsol.SetMultiple(Standard_True); // a voir
136 Multpoint = Standard_True; // a voir de meme
137 alig->AddVertex(ptsol);
138 alig->SetFirstPoint(alig->NbVertex());
140 ptsol.SetParameter(last);
141 alig->AddVertex(ptsol);
142 alig->SetLastPoint(alig->NbVertex());
145 alig->AddVertex(ptsol);
146 alig->SetFirstPoint(alig->NbVertex());
147 Quad1.Parameters(ptl,U1,V1);
148 Quad2.Parameters(ptl,U2,V2);
149 ptsol.SetValue(ptl,Tol,Standard_False);
150 ptsol.SetParameters(U1,V1,U2,V2);
151 ptsol.SetParameter(last);
152 alig->AddVertex(ptsol);
153 alig->SetLastPoint(alig->NbVertex());
157 Quad1.Parameters(ptf,U1,V1);
158 Quad2.Parameters(ptf,U2,V2);
159 ptsol.SetValue(ptf,Tol,Standard_False);
160 ptsol.SetParameters(U1,V1,U2,V2);
161 ptsol.SetParameter(first);
162 alig->AddVertex(ptsol);
163 alig->SetFirstPoint(alig->NbVertex());
166 Quad1.Parameters(ptl,U1,V1);
167 Quad2.Parameters(ptl,U2,V2);
168 ptsol.SetValue(ptl,Tol,Standard_False);
169 ptsol.SetParameters(U1,V1,U2,V2);
170 ptsol.SetParameter(last);
171 alig->AddVertex(ptsol);
172 alig->SetLastPoint(alig->NbVertex());
175 //=======================================================================
178 //=======================================================================
179 Standard_Boolean IntCyCy(const IntSurf_Quadric& Quad1,
180 const IntSurf_Quadric& Quad2,
181 const Standard_Real Tol,
182 Standard_Boolean& Empty,
183 Standard_Boolean& Same,
184 Standard_Boolean& Multpoint,
185 IntPatch_SequenceOfLine& slin,
186 IntPatch_SequenceOfPoint& spnt)
189 IntPatch_Point ptsol;
193 IntSurf_TypeTrans trans1,trans2;
194 IntAna_ResultType typint;
199 gp_Cylinder Cy1(Quad1.Cylinder());
200 gp_Cylinder Cy2(Quad2.Cylinder());
202 IntAna_QuadQuadGeo inter(Cy1,Cy2,Tol);
204 if (!inter.IsDone()) {return Standard_False;}
206 typint = inter.TypeInter();
207 Standard_Integer NbSol = inter.NbSolutions();
208 Empty = Standard_False;
209 Same = Standard_False;
215 Empty = Standard_True;
221 Same = Standard_True;
228 gp_Pnt psol(inter.Point(1));
229 Standard_Real U1,V1,U2,V2;
230 Quad1.Parameters(psol,U1,V1);
231 Quad2.Parameters(psol,U2,V2);
232 ptsol.SetValue(psol,Tol,Standard_True);
233 ptsol.SetParameters(U1,V1,U2,V2);
241 if (NbSol == 1) { // ligne de tangence
242 linsol = inter.Line(1);
243 ptref = linsol.Location();
244 gp_Dir crb1(gp_Vec(ptref,Cy1.Location()));
245 gp_Dir crb2(gp_Vec(ptref,Cy2.Location()));
246 gp_Vec norm1(Quad1.Normale(ptref));
247 gp_Vec norm2(Quad2.Normale(ptref));
248 IntSurf_Situation situcyl1;
249 IntSurf_Situation situcyl2;
251 if (crb1.Dot(crb2) < 0.) { // centre de courbures "opposes"
252 if (norm1.Dot(crb1) > 0.) {
253 situcyl2 = IntSurf_Inside;
256 situcyl2 = IntSurf_Outside;
258 if (norm2.Dot(crb2) > 0.) {
259 situcyl1 = IntSurf_Inside;
262 situcyl1 = IntSurf_Outside;
266 if (Cy1.Radius() < Cy2.Radius()) {
267 if (norm1.Dot(crb1) > 0.) {
268 situcyl2 = IntSurf_Inside;
271 situcyl2 = IntSurf_Outside;
273 if (norm2.Dot(crb2) > 0.) {
274 situcyl1 = IntSurf_Outside;
277 situcyl1 = IntSurf_Inside;
281 if (norm1.Dot(crb1) > 0.) {
282 situcyl2 = IntSurf_Outside;
285 situcyl2 = IntSurf_Inside;
287 if (norm2.Dot(crb2) > 0.) {
288 situcyl1 = IntSurf_Inside;
291 situcyl1 = IntSurf_Outside;
295 Handle(IntPatch_GLine) glig = new IntPatch_GLine(linsol, Standard_True, situcyl1, situcyl2);
299 for (i=1; i <= NbSol; i++) {
300 linsol = inter.Line(i);
301 ptref = linsol.Location();
302 gp_Vec lsd = linsol.Direction();
303 Standard_Real qwe = lsd.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
304 if (qwe >0.00000001) {
305 trans1 = IntSurf_Out;
308 else if (qwe <-0.00000001) {
310 trans2 = IntSurf_Out;
313 trans1=trans2=IntSurf_Undecided;
316 Handle(IntPatch_GLine) glig = new IntPatch_GLine(linsol, Standard_False,trans1,trans2);
327 IntPatch_Point pmult1, pmult2;
329 elipsol = inter.Ellipse(1);
331 gp_Pnt pttang1(ElCLib::Value(0.5*M_PI, elipsol));
332 gp_Pnt pttang2(ElCLib::Value(1.5*M_PI, elipsol));
334 Multpoint = Standard_True;
335 pmult1.SetValue(pttang1,Tol,Standard_True);
336 pmult2.SetValue(pttang2,Tol,Standard_True);
337 pmult1.SetMultiple(Standard_True);
338 pmult2.SetMultiple(Standard_True);
340 Standard_Real oU1,oV1,oU2,oV2;
341 Quad1.Parameters(pttang1,oU1,oV1);
342 Quad2.Parameters(pttang1,oU2,oV2);
343 pmult1.SetParameters(oU1,oV1,oU2,oV2);
345 Quad1.Parameters(pttang2,oU1,oV1);
346 Quad2.Parameters(pttang2,oU2,oV2);
347 pmult2.SetParameters(oU1,oV1,oU2,oV2);
349 // on traite la premiere ellipse
351 //-- Calcul de la Transition de la ligne
352 ElCLib::D1(0.,elipsol,ptref,Tgt);
353 Standard_Real qwe=Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
354 if (qwe>0.00000001) {
355 trans1 = IntSurf_Out;
358 else if (qwe<-0.00000001) {
360 trans2 = IntSurf_Out;
363 trans1=trans2=IntSurf_Undecided;
365 //-- Transition calculee au point 0 -> Trans2 , Trans1
366 //-- car ici, on devarit calculer en PI
367 Handle(IntPatch_GLine) glig = new IntPatch_GLine(elipsol,Standard_False,trans2,trans1);
370 Standard_Real aU1, aV1, aU2, aV2;
372 gp_Pnt aP (ElCLib::Value(0., elipsol));
374 aIP.SetValue(aP,Tol,Standard_False);
375 aIP.SetMultiple(Standard_False);
377 Quad1.Parameters(aP, aU1, aV1);
378 Quad2.Parameters(aP, aU2, aV2);
379 aIP.SetParameters(aU1, aV1, aU2, aV2);
381 aIP.SetParameter(0.);
382 glig->AddVertex(aIP);
383 glig->SetFirstPoint(1);
385 aIP.SetParameter(2.*M_PI);
386 glig->AddVertex(aIP);
387 glig->SetLastPoint(2);
390 pmult1.SetParameter(0.5*M_PI);
391 glig->AddVertex(pmult1);
393 pmult2.SetParameter(1.5*M_PI);
394 glig->AddVertex(pmult2);
399 //-- Transitions calculee au point 0 OK
401 // on traite la deuxieme ellipse
402 elipsol = inter.Ellipse(2);
404 Standard_Real param1 = ElCLib::Parameter(elipsol,pttang1);
405 Standard_Real param2 = ElCLib::Parameter(elipsol,pttang2);
406 Standard_Real parampourtransition;
407 if (param1 < param2) {
408 pmult1.SetParameter(0.5*M_PI);
409 pmult2.SetParameter(1.5*M_PI);
410 parampourtransition = M_PI;
413 pmult1.SetParameter(1.5*M_PI);
414 pmult2.SetParameter(0.5*M_PI);
415 parampourtransition = 0.0;
418 //-- Calcul des transitions de ligne pour la premiere ligne
419 ElCLib::D1(parampourtransition,elipsol,ptref,Tgt);
420 qwe=Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
421 if(qwe> 0.00000001) {
422 trans1 = IntSurf_Out;
425 else if(qwe< -0.00000001) {
427 trans2 = IntSurf_Out;
430 trans1=trans2=IntSurf_Undecided;
432 //-- La transition a ete calculee sur un point de cette ligne
433 glig = new IntPatch_GLine(elipsol,Standard_False,trans1,trans2);
436 Standard_Real aU1, aV1, aU2, aV2;
438 gp_Pnt aP (ElCLib::Value(0., elipsol));
440 aIP.SetValue(aP,Tol,Standard_False);
441 aIP.SetMultiple(Standard_False);
443 Quad1.Parameters(aP, aU1, aV1);
444 Quad2.Parameters(aP, aU2, aV2);
445 aIP.SetParameters(aU1, aV1, aU2, aV2);
447 aIP.SetParameter(0.);
448 glig->AddVertex(aIP);
449 glig->SetFirstPoint(1);
451 aIP.SetParameter(2.*M_PI);
452 glig->AddVertex(aIP);
453 glig->SetLastPoint(2);
456 glig->AddVertex(pmult1);
457 glig->AddVertex(pmult2);
464 case IntAna_NoGeometricSolution:
466 Standard_Boolean bReverse;
467 Standard_Real U1,V1,U2,V2;
470 bReverse=IsToReverse(Cy1, Cy2, Tol);
472 Cy2=Quad1.Cylinder();
473 Cy1=Quad2.Cylinder();
476 IntAna_IntQuadQuad anaint(Cy1,Cy2,Tol);
477 if (!anaint.IsDone()) {
478 return Standard_False;
481 if (anaint.NbPnt() == 0 && anaint.NbCurve() == 0) {
482 Empty = Standard_True;
485 NbSol = anaint.NbPnt();
486 for (i = 1; i <= NbSol; i++) {
487 psol = anaint.Point(i);
488 Quad1.Parameters(psol,U1,V1);
489 Quad2.Parameters(psol,U2,V2);
490 ptsol.SetValue(psol,Tol,Standard_True);
491 ptsol.SetParameters(U1,V1,U2,V2);
495 gp_Pnt ptvalid, ptf, ptl;
498 Standard_Real first,last,para;
499 IntAna_Curve curvsol;
500 Standard_Boolean tgfound;
501 Standard_Integer kount;
503 NbSol = anaint.NbCurve();
504 for (i = 1; i <= NbSol; i++) {
505 curvsol = anaint.Curve(i);
506 curvsol.Domain(first,last);
507 ptf = curvsol.Value(first);
508 ptl = curvsol.Value(last);
512 tgfound = Standard_False;
515 para = (1.123*first + para)/2.123;
516 tgfound = curvsol.D1u(para,ptvalid,tgvalid);
522 Handle(IntPatch_ALine) alig;
524 Standard_Real qwe = tgvalid.DotCross(Quad2.Normale(ptvalid),
525 Quad1.Normale(ptvalid));
527 trans1 = IntSurf_Out;
530 else if(qwe<-0.00000001) {
532 trans2 = IntSurf_Out;
535 trans1=trans2=IntSurf_Undecided;
537 alig = new IntPatch_ALine(curvsol,Standard_False,trans1,trans2);
540 alig = new IntPatch_ALine(curvsol,Standard_False);
541 //-- cout << "Transition indeterminee" << endl;
543 Standard_Boolean TempFalse1 = Standard_False;
544 Standard_Boolean TempFalse2 = Standard_False;
546 ProcessBounds(alig,slin,Quad1,Quad2,TempFalse1,ptf,first,
547 TempFalse2,ptl,last,Multpoint,Tol);
556 return Standard_False;
559 return Standard_True;
563 //=======================================================================
566 //=======================================================================
567 Standard_Boolean IntCySp(const IntSurf_Quadric& Quad1,
568 const IntSurf_Quadric& Quad2,
569 const Standard_Real Tol,
570 const Standard_Boolean Reversed,
571 Standard_Boolean& Empty,
572 Standard_Boolean& Multpoint,
573 IntPatch_SequenceOfLine& slin,
574 IntPatch_SequenceOfPoint& spnt)
579 IntSurf_TypeTrans trans1,trans2;
580 IntAna_ResultType typint;
581 IntPatch_Point ptsol;
588 Cy = Quad1.Cylinder();
592 Cy = Quad2.Cylinder();
595 IntAna_QuadQuadGeo inter(Cy,Sp,Tol);
597 if (!inter.IsDone()) {return Standard_False;}
599 typint = inter.TypeInter();
600 Standard_Integer NbSol = inter.NbSolutions();
601 Empty = Standard_False;
607 Empty = Standard_True;
613 gp_Pnt psol(inter.Point(1));
614 Standard_Real U1,V1,U2,V2;
615 Quad1.Parameters(psol,U1,V1);
616 Quad2.Parameters(psol,U2,V2);
617 ptsol.SetValue(psol,Tol,Standard_True);
618 ptsol.SetParameters(U1,V1,U2,V2);
625 cirsol = inter.Circle(1);
628 ElCLib::D1(0.,cirsol,ptref,Tgt);
631 gp_Vec TestCurvature(ptref,Sp.Location());
632 gp_Vec Normsp,Normcyl;
634 Normcyl = Quad1.Normale(ptref);
635 Normsp = Quad2.Normale(ptref);
638 Normcyl = Quad2.Normale(ptref);
639 Normsp = Quad1.Normale(ptref);
642 IntSurf_Situation situcyl;
643 IntSurf_Situation situsp;
645 if (Normcyl.Dot(TestCurvature) > 0.) {
646 situsp = IntSurf_Outside;
647 if (Normsp.Dot(Normcyl) > 0.) {
648 situcyl = IntSurf_Inside;
651 situcyl = IntSurf_Outside;
655 situsp = IntSurf_Inside;
656 if (Normsp.Dot(Normcyl) > 0.) {
657 situcyl = IntSurf_Outside;
660 situcyl = IntSurf_Inside;
663 Handle(IntPatch_GLine) glig;
665 glig = new IntPatch_GLine(cirsol, Standard_True, situcyl, situsp);
668 glig = new IntPatch_GLine(cirsol, Standard_True, situsp, situcyl);
673 if (Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref)) > 0.0) {
674 trans1 = IntSurf_Out;
679 trans2 = IntSurf_Out;
681 Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
684 cirsol = inter.Circle(2);
685 ElCLib::D1(0.,cirsol,ptref,Tgt);
686 Standard_Real qwe = Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
688 trans1 = IntSurf_Out;
691 else if(qwe<-0.0000001) {
693 trans2 = IntSurf_Out;
696 trans1=trans2=IntSurf_Undecided;
698 glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
704 case IntAna_NoGeometricSolution:
707 Standard_Real U1,V1,U2,V2;
708 IntAna_IntQuadQuad anaint(Cy,Sp,Tol);
709 if (!anaint.IsDone()) {
710 return Standard_False;
713 if (anaint.NbPnt()==0 && anaint.NbCurve()==0) {
714 Empty = Standard_True;
718 NbSol = anaint.NbPnt();
719 for (i = 1; i <= NbSol; i++) {
720 psol = anaint.Point(i);
721 Quad1.Parameters(psol,U1,V1);
722 Quad2.Parameters(psol,U2,V2);
723 ptsol.SetValue(psol,Tol,Standard_True);
724 ptsol.SetParameters(U1,V1,U2,V2);
728 gp_Pnt ptvalid,ptf,ptl;
730 Standard_Real first,last,para;
731 IntAna_Curve curvsol;
732 Standard_Boolean tgfound;
733 Standard_Integer kount;
735 NbSol = anaint.NbCurve();
736 for (i = 1; i <= NbSol; i++) {
737 curvsol = anaint.Curve(i);
738 curvsol.Domain(first,last);
739 ptf = curvsol.Value(first);
740 ptl = curvsol.Value(last);
744 tgfound = Standard_False;
747 para = (1.123*first + para)/2.123;
748 tgfound = curvsol.D1u(para,ptvalid,tgvalid);
754 Handle(IntPatch_ALine) alig;
756 Standard_Real qwe = tgvalid.DotCross(Quad2.Normale(ptvalid),
757 Quad1.Normale(ptvalid));
758 if(qwe> 0.00000001) {
759 trans1 = IntSurf_Out;
762 else if(qwe<-0.00000001) {
764 trans2 = IntSurf_Out;
767 trans1=trans2=IntSurf_Undecided;
769 alig = new IntPatch_ALine(curvsol,Standard_False,trans1,trans2);
772 alig = new IntPatch_ALine(curvsol,Standard_False);
774 Standard_Boolean TempFalse1a = Standard_False;
775 Standard_Boolean TempFalse2a = Standard_False;
777 //-- ptf et ptl : points debut et fin de alig
779 ProcessBounds(alig,slin,Quad1,Quad2,TempFalse1a,ptf,first,
780 TempFalse2a,ptl,last,Multpoint,Tol);
782 } //-- boucle sur les lignes
783 } //-- solution avec au moins une lihne
789 return Standard_False;
792 return Standard_True;
794 //=======================================================================
797 //=======================================================================
798 Standard_Boolean IntCyCo(const IntSurf_Quadric& Quad1,
799 const IntSurf_Quadric& Quad2,
800 const Standard_Real Tol,
801 const Standard_Boolean Reversed,
802 Standard_Boolean& Empty,
803 Standard_Boolean& Multpoint,
804 IntPatch_SequenceOfLine& slin,
805 IntPatch_SequenceOfPoint& spnt)
808 IntPatch_Point ptsol;
812 IntSurf_TypeTrans trans1,trans2;
813 IntAna_ResultType typint;
820 Cy = Quad1.Cylinder();
824 Cy = Quad2.Cylinder();
827 IntAna_QuadQuadGeo inter(Cy,Co,Tol);
829 if (!inter.IsDone()) {return Standard_False;}
831 typint = inter.TypeInter();
832 Standard_Integer NbSol = inter.NbSolutions();
833 Empty = Standard_False;
837 case IntAna_Empty : {
838 Empty = Standard_True;
843 gp_Pnt psol(inter.Point(1));
844 Standard_Real U1,V1,U2,V2;
845 Quad1.Parameters(psol,U1,V1);
846 Quad1.Parameters(psol,U2,V2);
847 ptsol.SetValue(psol,Tol,Standard_True);
848 ptsol.SetParameters(U1,V1,U2,V2);
853 case IntAna_Circle: {
859 for(j=1; j<=2; ++j) {
860 cirsol = inter.Circle(j);
861 ElCLib::D1(0.,cirsol,ptref,Tgt);
862 qwe = Tgt.DotCross(Quad2.Normale(ptref),Quad1.Normale(ptref));
863 if(qwe> 0.00000001) {
864 trans1 = IntSurf_Out;
867 else if(qwe<-0.00000001) {
869 trans2 = IntSurf_Out;
872 trans1=trans2=IntSurf_Undecided;
874 Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
880 case IntAna_NoGeometricSolution: {
882 Standard_Real U1,V1,U2,V2;
883 IntAna_IntQuadQuad anaint(Cy,Co,Tol);
884 if (!anaint.IsDone()) {
885 return Standard_False;
888 if (anaint.NbPnt() == 0 && anaint.NbCurve() == 0) {
889 Empty = Standard_True;
892 NbSol = anaint.NbPnt();
893 for (i = 1; i <= NbSol; i++) {
894 psol = anaint.Point(i);
895 Quad1.Parameters(psol,U1,V1);
896 Quad2.Parameters(psol,U2,V2);
897 ptsol.SetValue(psol,Tol,Standard_True);
898 ptsol.SetParameters(U1,V1,U2,V2);
902 gp_Pnt ptvalid, ptf, ptl;
905 Standard_Real first,last,para;
906 Standard_Boolean tgfound,firstp,lastp,kept;
907 Standard_Integer kount;
910 //IntAna_Curve curvsol;
912 IntAna_ListOfCurve aLC;
913 IntAna_ListIteratorOfListOfCurve aIt;
914 Standard_Boolean bToSplit;
917 NbSol = anaint.NbCurve();
918 for (i = 1; i <= NbSol; ++i) {
919 kept = Standard_False;
920 //curvsol = anaint.Curve(i);
923 bToSplit=ExploreCurve(Cy, Co, aC, 10.*Tol, aLC);
926 for (; aIt.More(); aIt.Next()) {
927 IntAna_Curve& curvsol=aIt.Value();
929 curvsol.Domain(first, last);
930 firstp = !curvsol.IsFirstOpen();
931 lastp = !curvsol.IsLastOpen();
933 ptf = curvsol.Value(first);
936 ptl = curvsol.Value(last);
940 tgfound = Standard_False;
943 para = (1.123*first + para)/2.123;
944 tgfound = curvsol.D1u(para,ptvalid,tgvalid);
950 Handle(IntPatch_ALine) alig;
952 Standard_Real qwe = tgvalid.DotCross(Quad2.Normale(ptvalid),
953 Quad1.Normale(ptvalid));
954 if(qwe> 0.00000001) {
955 trans1 = IntSurf_Out;
958 else if(qwe<-0.00000001) {
960 trans2 = IntSurf_Out;
963 trans1=trans2=IntSurf_Undecided;
965 alig = new IntPatch_ALine(curvsol,Standard_False,trans1,trans2);
966 kept = Standard_True;
969 ptvalid = curvsol.Value(para);
970 alig = new IntPatch_ALine(curvsol,Standard_False);
971 kept = Standard_True;
972 //-- cout << "Transition indeterminee" << endl;
975 Standard_Boolean Nfirstp = !firstp;
976 Standard_Boolean Nlastp = !lastp;
977 ProcessBounds(alig,slin,Quad1,Quad2,Nfirstp,ptf,first,
978 Nlastp,ptl,last,Multpoint,Tol);
981 } // for (; aIt.More(); aIt.Next())
982 } // for (i = 1; i <= NbSol; ++i)
988 return Standard_False;
992 return Standard_True;
994 //=======================================================================
995 //function : ExploreCurve
997 //=======================================================================
998 Standard_Boolean ExploreCurve(const gp_Cylinder& ,//aCy,
1001 const Standard_Real aTol,
1002 IntAna_ListOfCurve& aLC)
1005 Standard_Boolean bFind=Standard_False;
1006 Standard_Real aTheta, aT1, aT2, aDst;
1016 aC.Domain(aT1, aT2);
1019 aDst=aPx.Distance(aPapx);
1024 aDst=aPx.Distance(aPapx);
1029 bFind=aC.FindParameter(aPapx, aTheta);
1034 aPx=aC.Value(aTheta);
1035 aDst=aPx.Distance(aPapx);
1040 // need to be splitted at aTheta
1041 IntAna_Curve aC1, aC2;
1044 aC1.SetDomain(aT1, aTheta);
1046 aC2.SetDomain(aTheta, aT2);
1054 //=======================================================================
1055 //function : IsToReverse
1057 //=======================================================================
1058 Standard_Boolean IsToReverse(const gp_Cylinder& Cy1,
1059 const gp_Cylinder& Cy2,
1060 const Standard_Real Tol)
1062 Standard_Boolean bRet;
1063 Standard_Real aR1,aR2, dR, aSc1, aSc2;
1065 bRet=Standard_False;
1077 gp_Dir aDZ(0.,0.,1.);
1079 const gp_Dir& aDir1=Cy1.Axis().Direction();
1085 const gp_Dir& aDir2=Cy2.Axis().Direction();