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
9 // under the terms of the GNU Lesser General Public 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 <ShapeExtend_ComplexCurve.ixx>
20 #include <Precision.hxx>
22 //=======================================================================
23 //function : ShapeExtend_ComplexCurve
25 //=======================================================================
27 ShapeExtend_ComplexCurve::ShapeExtend_ComplexCurve()
29 myClosed = Standard_False;
32 //=======================================================================
33 //function : Transform
35 //=======================================================================
37 void ShapeExtend_ComplexCurve::Transform(const gp_Trsf& T)
39 for (Standard_Integer i = 1; i <= NbCurves(); i++)
40 Curve(i)->Transform(T);
43 //=======================================================================
46 //=======================================================================
48 void ShapeExtend_ComplexCurve::D0(const Standard_Real U,gp_Pnt& P) const
51 Standard_Integer ind = LocateParameter (U, UOut);
52 Curve(ind)->D0(UOut, P);
55 //=======================================================================
58 //=======================================================================
60 void ShapeExtend_ComplexCurve::D1(const Standard_Real U,gp_Pnt& P,gp_Vec& V1) const
63 Standard_Integer ind = LocateParameter (U, UOut);
64 Curve(ind)->D1(UOut, P, V1);
65 TransformDN(V1,ind,1);
68 //=======================================================================
71 //=======================================================================
73 void ShapeExtend_ComplexCurve::D2(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2) const
76 Standard_Integer ind = LocateParameter (U, UOut);
77 Curve(ind)->D2(UOut, P, V1, V2);
78 TransformDN(V1,ind,1);
79 TransformDN(V2,ind,2);
82 //=======================================================================
85 //=======================================================================
87 void ShapeExtend_ComplexCurve::D3(const Standard_Real U,gp_Pnt& P,gp_Vec& V1,gp_Vec& V2,gp_Vec& V3) const
90 Standard_Integer ind = LocateParameter (U, UOut);
91 Curve(ind)->D3(UOut, P, V1, V2, V3);
92 TransformDN(V1,ind,1);
93 TransformDN(V2,ind,2);
94 TransformDN(V3,ind,3);
97 //=======================================================================
100 //=======================================================================
102 gp_Vec ShapeExtend_ComplexCurve::DN(const Standard_Real U,const Standard_Integer N) const
105 Standard_Integer ind = LocateParameter (U, UOut);
106 gp_Vec res = Curve(ind)->DN(UOut, N);
108 TransformDN(res,ind,N);
112 //=======================================================================
113 //function : CheckConnectivity
115 //=======================================================================
117 Standard_Boolean ShapeExtend_ComplexCurve::CheckConnectivity (const Standard_Real Preci)
119 Standard_Integer NbC = NbCurves();
120 Standard_Boolean ok = Standard_True;
121 for (Standard_Integer i = 1; i < NbC; i++ ) {
122 if (i == 1) myClosed = Value (FirstParameter()).IsEqual (Value (LastParameter()), Preci);
123 ok &= Curve (i)->Value (Curve(i)->LastParameter()).IsEqual
124 (Curve (i + 1)->Value (Curve(i + 1)->FirstParameter()), Preci);
127 if (!ok) cout << "Warning: ShapeExtend_ComplexCurve: not connected in 3d" << endl;
132 //=======================================================================
133 //function : TransformDN
135 //=======================================================================
137 void ShapeExtend_ComplexCurve::TransformDN (gp_Vec& V,
138 const Standard_Integer ind,
139 const Standard_Integer N) const
141 Standard_Real fact = GetScaleFactor(ind);
142 for(Standard_Integer i = 1; i <= N; i++)