1 // Created on: 1999-06-22
2 // Created by: Roman LYGIN
3 // Copyright (c) 1999-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.
17 // pdn 13.07.99 Derivatives are scaled in accordance with local/global parameter transition
19 #include <Geom_Curve.hxx>
21 #include <gp_Trsf.hxx>
23 #include <Precision.hxx>
24 #include <ShapeExtend_ComplexCurve.hxx>
25 #include <Standard_Type.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(ShapeExtend_ComplexCurve,Geom_Curve)
29 //=======================================================================
30 //function : ShapeExtend_ComplexCurve
32 //=======================================================================
33 ShapeExtend_ComplexCurve::ShapeExtend_ComplexCurve()
35 myClosed = Standard_False;
38 //=======================================================================
39 //function : Transform
41 //=======================================================================
43 void ShapeExtend_ComplexCurve::Transform(const gp_Trsf& T)
45 for (Standard_Integer i = 1; i <= NbCurves(); i++)
46 Curve(i)->Transform(T);
49 //=======================================================================
52 //=======================================================================
54 void ShapeExtend_ComplexCurve::D0(const Standard_Real U,gp_Pnt& P) const
57 Standard_Integer ind = LocateParameter (U, UOut);
58 Curve(ind)->D0(UOut, P);
61 //=======================================================================
64 //=======================================================================
66 void ShapeExtend_ComplexCurve::D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V1) const
69 Standard_Integer ind = LocateParameter (U, UOut);
70 Curve(ind)->D1(UOut, P, V1);
71 TransformDN(V1,ind,1);
74 //=======================================================================
77 //=======================================================================
79 void ShapeExtend_ComplexCurve::D2(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
82 Standard_Integer ind = LocateParameter (U, UOut);
83 Curve(ind)->D2(UOut, P, V1, V2);
84 TransformDN(V1,ind,1);
85 TransformDN(V2,ind,2);
88 //=======================================================================
91 //=======================================================================
93 void ShapeExtend_ComplexCurve::D3(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2,gp_Vec& V3) const
96 Standard_Integer ind = LocateParameter (U, UOut);
97 Curve(ind)->D3(UOut, P, V1, V2, V3);
98 TransformDN(V1,ind,1);
99 TransformDN(V2,ind,2);
100 TransformDN(V3,ind,3);
103 //=======================================================================
106 //=======================================================================
108 gp_Vec ShapeExtend_ComplexCurve::DN(const Standard_Real U,const Standard_Integer N) const
111 Standard_Integer ind = LocateParameter (U, UOut);
112 gp_Vec res = Curve(ind)->DN(UOut, N);
114 TransformDN(res,ind,N);
118 //=======================================================================
119 //function : CheckConnectivity
121 //=======================================================================
123 Standard_Boolean ShapeExtend_ComplexCurve::CheckConnectivity (const Standard_Real Preci)
125 Standard_Integer NbC = NbCurves();
126 Standard_Boolean ok = Standard_True;
127 for (Standard_Integer i = 1; i < NbC; i++ ) {
128 if (i == 1) myClosed = Value (FirstParameter()).IsEqual (Value (LastParameter()), Preci);
129 ok &= Curve (i)->Value (Curve(i)->LastParameter()).IsEqual
130 (Curve (i + 1)->Value (Curve(i + 1)->FirstParameter()), Preci);
133 if (!ok) cout << "Warning: ShapeExtend_ComplexCurve: not connected in 3d" << endl;
138 //=======================================================================
139 //function : TransformDN
141 //=======================================================================
143 void ShapeExtend_ComplexCurve::TransformDN (gp_Vec& V,
144 const Standard_Integer ind,
145 const Standard_Integer N) const
147 Standard_Real fact = GetScaleFactor(ind);
148 for(Standard_Integer i = 1; i <= N; i++)