0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / HLRBRep / HLRBRep_Curve.cxx
1 // Created on: 1992-03-13
2 // Created by: Christophe MARION
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <HLRBRep_Curve.ixx>
18 #include <gp.hxx>
19 #include <gp_Ax3.hxx>
20 #include <gp_Pln.hxx>
21 #include <Precision.hxx>
22 #include <ProjLib.hxx>
23 #include <TColgp_Array1OfPnt.hxx>
24 #include <HLRAlgo.hxx>
25 #include <HLRAlgo_Projector.hxx>
26 #include <HLRBRep_CLProps.hxx>
27 #include <Geom_BSplineCurve.hxx>
28 #include <Geom_BezierCurve.hxx>
29
30 //OCC155 // jfa 05.03.2002 // bad vectors projection
31
32 //=======================================================================
33 //function : HLRBRep_Curve
34 //purpose  : 
35 //=======================================================================
36
37 HLRBRep_Curve::HLRBRep_Curve ()
38 {}
39
40 //=======================================================================
41 //function : Curve
42 //purpose  : 
43 //=======================================================================
44
45 void HLRBRep_Curve::Curve (const TopoDS_Edge& E)
46 { myCurve.Initialize(E); }
47
48 //=======================================================================
49 //function : Parameter2d
50 //purpose  : 
51 //=======================================================================
52
53 Standard_Real 
54 HLRBRep_Curve::Parameter2d (const Standard_Real P3d) const
55 {
56   // Mathematical formula for lines
57
58   //        myOF P3d (myOF myVX - myOZ myVX + myOX myVZ)
59   // Res -> --------------------------------------------
60   //        (-myOF + myOZ) (-myOF + myOZ + P3d myVZ)
61
62   switch (myType)
63   {
64     case GeomAbs_Line:
65       if (((HLRAlgo_Projector*) myProj)->Perspective()) {
66         const Standard_Real FmOZ = myOF - myOZ;
67         return myOF * P3d * (myVX * FmOZ + myOX * myVZ) / (FmOZ * (FmOZ - P3d * myVZ));
68       }
69       return P3d * myVX;
70
71     case GeomAbs_Ellipse:
72       return P3d + myOX;
73   }
74   return P3d;
75 }
76
77 //=======================================================================
78 //function : Parameter3d
79 //purpose  : 
80 //=======================================================================
81
82 Standard_Real
83 HLRBRep_Curve::Parameter3d (const Standard_Real P2d) const
84 {
85   // Mathematical formula for lines
86
87   //                                 2   
88   //                   (-myOF + myOZ)  P2d
89   // P3d -> -----------------------------------------------------
90   //        (myOF - myOZ) (myOF myVX + P2d myVZ) + myOF myOX myVZ
91
92   if (myType == GeomAbs_Line) {
93     if (((HLRAlgo_Projector*) myProj)->Perspective()) {
94       const Standard_Real FmOZ = myOF - myOZ;
95       return P2d * FmOZ * FmOZ / (FmOZ * (myOF * myVX + P2d * myVZ) + myOF * myOX * myVZ);
96     }
97     return ((myVX <= gp::Resolution())? P2d : (P2d / myVX));
98   }
99
100   else if (myType == GeomAbs_Ellipse) {
101     return P2d - myOX;
102   }
103
104   return P2d;
105 }
106
107 //=======================================================================
108 //function : Update
109 //purpose  : 
110 //=======================================================================
111
112 Standard_Real  HLRBRep_Curve::Update (const Standard_Address TotMin,
113                                       const Standard_Address TotMax)
114 {
115   GeomAbs_CurveType typ = HLRBRep_BCurveTool::GetType(myCurve);
116   myType = GeomAbs_OtherCurve;
117
118   switch (typ) {
119
120   case GeomAbs_Line:
121     myType = typ;
122     break;
123
124   case GeomAbs_Circle:
125     if (!((HLRAlgo_Projector*) myProj)->Perspective()) {
126       gp_Dir D1 = HLRBRep_BCurveTool::Circle(myCurve).Axis().Direction();
127       D1.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
128       if (D1.IsParallel(gp::DZ(),Precision::Angular()))
129         myType = GeomAbs_Circle;
130       else if (Abs(D1.Dot(gp::DZ())) < Precision::Angular()*10) //*10: The minor radius of ellipse should not be too small.
131         myType = GeomAbs_OtherCurve;
132       else {
133         myType = GeomAbs_Ellipse;
134         // compute the angle offset
135         gp_Dir D3 = D1.Crossed(gp::DZ());
136         gp_Dir D2 = HLRBRep_BCurveTool::Circle(myCurve).XAxis().Direction();
137         D2.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
138         myOX = D3.AngleWithRef(D2,D1);
139       }
140     }
141     break;
142
143   case GeomAbs_Ellipse:
144     if (!((HLRAlgo_Projector*) myProj)->Perspective()) {
145       gp_Dir D1 = HLRBRep_BCurveTool::Ellipse(myCurve).Axis().Direction();
146       D1.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
147       if (D1.IsParallel(gp::DZ(),Precision::Angular())) {
148         myOX = 0.;    // no offset on the angle
149         myType = GeomAbs_Ellipse;
150       }
151     }
152     break;
153
154   case GeomAbs_BezierCurve:
155     if (HLRBRep_BCurveTool::Degree(myCurve) == 1)
156       myType = GeomAbs_Line;
157     else if (!((HLRAlgo_Projector*) myProj)->Perspective())
158       myType = typ;
159     break;
160
161   case GeomAbs_BSplineCurve:
162     if (!((HLRAlgo_Projector*) myProj)->Perspective())
163       myType = typ;
164     break;
165
166   default:
167     break;
168   }
169
170   if (myType == GeomAbs_Line) {
171     // compute the values for a line
172     gp_Lin L;
173     Standard_Real l3d = 1.; // length of the 3d bezier curve
174     if (HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_Line) {
175       L = HLRBRep_BCurveTool::Line(myCurve);
176     }
177     else {  // bezier degree 1
178       gp_Pnt PL;
179       gp_Vec VL;
180       HLRBRep_BCurveTool::D1(myCurve,0,PL,VL);
181       L = gp_Lin(PL,VL);
182       l3d = PL.Distance(HLRBRep_BCurveTool::Value(myCurve,1.));
183     }
184     gp_Pnt P = L.Location();
185     gp_Vec V = L.Direction();
186     P.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
187     V.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
188     if (((HLRAlgo_Projector*) myProj)->Perspective()) {
189       gp_Pnt2d F;
190       gp_Vec2d VFX;
191       D1(0.,F,VFX);
192       VFX.Normalize();
193       myVX = (VFX.X()*V.X()+VFX.Y()*V.Y()) * l3d;
194       Standard_Real l = - (VFX.X()*F.X() + VFX.Y()*F.Y());
195       F.SetCoord(F.X()+VFX.X()*l,F.Y()+VFX.Y()*l);
196       myOX = VFX.X()*(P.X()-F.X()) + VFX.Y()*(P.Y()-F.Y());
197       gp_Vec VFZ(-F.X(),-F.Y(),((HLRAlgo_Projector*) myProj)->Focus());
198       myOF = VFZ.Magnitude();
199       VFZ /= myOF;
200       myVZ = VFZ * V;
201       myVZ *= l3d;
202       myOZ = VFZ * gp_Vec(P.X()-F.X(),P.Y()-F.Y(),P.Z());
203     }
204     else myVX = Sqrt(V.X() * V.X() + V.Y() * V.Y()) * l3d;
205   }
206   return(UpdateMinMax(TotMin,TotMax));
207 }
208
209 //=======================================================================
210 //function : UpdateMinMax
211 //purpose  : 
212 //=======================================================================
213
214 Standard_Real 
215 HLRBRep_Curve::UpdateMinMax (const Standard_Address TotMin,
216                              const Standard_Address TotMax)
217 {
218   Standard_Real a = HLRBRep_BCurveTool::FirstParameter(myCurve);
219   Standard_Real b = HLRBRep_BCurveTool::LastParameter(myCurve);
220   Standard_Real x,y,z,tolMinMax = 0;
221   ((HLRAlgo_Projector*) myProj)->Project(Value3D(a),x,y,z);
222   HLRAlgo::UpdateMinMax(x,y,z,TotMin,TotMax);
223
224   if (myType != GeomAbs_Line) {
225     Standard_Integer nbPnt = 30;
226     Standard_Integer i;
227     Standard_Real step = (b-a)/(nbPnt+1);
228     Standard_Real xa,ya,za,xb =0.,yb =0.,zb =0.;
229     Standard_Real dx1,dy1,dz1,dd1;
230     Standard_Real dx2,dy2,dz2,dd2;
231
232     for (i = 1; i <= nbPnt; i++) {
233       a += step;
234       xa = xb; ya = yb; za = zb;
235       xb = x ; yb = y ; zb = z ;
236       ((HLRAlgo_Projector*) myProj)->Project(Value3D(a),x,y,z);
237       HLRAlgo::UpdateMinMax(x,y,z,TotMin,TotMax);
238       if (i >= 2) {
239         dx1 = x - xa; dy1 = y - ya; dz1 = z - za;
240         dd1 = sqrt (dx1 * dx1 + dy1 * dy1 + dz1 * dz1);
241         if (dd1 > 0) {
242           dx2 = xb - xa; dy2 = yb - ya; dz2 = zb - za;
243           dd2 = sqrt (dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
244           if (dd2 > 0) {
245             Standard_Real p = (dx1 * dx2 + dy1 * dy2 + dz1 * dz2) / (dd1 * dd2);
246             dx1 = xa + p * dx1 - xb;
247             dy1 = ya + p * dy1 - yb;
248             dz1 = za + p * dz1 - zb;
249             dd1 = sqrt (dx1 * dx1 + dy1 * dy1 + dz1 * dz1);
250             if (dd1 > tolMinMax) tolMinMax = dd1;
251           }
252         }
253       }
254     }
255   }
256   ((HLRAlgo_Projector*) myProj)->Project(Value3D(b),x,y,z);
257   HLRAlgo::UpdateMinMax(x,y,z,TotMin,TotMax);
258   return tolMinMax;
259 }
260
261 //=======================================================================
262 //function : Z
263 //purpose  : 
264 //=======================================================================
265
266 Standard_Real HLRBRep_Curve::Z (const Standard_Real U) const 
267 {
268   gp_Pnt P3d;
269   HLRBRep_BCurveTool::D0(myCurve,U,P3d);
270   P3d.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
271   return P3d.Z();
272 }
273
274 //=======================================================================
275 //function : Tangent
276 //purpose  : 
277 //=======================================================================
278
279 void HLRBRep_Curve::Tangent (const Standard_Boolean AtStart,
280                              gp_Pnt2d& P, gp_Dir2d& D) const
281 {
282   Standard_Real U = AtStart? HLRBRep_BCurveTool::FirstParameter(myCurve) :
283                              HLRBRep_BCurveTool::LastParameter (myCurve);
284
285   D0(U,P);
286   HLRBRep_CLProps CLP(2,Epsilon(1.));
287   const Standard_Address crv = (const Standard_Address)this;
288   CLP.SetCurve(crv);
289   CLP.SetParameter(U);
290   StdFail_UndefinedDerivative_Raise_if
291     (!CLP.IsTangentDefined(), "HLRBRep_Curve::Tangent");
292   CLP.Tangent(D); 
293 }
294
295 //=======================================================================
296 //function : D0
297 //purpose  : 
298 //=======================================================================
299
300 void HLRBRep_Curve::D0 (const Standard_Real U, gp_Pnt2d& P) const
301 {
302   /* gp_Pnt P3d;
303   HLRBRep_BCurveTool::D0(myCurve,U,P3d);
304   P3d.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
305   if (((HLRAlgo_Projector*) myProj)->Perspective()) {
306     Standard_Real R = 1.-P3d.Z()/((HLRAlgo_Projector*) myProj)->Focus();
307     P.SetCoord(P3d.X()/R,P3d.Y()/R);
308   }
309   else P.SetCoord(P3d.X(),P3d.Y()); */
310   gp_Pnt P3d;
311   HLRBRep_BCurveTool::D0(myCurve,U,P3d); 
312   ((HLRAlgo_Projector*) myProj)->Project(P3d,P);
313 }
314
315 //=======================================================================
316 //function : D1
317 //purpose  : 
318 //=======================================================================
319
320 void HLRBRep_Curve::D1 (const Standard_Real U,
321                         gp_Pnt2d& P, gp_Vec2d& V) const
322 {
323   // Mathematical formula for lines
324
325   //        X'[t]      X[t] Z'[t]                                     
326   // D1 =  -------- + -------------                                   
327   //           Z[t]          Z[t] 2                                   
328   //       1 - ----   f (1 - ----)                                    
329   //            f             f                                       
330
331   /* gp_Pnt P3D;
332   gp_Vec V13D;
333   HLRBRep_BCurveTool::D1(myCurve,U,P3D,V13D);
334   P3D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
335   V13D.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
336   if (((HLRAlgo_Projector*) myProj)->Perspective()) {
337     Standard_Real f = ((HLRAlgo_Projector*) myProj)->Focus();
338     Standard_Real R = 1. - P3D.Z()/f;
339     Standard_Real e = V13D.Z()/(f*R*R);
340     P.SetCoord(P3D .X()/R            , P3D .Y()/R            );
341     V.SetCoord(V13D.X()/R + P3D.X()*e, V13D.Y()/R + P3D.Y()*e);
342   }
343   else {
344     P.SetCoord(P3D .X(),P3D .Y());
345     V.SetCoord(V13D.X(),V13D.Y());
346   } */
347   gp_Pnt P3D;
348   gp_Vec V13D;
349   HLRBRep_BCurveTool::D1(myCurve,U,P3D,V13D);
350   if (((HLRAlgo_Projector*) myProj)->Perspective()) {  
351     Standard_Real f = ((HLRAlgo_Projector*) myProj)->Focus();
352     Standard_Real R = 1. - P3D.Z()/f;
353     Standard_Real e = V13D.Z()/(f*R*R);
354     P.SetCoord(P3D .X()/R            , P3D .Y()/R            );
355     V.SetCoord(V13D.X()/R + P3D.X()*e, V13D.Y()/R + P3D.Y()*e);
356   }
357   else {
358     //OCC155
359     ((HLRAlgo_Projector*) myProj)->Project(P3D,V13D,P,V);
360     /* ((HLRAlgo_Projector*) myProj)->Project(P3D,P);
361     gp_Pnt2d opop;
362     gp_Pnt uiui(V13D.X(),V13D.Y(),V13D.Z());
363     ((HLRAlgo_Projector*) myProj)->Project(uiui,opop);
364     V.SetCoord(opop.X(),opop.Y()); */
365   }
366 }
367
368 //=======================================================================
369 //function : D2
370 //purpose  : 
371 //=======================================================================
372
373 void HLRBRep_Curve::D2 (const Standard_Real U,
374                         gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const
375 {
376   // Mathematical formula for lines
377   
378   //                                   2
379   //       2 X'[t] Z'[t]   2 X[t] Z'[t]      X''[t]     X[t] Z''[t]   
380   // D2 =  ------------- + -------------- + -------- + -------------  
381   //              Z[t] 2    2      Z[t] 3       Z[t]          Z[t] 2  
382   //       f (1 - ----)    f  (1 - ----)    1 - ----   f (1 - ----)   
383   //               f                f            f             f      
384
385   gp_Pnt P3D;
386   gp_Vec V13D,V23D;
387   HLRBRep_BCurveTool::D2(myCurve,U,P3D,V13D,V23D);
388   P3D .Transform(((HLRAlgo_Projector*) myProj)->Transformation());
389   V13D.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
390   V23D.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
391   if (((HLRAlgo_Projector*) myProj)->Perspective()) {
392     Standard_Real f = ((HLRAlgo_Projector*) myProj)->Focus();
393     Standard_Real R = 1. - P3D.Z() / f;
394     Standard_Real q = f*R*R;
395     Standard_Real e = V13D.Z()/q;
396     Standard_Real c = e*V13D.Z()/(f*R);
397     P .SetCoord(P3D .X()/R            , P3D .Y()/R            );
398     V1.SetCoord(V13D.X()/R + P3D.X()*e, V13D.Y()/R + P3D.Y()*e);
399     V2.SetCoord(V23D.X()/R + 2*V13D.X()*e + P3D.X()*V23D.Z()/q + 2*P3D.X()*c,
400                 V23D.Y()/R + 2*V13D.Y()*e + P3D.Y()*V23D.Z()/q + 2*P3D.Y()*c);
401   }
402   else {
403     P .SetCoord(P3D .X(),P3D .Y());
404     V1.SetCoord(V13D.X(),V13D.Y());
405     V2.SetCoord(V23D.X(),V23D.Y());
406   }
407 }
408
409 //=======================================================================
410 //function : D3
411 //purpose  : 
412 //=======================================================================
413
414 void HLRBRep_Curve::D3 (const Standard_Real,
415                         gp_Pnt2d&, gp_Vec2d&, gp_Vec2d&, gp_Vec2d&) const
416 {
417 }
418
419 //=======================================================================
420 //function : DN
421 //purpose  : 
422 //=======================================================================
423
424 gp_Vec2d HLRBRep_Curve::DN (const Standard_Real, const Standard_Integer) const
425 { return gp_Vec2d(); }
426
427 //=======================================================================
428 //function : Line
429 //purpose  : 
430 //=======================================================================
431
432 gp_Lin2d HLRBRep_Curve::Line () const
433 {
434   gp_Pnt2d P;
435   gp_Vec2d V;
436   D1(0.,P,V);
437   return gp_Lin2d(P,V);
438 }
439
440 //=======================================================================
441 //function : Circle
442 //purpose  : 
443 //=======================================================================
444
445 gp_Circ2d HLRBRep_Curve::Circle () const
446 {
447   gp_Circ C = HLRBRep_BCurveTool::Circle(myCurve);
448   C.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
449   return ProjLib::Project(gp_Pln(gp::XOY()),C);
450 }
451
452 //=======================================================================
453 //function : Ellipse
454 //purpose  : 
455 //=======================================================================
456
457 gp_Elips2d HLRBRep_Curve::Ellipse () const
458 {
459   if (HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_Ellipse) {
460     gp_Elips E = HLRBRep_BCurveTool::Ellipse(myCurve);
461     E.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
462     return ProjLib::Project(gp_Pln(gp::XOY()),E);
463   }
464   // this is a circle
465   gp_Circ C = HLRBRep_BCurveTool::Circle(myCurve);
466   C.Transform(((HLRAlgo_Projector*) myProj)->Transformation());
467   const gp_Dir& D1 = C.Axis().Direction();
468   const gp_Dir& D3 = D1.Crossed(gp::DZ());
469   const gp_Dir& D2 = D1.Crossed(D3);
470   Standard_Real rap = sqrt( D2.X()*D2.X() + D2.Y()*D2.Y() );
471   gp_Dir2d d(D1.Y(),-D1.X());
472   gp_Pnt2d p(C.Location().X(),C.Location().Y());
473   gp_Elips2d El(gp_Ax2d(p,d),C.Radius(),C.Radius()*rap);
474   if ( D1.Z() < 0 ) El.Reverse();
475   return El;
476 }
477
478 //=======================================================================
479 //function : Hyperbola
480 //purpose  : 
481 //=======================================================================
482
483 gp_Hypr2d HLRBRep_Curve::Hyperbola () const
484 { return gp_Hypr2d(); }
485
486 //=======================================================================
487 //function : Parabola
488 //purpose  : 
489 //=======================================================================
490 gp_Parab2d HLRBRep_Curve::Parabola () const
491 { return gp_Parab2d(); }
492
493 //=======================================================================
494 //function : Poles
495 //purpose  : 
496 //=======================================================================
497
498 void  HLRBRep_Curve::Poles (TColgp_Array1OfPnt2d& TP) const
499 {
500   Standard_Integer i1 = TP.Lower();
501   Standard_Integer i2 = TP.Upper();
502   TColgp_Array1OfPnt TP3(i1,i2);
503   //-- HLRBRep_BCurveTool::Poles(myCurve,TP3);
504   if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) { 
505     (HLRBRep_BCurveTool::BSpline(myCurve))->Poles(TP3);
506   }
507   else { 
508     (HLRBRep_BCurveTool::Bezier(myCurve))->Poles(TP3);
509   }
510   for (Standard_Integer i = i1; i <= i2; i++) {
511     ((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
512     TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
513   }
514 }
515
516 //=======================================================================
517 //function : Poles
518 //purpose  : 
519 //=======================================================================
520
521 void  HLRBRep_Curve::Poles (const Handle(Geom_BSplineCurve)& aCurve,
522                             TColgp_Array1OfPnt2d& TP) const
523 {
524   Standard_Integer i1 = TP.Lower();
525   Standard_Integer i2 = TP.Upper();
526   TColgp_Array1OfPnt TP3(i1,i2);
527   //-- HLRBRep_BCurveTool::Poles(myCurve,TP3);
528   aCurve->Poles(TP3);
529
530   for (Standard_Integer i = i1; i <= i2; i++) {
531     ((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
532     TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
533   }
534 }
535
536 //=======================================================================
537 //function : PolesAndWeights
538 //purpose  : 
539 //=======================================================================
540
541 void  HLRBRep_Curve::PolesAndWeights (TColgp_Array1OfPnt2d& TP,
542                                                TColStd_Array1OfReal& TW) const
543 {
544   Standard_Integer i1 = TP.Lower();
545   Standard_Integer i2 = TP.Upper();
546   TColgp_Array1OfPnt TP3(i1,i2);
547   //-- HLRBRep_BCurveTool::PolesAndWeights(myCurve,TP3,TW);
548   
549   if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
550     Handle(Geom_BSplineCurve) HB = (HLRBRep_BCurveTool::BSpline(myCurve));
551     HB->Poles(TP3);
552     HB->Weights(TW);  
553     //-- (HLRBRep_BCurveTool::BSpline(myCurve))->PolesAndWeights(TP3,TW);
554   }
555   else { 
556     Handle(Geom_BezierCurve) HB = (HLRBRep_BCurveTool::Bezier(myCurve));
557     HB->Poles(TP3);
558     HB->Weights(TW);
559     //-- (HLRBRep_BCurveTool::Bezier(myCurve))->PolesAndWeights(TP3,TW);
560   }
561   for (Standard_Integer i = i1; i <= i2; i++) {
562     ((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
563     TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
564   }
565 }
566
567 //=======================================================================
568 //function : PolesAndWeights
569 //purpose  : 
570 //=======================================================================
571
572 void  HLRBRep_Curve::PolesAndWeights (const Handle(Geom_BSplineCurve)& aCurve,
573                                       TColgp_Array1OfPnt2d& TP,
574                                       TColStd_Array1OfReal& TW) const
575 {
576   Standard_Integer i1 = TP.Lower();
577   Standard_Integer i2 = TP.Upper();
578   TColgp_Array1OfPnt TP3(i1,i2);
579   //-- HLRBRep_BCurveTool::PolesAndWeights(myCurve,TP3,TW);
580   
581   aCurve->Poles(TP3);
582   aCurve->Weights(TW);  
583     //-- (HLRBRep_BCurveTool::BSpline(myCurve))->PolesAndWeights(TP3,TW);
584
585   for (Standard_Integer i = i1; i <= i2; i++) {
586     ((HLRAlgo_Projector*) myProj)->Transform(TP3(i));
587     TP(i).SetCoord(TP3(i).X(),TP3(i).Y());
588   }
589 }
590
591 //=======================================================================
592 //function : Knots
593 //purpose  : 
594 //=======================================================================
595
596 void  HLRBRep_Curve::Knots (TColStd_Array1OfReal& kn) const
597 {
598   if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
599     Handle(Geom_BSplineCurve) HB = (HLRBRep_BCurveTool::BSpline(myCurve));
600     HB->Knots(kn);
601   }
602 }
603
604 //=======================================================================
605 //function : Multiplicities
606 //purpose  : 
607 //=======================================================================
608
609 void  HLRBRep_Curve::Multiplicities (TColStd_Array1OfInteger& mu) const
610 {
611   if(HLRBRep_BCurveTool::GetType(myCurve) == GeomAbs_BSplineCurve) {
612     Handle(Geom_BSplineCurve) HB = (HLRBRep_BCurveTool::BSpline(myCurve));
613     HB->Multiplicities(mu);
614   }
615 }