1 // File: ShapeExtend_ComplexCurve.cxx
2 // Created: Tue Jun 22 19:19:20 1999
4 // <rln@kinox.nnov.matra-dtv.fr>
5 // pdn 13.07.99 Derivatives are scaled in accordance with local/global parameter transition
7 #include <ShapeExtend_ComplexCurve.ixx>
8 #include <Precision.hxx>
10 //=======================================================================
11 //function : ShapeExtend_ComplexCurve
13 //=======================================================================
15 ShapeExtend_ComplexCurve::ShapeExtend_ComplexCurve()
17 myClosed = Standard_False;
20 //=======================================================================
21 //function : Transform
23 //=======================================================================
25 void ShapeExtend_ComplexCurve::Transform(const gp_Trsf& T)
27 for (Standard_Integer i = 1; i <= NbCurves(); i++)
28 Curve(i)->Transform(T);
31 //=======================================================================
34 //=======================================================================
36 void ShapeExtend_ComplexCurve::D0(const Standard_Real U,gp_Pnt& P) const
39 Standard_Integer ind = LocateParameter (U, UOut);
40 Curve(ind)->D0(UOut, P);
43 //=======================================================================
46 //=======================================================================
48 void ShapeExtend_ComplexCurve::D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V1) const
51 Standard_Integer ind = LocateParameter (U, UOut);
52 Curve(ind)->D1(UOut, P, V1);
53 TransformDN(V1,ind,1);
56 //=======================================================================
59 //=======================================================================
61 void ShapeExtend_ComplexCurve::D2(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
64 Standard_Integer ind = LocateParameter (U, UOut);
65 Curve(ind)->D2(UOut, P, V1, V2);
66 TransformDN(V1,ind,1);
67 TransformDN(V2,ind,2);
70 //=======================================================================
73 //=======================================================================
75 void ShapeExtend_ComplexCurve::D3(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2,gp_Vec& V3) const
78 Standard_Integer ind = LocateParameter (U, UOut);
79 Curve(ind)->D3(UOut, P, V1, V2, V3);
80 TransformDN(V1,ind,1);
81 TransformDN(V2,ind,2);
82 TransformDN(V3,ind,3);
85 //=======================================================================
88 //=======================================================================
90 gp_Vec ShapeExtend_ComplexCurve::DN(const Standard_Real U,const Standard_Integer N) const
93 Standard_Integer ind = LocateParameter (U, UOut);
94 gp_Vec res = Curve(ind)->DN(UOut, N);
96 TransformDN(res,ind,N);
100 //=======================================================================
101 //function : CheckConnectivity
103 //=======================================================================
105 Standard_Boolean ShapeExtend_ComplexCurve::CheckConnectivity (const Standard_Real Preci)
107 Standard_Integer NbC = NbCurves();
108 Standard_Boolean ok = Standard_True;
109 for (Standard_Integer i = 1; i < NbC; i++ ) {
110 if (i == 1) myClosed = Value (FirstParameter()).IsEqual (Value (LastParameter()), Preci);
111 ok &= Curve (i)->Value (Curve(i)->LastParameter()).IsEqual
112 (Curve (i + 1)->Value (Curve(i + 1)->FirstParameter()), Preci);
115 if (!ok) cout << "Warning: ShapeExtend_ComplexCurve: not connected in 3d" << endl;
120 //=======================================================================
121 //function : TransformDN
123 //=======================================================================
125 void ShapeExtend_ComplexCurve::TransformDN (gp_Vec& V,
126 const Standard_Integer ind,
127 const Standard_Integer N) const
129 Standard_Real fact = GetScaleFactor(ind);
130 for(Standard_Integer i = 1; i <= N; i++)