1 // Created on: 1998-04-27
2 // Created by: Stephanie HUMEAU
3 // Copyright (c) 1998-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.
18 #include <Adaptor3d_Curve.hxx>
19 #include <Adaptor3d_Surface.hxx>
20 #include <GeomAdaptor_Curve.hxx>
21 #include <GeomAdaptor_Surface.hxx>
22 #include <GeomFill_FunctionDraft.hxx>
23 #include <GeomFill_Tensor.hxx>
26 #include <math_Matrix.hxx>
28 //#include <Precision.hxx>
29 //*******************************************************
30 // Calcul de la valeur de la fonction :
31 // G(w(t)) - S(u(t),v(t)) = 0
32 // ou G = generatrice et S = surface d'arret
34 //*******************************************************
35 //*******************************************************
36 // Function : FunctionDraft
37 // Purpose : Initialisation de la section et de la surface d'arret
38 //*******************************************************
39 GeomFill_FunctionDraft::GeomFill_FunctionDraft
40 (const Handle(Adaptor3d_Surface)& S, const Handle(Adaptor3d_Curve)& C)
46 //*******************************************************
47 // Function : NbVariables (t, u, v)
49 //*******************************************************
50 Standard_Integer GeomFill_FunctionDraft::NbVariables()const
55 //*******************************************************
56 // Function : NbEquations
58 //*******************************************************
59 Standard_Integer GeomFill_FunctionDraft::NbEquations()const
64 //*******************************************************
66 // Purpose : calcul of the value of the function at <X>
67 //*******************************************************
68 Standard_Boolean GeomFill_FunctionDraft::Value(const math_Vector& X,
72 TheCurve->D0(X(1), P);
73 TheSurface->D0(X(2), X(3), P1);
75 F(1) = P.Coord(1) - P1.Coord(1);
76 F(2) = P.Coord(2) - P1.Coord(2);
77 F(3) = P.Coord(3) - P1.Coord(3);
82 //*******************************************************
83 // Function : Derivatives
84 // Purpose :calcul of the derivative of the function
85 //*******************************************************
86 Standard_Boolean GeomFill_FunctionDraft::Derivatives(const math_Vector& X,
92 TheCurve->D1(X(1),P,DP);
93 TheSurface->D1(X(2),X(3),P1,DP1U,DP1V);
98 D(i,2) = -DP1U.Coord(i);
99 D(i,3) = -DP1V.Coord(i);
101 return Standard_True;
104 //*******************************************************
106 // Purpose : calcul of the value and the derivative of the function
107 //*******************************************************
108 Standard_Boolean GeomFill_FunctionDraft::Values(const math_Vector& X,
115 TheCurve->D1(X(1),P,DP); //derivee de la generatrice
116 TheSurface->D1(X(2),X(3),P1,DP1U,DP1V); //derivee de la new surface
120 F(i) = P.Coord(i) - P1.Coord(i);
122 D(i,1) = DP.Coord(i);
123 D(i,2) = -DP1U.Coord(i);
124 D(i,3) = -DP1V.Coord(i);
127 return Standard_True;
130 //*******************************************************
132 // Purpose : calcul of the first derivative from t
133 //*******************************************************
134 Standard_Boolean GeomFill_FunctionDraft::DerivT(const Handle(Adaptor3d_Curve)& C,
135 const Standard_Real Param,
136 const Standard_Real W,
138 const Standard_Real teta,
145 C->D1(Param, P, DP); // derivee de la section
147 F(1) = DP.Coord(1) + W * dN.Coord(1) * Sin(teta);
148 F(2) = DP.Coord(2) + W * dN.Coord(2) * Sin(teta);
149 F(3) = DP.Coord(3) + W * dN.Coord(3) * Sin(teta);
151 return Standard_True;
154 //*******************************************************
155 // Function : Deriv2T
156 // Purpose : calcul of the second derivatice from t
157 //*******************************************************
158 Standard_Boolean GeomFill_FunctionDraft::Deriv2T(const Handle(Adaptor3d_Curve)& C,
159 const Standard_Real Param,
160 const Standard_Real W,
162 const Standard_Real teta,
168 C->D2(Param, P, DP, D2P); // derivee de la section
170 F(1) = D2P.Coord(1) + W * d2N.Coord(1) * Sin(teta);
171 F(2) = D2P.Coord(2) + W * d2N.Coord(2) * Sin(teta);
172 F(3) = D2P.Coord(3) + W * d2N.Coord(3) * Sin(teta);
174 return Standard_True;
177 //*******************************************************
178 // Function : DerivTX
179 // Purpose : calcul of the second derivative from t and x
180 //*******************************************************
181 Standard_Boolean GeomFill_FunctionDraft::DerivTX(const gp_Vec & dN,
182 const Standard_Real teta,
191 D(i,1) = dN.Coord(i)*Sin(teta); //derivee / W
192 D(i,2) = 0.; // derivee / U
193 D(i,3) = 0.; // derivee / V
196 return Standard_True;
199 //*******************************************************
200 // Function : Deriv2X
201 // Purpose : calcul of the second derivative from x
202 //*******************************************************
203 Standard_Boolean GeomFill_FunctionDraft::Deriv2X(const math_Vector & X,
208 gp_Vec D2Pu, D2Pv, D2Puv;
211 TheSurface->D2(X(2), X(3), P, DPu, DPv, D2Pu, D2Pv, D2Puv);
213 T.Init(0.); // tenseur
217 T(i,2,2) = -D2Pu.Coord(i);
218 T(i,3,2) = T(i,2,3) = -D2Puv.Coord(i);
219 T(i,3,3) = -D2Pv.Coord(i);
222 return Standard_True;