1 // Created on: 1995-02-07
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1995-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 <IntTools_LineConstructor.ixx>
24 #include <GeomInt_LineTool.hxx>
25 #include <GeomInt_SequenceOfParameterAndOrientation.hxx>
26 #include <GeomInt_ParameterAndOrientation.hxx>
28 #include <IntPatch_Point.hxx>
29 #include <IntPatch_GLine.hxx>
30 #include <IntPatch_WLine.hxx>
31 #include <IntPatch_ALine.hxx>
32 #include <IntSurf_Transition.hxx>
33 #include <TopAbs_Orientation.hxx>
36 #include <Precision.hxx>
38 #include <gp_Pnt2d.hxx>
40 #include <Adaptor2d_HCurve2d.hxx>
42 #include <GeomAdaptor_HSurface.hxx>
43 #include <Standard_ConstructionError.hxx>
44 #include <IntSurf_Quadric.hxx>
45 #include <IntSurf_PntOn2S.hxx>
47 #include <GeomAbs_SurfaceType.hxx>
48 #include <TColStd_IndexedMapOfInteger.hxx>
51 void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
56 void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
57 const Handle(GeomAdaptor_HSurface)& myHS2,
65 void GLinePoint(const IntPatch_IType typl,
66 const Handle(IntPatch_GLine)& GLine,
67 const Standard_Real aT,
70 void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
71 const Handle(GeomAdaptor_HSurface)& myHS2,
77 //=======================================================================
80 //=======================================================================
81 void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
83 Standard_Integer i,nbvtx;
84 Standard_Real firstp,lastp;
85 const Standard_Real Tol = Precision::PConfusion() * 35.0;
87 const IntPatch_IType typl = L->ArcType();
88 if(typl == IntPatch_Analytic) {
89 Standard_Real u1,v1,u2,v2;
90 Handle(IntPatch_ALine)& ALine = *((Handle(IntPatch_ALine) *)&L);
92 nbvtx = GeomInt_LineTool::NbVertex(L);
93 for(i=1;i<nbvtx;i++) {
94 firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
95 lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
97 const Standard_Real pmid = (firstp+lastp)*0.5;
98 const gp_Pnt Pmid = ALine->Value(pmid);
99 Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
100 Recadre(myHS1,myHS2,u1,v1,u2,v2);
101 const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
102 if(in1 != TopAbs_OUT) {
103 const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
104 if(in2 != TopAbs_OUT) {
111 done = Standard_True;
113 } // if(typl == IntPatch_Analytic) {
114 else if(typl == IntPatch_Walking) {
115 Standard_Real u1,v1,u2,v2;
116 Handle(IntPatch_WLine)& WLine = *((Handle(IntPatch_WLine) *)&L);
118 nbvtx = GeomInt_LineTool::NbVertex(L);
119 for(i=1;i<nbvtx;i++) {
120 firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
121 lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
123 if(lastp != firstp+1) {
124 const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
125 const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
126 Pmid.Parameters(u1,v1,u2,v2);
127 Recadre(myHS1,myHS2,u1,v1,u2,v2);
128 const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
129 if(in1 != TopAbs_OUT) {
130 const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
131 if(in2 != TopAbs_OUT) {
138 const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer)(firstp));
139 Pfirst.Parameters(u1,v1,u2,v2);
140 Recadre(myHS1,myHS2,u1,v1,u2,v2);
141 TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
142 if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
143 TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
144 if(in2 != TopAbs_OUT) { //-- !=ON
145 const IntSurf_PntOn2S& Plast = WLine->Point((Standard_Integer)(lastp));
146 Plast.Parameters(u1,v1,u2,v2);
147 Recadre(myHS1,myHS2,u1,v1,u2,v2);
148 in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
149 if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
150 in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
151 if(in2 != TopAbs_OUT) {
162 // The One resulting curve consists of 7 segments that are
163 // connected between each other.
164 // The aim of the block is to reject these segments and have
165 // one segment instead of 7.
166 // The other reason to do that is value of TolReached3D=49.
167 // Why -? It is not known yet.
170 Standard_Integer aNbParts;
172 aNbParts = seqp.Length()/2;
174 Standard_Boolean bCond;
175 GeomAbs_SurfaceType aST1, aST2;
176 aST1 = myHS1->Surface().GetType();
177 aST2 = myHS2->Surface().GetType();
179 bCond=Standard_False;
180 if (aST1==GeomAbs_Plane) {
181 if (aST2==GeomAbs_SurfaceOfExtrusion ||
182 aST2==GeomAbs_SurfaceOfRevolution) {//+zft
186 else if (aST2==GeomAbs_Plane) {
187 if (aST1==GeomAbs_SurfaceOfExtrusion ||
188 aST1==GeomAbs_SurfaceOfRevolution) {//+zft
194 Standard_Integer aNb, anIndex, aNbTmp, jx;
195 TColStd_IndexedMapOfInteger aMap;
196 TColStd_SequenceOfReal aSeqTmp;
199 for(i=1; i<=aNb; ++i) {
201 anIndex=(Standard_Integer)lastp;
202 if (!aMap.Contains(anIndex)){
204 aSeqTmp.Append(lastp);
207 aNbTmp=aSeqTmp.Length();
208 aSeqTmp.Remove(aNbTmp);
214 aNb=aSeqTmp.Length()/2;
215 for(i=1; i<=aNb;++i) {
217 firstp=aSeqTmp(jx-1);
224 done = Standard_True;
226 }// else if(typl == IntPatch_Walking) {
228 else if (typl != IntPatch_Restriction) {
229 Standard_Boolean intrvtested;
230 Standard_Real u1,v1,u2,v2;
234 Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L);
235 // reject micro circles, ellipses
237 case IntPatch_Circle: {
241 aCirc=GLine->Circle();
244 done = Standard_True;
249 case IntPatch_Ellipse: {
253 aEllipse=GLine->Ellipse();
254 aR=aEllipse.MajorRadius();
256 done = Standard_True;
264 //modified by NIZNHY-PKV Wed Nov 02 11:50:23 2011t
266 nbvtx = GeomInt_LineTool::NbVertex(L);
267 intrvtested = Standard_False;
268 for(i=1; i<nbvtx; ++i) {
269 firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
270 lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
271 if(Abs(firstp-lastp)>Precision::PConfusion()) {
272 intrvtested = Standard_True;
273 const Standard_Real pmid = (firstp+lastp)*0.5;
275 //modified by NIZNHY-PKV Fri Nov 11 10:27:01 2011f
276 GLinePoint(typl, GLine, pmid, Pmid);
280 Pmid = ElCLib::Value(pmid,GLine->Line());
282 case IntPatch_Circle:
283 Pmid = ElCLib::Value(pmid,GLine->Circle());
285 case IntPatch_Ellipse:
286 Pmid = ElCLib::Value(pmid,GLine->Ellipse());
288 case IntPatch_Hyperbola:
289 Pmid = ElCLib::Value(pmid,GLine->Hyperbola());
291 case IntPatch_Parabola:
292 Pmid = ElCLib::Value(pmid,GLine->Parabola());
298 //modified by NIZNHY-PKV Fri Nov 11 12:25:40 2011t
300 Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
301 Recadre(myHS1,myHS2,u1,v1,u2,v2);
302 const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
303 if(in1 != TopAbs_OUT) {
304 const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
305 if(in2 != TopAbs_OUT) {
313 if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) {
314 firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
315 lastp = M_PI + M_PI + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
316 const Standard_Real cadrinf = GeomInt_LineTool::FirstParameter(L);
317 const Standard_Real cadrsup = GeomInt_LineTool::LastParameter(L);
318 Standard_Real acadr = (firstp+lastp)*0.5;
319 while(acadr < cadrinf) {
322 while(acadr > cadrsup) {
325 if(acadr>=cadrinf && acadr<=cadrsup) {
326 if(Abs(firstp-lastp)>Precision::PConfusion()) {
327 intrvtested = Standard_True;
328 const Standard_Real pmid = (firstp+lastp)*0.5;
330 if (typl == IntPatch_Circle) {
331 Pmid = ElCLib::Value(pmid,GLine->Circle());
334 Pmid = ElCLib::Value(pmid,GLine->Ellipse());
336 Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
337 Recadre(myHS1,myHS2,u1,v1,u2,v2);
338 const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
339 if(in1 != TopAbs_OUT) {
340 const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
341 if(in2 != TopAbs_OUT) {
350 // Keep a priori. A point 2d on each
351 // surface is required to make the decision. Will be done in the caller
352 seqp.Append(GeomInt_LineTool::FirstParameter(L));
353 seqp.Append(GeomInt_LineTool::LastParameter(L));
356 // Treatment Circles/Ellipses that are the results of intersection
357 // between Plane / (Cylinder, Sphere).
358 // In these cases the intersection curves can contain
359 // a lot of 'vertices' on the curve that leads to a lot of parts
360 // of the curve. Some adjacent parts can be united to the one part.
362 Standard_Integer aNbParts;
364 aNbParts = seqp.Length()/2;
365 if (aNbParts > 1 && (typl == IntPatch_Circle || typl == IntPatch_Ellipse)) {
366 Standard_Boolean bCond, bPCS, bPCS1, bPCS2, bCC;
367 GeomAbs_SurfaceType aST1, aST2;
369 aST1 = myHS1->Surface().GetType();
370 aST2 = myHS2->Surface().GetType();
372 bPCS1=((aST1==GeomAbs_Plane) && (aST2==GeomAbs_Cylinder || aST2==GeomAbs_Sphere));
373 bPCS2=((aST2==GeomAbs_Plane) && (aST1==GeomAbs_Cylinder || aST1==GeomAbs_Sphere));
374 bPCS=(bPCS1 || bPCS2);
375 bCC=(aST1==GeomAbs_Cylinder && aST2==GeomAbs_Cylinder);
378 //modified by NIZNHY-PKV Fri Nov 11 10:13:58 2011f
379 Standard_Integer j, i1, i2;
380 Standard_Real aT, aU, aV;
381 Handle(GeomAdaptor_HSurface) aHS;
383 bCond=Standard_False;
389 if ((aST1==GeomAbs_Sphere) || (aST2==GeomAbs_Sphere)) {
390 if (aST1==GeomAbs_Sphere) {
393 else if (aST2==GeomAbs_Sphere){
397 Standard_Integer aNbP;
398 Standard_Real aHalfPI, aPPC;
403 aPPC=Precision::PConfusion();
408 for (i=1; i<=aNbP; ++i) {
412 GLinePoint(typl, GLine, aT, aP);
413 Parameters(aHS, aP, aU, aV);
415 if (fabs(aV+aHalfPI) < aPPC) {
420 if (fabs(aV-aHalfPI) < aPPC) {
425 if (i1==2 || i2==2) {
426 bCond=Standard_False;
429 }// else if (bPCS1 || bPCS2) {
430 //modified by NIZNHY-PKV Fri Nov 11 10:14:00 2011t
433 Standard_Integer i2, j2;
434 Standard_Real aFi, aLi, aFj, aLj, aF, aL;
435 TColStd_SequenceOfReal aSeq;
439 for (i=1; i<aNbParts; ++i) {
450 if (fabs (aFj-aLi) < Tol) {
463 aNbParts=aSeq.Length();
464 for (i=1; i<=aNbParts; ++i) {
473 }// else if (typl != IntPatch_Restriction) {
475 done = Standard_False;
477 nbvtx = GeomInt_LineTool::NbVertex(L);
478 if (nbvtx == 0) { // Keep a priori. Point 2d is required on each
479 // surface to make the decision. Will be done in the caller
480 seqp.Append(GeomInt_LineTool::FirstParameter(L));
481 seqp.Append(GeomInt_LineTool::LastParameter(L));
482 done = Standard_True;
486 GeomInt_SequenceOfParameterAndOrientation seqpss;
487 TopAbs_Orientation or1=TopAbs_FORWARD,or2=TopAbs_FORWARD;
489 for (i=1; i<=nbvtx; i++) {
490 const IntPatch_Point& thevtx = GeomInt_LineTool::Vertex(L,i);
491 const Standard_Real prm = thevtx.ParameterOnLine();
492 if (thevtx.IsOnDomS1()) {
493 switch (thevtx.TransitionLineArc1().TransitionType()) {
494 case IntSurf_In: or1 = TopAbs_FORWARD; break;
495 case IntSurf_Out: or1 = TopAbs_REVERSED; break;
496 case IntSurf_Touch: or1 = TopAbs_INTERNAL; break;
497 case IntSurf_Undecided: or1 = TopAbs_INTERNAL; break;
501 or1 = TopAbs_INTERNAL;
504 if (thevtx.IsOnDomS2()) {
505 switch (thevtx.TransitionLineArc2().TransitionType()) {
506 case IntSurf_In: or2 = TopAbs_FORWARD; break;
507 case IntSurf_Out: or2 = TopAbs_REVERSED; break;
508 case IntSurf_Touch: or2 = TopAbs_INTERNAL; break;
509 case IntSurf_Undecided: or2 = TopAbs_INTERNAL; break;
513 or2 = TopAbs_INTERNAL;
516 const Standard_Integer nbinserted = seqpss.Length();
517 Standard_Boolean inserted = Standard_False;
518 for (Standard_Integer j=1; j<=nbinserted;j++) {
519 if (Abs(prm-seqpss(j).Parameter()) <= Tol) {
521 GeomInt_ParameterAndOrientation& valj = seqpss.ChangeValue(j);
522 if (or1 != TopAbs_INTERNAL) {
523 if (valj.Orientation1() != TopAbs_INTERNAL) {
524 if (or1 != valj.Orientation1()) {
525 valj.SetOrientation1(TopAbs_INTERNAL);
529 valj.SetOrientation1(or1);
533 if (or2 != TopAbs_INTERNAL) {
534 if (valj.Orientation2() != TopAbs_INTERNAL) {
535 if (or2 != valj.Orientation2()) {
536 valj.SetOrientation2(TopAbs_INTERNAL);
540 valj.SetOrientation2(or2);
543 inserted = Standard_True;
547 if (prm < seqpss(j).Parameter()-Tol ) {
548 // insert before position j
549 seqpss.InsertBefore(j,GeomInt_ParameterAndOrientation(prm,or1,or2));
550 inserted = Standard_True;
556 seqpss.Append(GeomInt_ParameterAndOrientation(prm,or1,or2));
560 // determine the state at the beginning of line
561 Standard_Boolean trim = Standard_False;
562 Standard_Boolean dansS1 = Standard_False;
563 Standard_Boolean dansS2 = Standard_False;
565 nbvtx = seqpss.Length();
566 for (i=1; i<= nbvtx; i++) {
567 or1 = seqpss(i).Orientation1();
568 if (or1 != TopAbs_INTERNAL) {
569 trim = Standard_True;
570 dansS1 = (or1 != TopAbs_FORWARD);
577 for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ ) {
578 if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS1() ) {
579 GeomInt_LineTool::Vertex(L,i).ParametersOnS1(U,V);
581 if (myDom1->Classify(PPCC,Tol) == TopAbs_OUT) {
582 done = Standard_True;
588 dansS1 = Standard_True; // Keep in doubt
591 for (i=1; i<= nbvtx; i++) {
592 or2 = seqpss(i).Orientation2();
593 if (or2 != TopAbs_INTERNAL) {
594 trim = Standard_True;
595 dansS2 = (or2 != TopAbs_FORWARD);
602 for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ ) {
603 if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS2() ) {
604 GeomInt_LineTool::Vertex(L,i).ParametersOnS2(U,V);
605 if (myDom2->Classify(gp_Pnt2d(U,V),Tol) == TopAbs_OUT) {
606 done = Standard_True;
612 dansS2 = Standard_True; // Keep in doubt
615 if (!trim) { // necessarily dansS1 == dansS2 == Standard_True
616 seqp.Append(GeomInt_LineTool::FirstParameter(L));
617 seqp.Append(GeomInt_LineTool::LastParameter(L));
618 done = Standard_True;
622 // sequence seqpss is peeled to create valid ends
623 // and store them in seqp(2*i+1) and seqp(2*i+2)
624 Standard_Real thefirst = GeomInt_LineTool::FirstParameter(L);
625 Standard_Real thelast = GeomInt_LineTool::LastParameter(L);
628 for (i=1; i<=nbvtx; i++) {
629 or1 = seqpss(i).Orientation1();
630 or2 = seqpss(i).Orientation2();
631 if (dansS1 && dansS2) {
632 if (or1 == TopAbs_REVERSED){
633 dansS1 = Standard_False;
636 if (or2 == TopAbs_REVERSED){
637 dansS2 = Standard_False;
639 if (!dansS1 || !dansS2) {
640 lastp = seqpss(i).Parameter();
641 Standard_Real stofirst = Max(firstp, thefirst);
642 Standard_Real stolast = Min(lastp, thelast) ;
644 if (stolast > stofirst) {
645 seqp.Append(stofirst);
646 seqp.Append(stolast);
648 if (lastp > thelast) {
655 if (or1 == TopAbs_REVERSED) {
656 dansS1 = Standard_False;
660 if (or1 == TopAbs_FORWARD){
661 dansS1 = Standard_True;
665 if (or2 == TopAbs_REVERSED) {
666 dansS2 = Standard_False;
670 if (or2 == TopAbs_FORWARD){
671 dansS2 = Standard_True;
674 if (dansS1 && dansS2){
675 firstp = seqpss(i).Parameter();
681 if (dansS1 && dansS2) {
683 firstp = Max(firstp,thefirst);
684 if (lastp > firstp) {
689 done = Standard_True;
693 //=======================================================================
694 //function : PeriodicLine
696 //=======================================================================
697 void IntTools_LineConstructor::PeriodicLine (const Handle(IntPatch_Line)& L) const
699 const IntPatch_IType typl = L->ArcType();
700 if (typl != IntPatch_Circle && typl != IntPatch_Ellipse)
703 const Standard_Real Tol = Precision::PConfusion();
704 Handle(IntPatch_GLine) glin = Handle(IntPatch_GLine)::DownCast(L);
705 Standard_Integer i,j,nbvtx = glin->NbVertex();
706 for (i=1; i<=nbvtx; i++)
708 IntPatch_Point thevtx = glin->Vertex(i);
709 const Standard_Real prm = thevtx.ParameterOnLine();
710 Standard_Boolean changevtx = Standard_False;
711 if (thevtx.IsOnDomS1() || thevtx.IsOnDomS2())
713 for (j=1; j<=nbvtx; j++)
717 const IntPatch_Point& thevtxbis = glin->Vertex(j);
718 const Standard_Real prmbis = thevtxbis.ParameterOnLine();
719 if (Abs(prm-prmbis) <= Tol)
723 if (thevtx.IsOnDomS1() && thevtxbis.IsOnDomS1() &&
724 thevtxbis.TransitionLineArc1().TransitionType()==IntSurf_In)
726 p2d = thevtx.ArcOnS1()->Value(thevtx.ParameterOnArc1());
727 u = p2d.X(); v = p2d.Y();
728 p2d = thevtxbis.ArcOnS1()->Value(thevtxbis.ParameterOnArc1());
729 if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
731 changevtx = Standard_True;
735 if (thevtx.IsOnDomS2() && thevtxbis.IsOnDomS2() &&
736 thevtxbis.TransitionLineArc2().TransitionType()==IntSurf_In)
738 p2d = thevtx.ArcOnS2()->Value(thevtx.ParameterOnArc2());
739 u = p2d.X(); v = p2d.Y();
740 p2d = thevtxbis.ArcOnS2()->Value(thevtxbis.ParameterOnArc2());
741 if (Abs(u-p2d.X()) > Tol || Abs(v-p2d.Y()) > Tol)
743 changevtx = Standard_True;
752 thevtx.SetParameter(prm + 2.*M_PI);
753 glin->Replace(i,thevtx);
757 //modified by NIZNHY-PKV Fri Nov 11 10:30:34 2011f
758 //=======================================================================
761 //=======================================================================
762 void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
763 const Handle(GeomAdaptor_HSurface)& myHS2,
769 Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
770 const GeomAbs_SurfaceType typs1 = myHS1->GetType();
773 case GeomAbs_Cylinder:
777 myHS1IsUPeriodic = Standard_True;
778 myHS1IsVPeriodic = Standard_False;
783 myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
788 //-- Case of periodic biparameters is processed upstream
789 myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
793 Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
794 const GeomAbs_SurfaceType typs2 = myHS2->GetType();
797 case GeomAbs_Cylinder:
801 myHS2IsUPeriodic = Standard_True;
802 myHS2IsVPeriodic = Standard_False;
807 myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_True;
812 //-- Case of periodic biparameters is processed upstream
813 myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_False;
817 if(myHS1IsUPeriodic) {
818 const Standard_Real lmf = M_PI+M_PI; //-- myHS1->UPeriod();
819 const Standard_Real f = myHS1->FirstUParameter();
820 const Standard_Real l = myHS1->LastUParameter();
821 while(u1 < f) { u1+=lmf; }
822 while(u1 > l) { u1-=lmf; }
824 if(myHS1IsVPeriodic) {
825 const Standard_Real lmf = M_PI+M_PI; //-- myHS1->VPeriod();
826 const Standard_Real f = myHS1->FirstVParameter();
827 const Standard_Real l = myHS1->LastVParameter();
828 while(v1 < f) { v1+=lmf; }
829 while(v1 > l) { v1-=lmf; }
831 if(myHS2IsUPeriodic) {
832 const Standard_Real lmf = M_PI+M_PI; //-- myHS2->UPeriod();
833 const Standard_Real f = myHS2->FirstUParameter();
834 const Standard_Real l = myHS2->LastUParameter();
835 while(u2 < f) { u2+=lmf; }
836 while(u2 > l) { u2-=lmf; }
838 if(myHS2IsVPeriodic) {
839 const Standard_Real lmf = M_PI+M_PI; //-- myHS2->VPeriod();
840 const Standard_Real f = myHS2->FirstVParameter();
841 const Standard_Real l = myHS2->LastVParameter();
842 while(v2 < f) { v2+=lmf; }
843 while(v2 > l) { v2-=lmf; }
846 //=======================================================================
847 //function : Parameters
849 //=======================================================================
850 void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
851 const Handle(GeomAdaptor_HSurface)& myHS2,
858 //modified by NIZNHY-PKV Fri Nov 11 10:07:55 2011f
859 Parameters(myHS1, Ptref, U1, V1);
860 Parameters(myHS2, Ptref, U2, V2);
862 IntSurf_Quadric quad1,quad2;
863 switch (myHS1->Surface().GetType())
865 case GeomAbs_Plane: quad1.SetValue(myHS1->Surface().Plane()); break;
866 case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
867 case GeomAbs_Cone: quad1.SetValue(myHS1->Surface().Cone()); break;
868 case GeomAbs_Sphere: quad1.SetValue(myHS1->Surface().Sphere()); break;
869 default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
871 switch (myHS2->Surface().GetType())
873 case GeomAbs_Plane: quad2.SetValue(myHS2->Surface().Plane()); break;
874 case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
875 case GeomAbs_Cone: quad2.SetValue(myHS2->Surface().Cone()); break;
876 case GeomAbs_Sphere: quad2.SetValue(myHS2->Surface().Sphere()); break;
877 default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
879 quad1.Parameters(Ptref,U1,V1);
880 quad2.Parameters(Ptref,U2,V2);
882 //modified by NIZNHY-PKV Fri Nov 11 10:08:38 2011t
884 //modified by NIZNHY-PKV Fri Nov 11 10:06:02 2011f
885 //=======================================================================
886 //function : Parameter
888 //=======================================================================
889 void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
894 IntSurf_Quadric quad1;
896 switch (myHS1->Surface().GetType()) {
898 quad1.SetValue(myHS1->Surface().Plane());
900 case GeomAbs_Cylinder:
901 quad1.SetValue(myHS1->Surface().Cylinder());
904 quad1.SetValue(myHS1->Surface().Cone());
907 quad1.SetValue(myHS1->Surface().Sphere());
910 Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
912 quad1.Parameters(Ptref,U1,V1);
915 //=======================================================================
916 //function : GLinePoint
918 //=======================================================================
919 void GLinePoint(const IntPatch_IType typl,
920 const Handle(IntPatch_GLine)& GLine,
921 const Standard_Real aT,
926 aP = ElCLib::Value(aT, GLine->Line());
928 case IntPatch_Circle:
929 aP = ElCLib::Value(aT, GLine->Circle());
931 case IntPatch_Ellipse:
932 aP = ElCLib::Value(aT, GLine->Ellipse());
934 case IntPatch_Hyperbola:
935 aP = ElCLib::Value(aT, GLine->Hyperbola());
937 case IntPatch_Parabola:
938 aP = ElCLib::Value(aT, GLine->Parabola());
941 Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
944 //modified by NIZNHY-PKV Fri Nov 11 10:06:04 2011t