0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / GeomFill / GeomFill_FunctionDraft.cxx
CommitLineData
b311480e 1// Created on: 1998-04-27
2// Created by: Stephanie HUMEAU
3// Copyright (c) 1998-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <Adaptor3d_HCurve.hxx>
19#include <Adaptor3d_HSurface.hxx>
7fd59977 20#include <GeomAdaptor_HCurve.hxx>
42cf5bc1 21#include <GeomAdaptor_HSurface.hxx>
22#include <GeomFill_FunctionDraft.hxx>
23#include <GeomFill_Tensor.hxx>
7fd59977 24#include <gp_Pnt.hxx>
42cf5bc1 25#include <gp_Vec.hxx>
26#include <math_Matrix.hxx>
7fd59977 27
42cf5bc1 28//#include <Precision.hxx>
7fd59977 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
33// et de ses derivees
34//*******************************************************
7fd59977 35//*******************************************************
36// Function : FunctionDraft
37// Purpose : Initialisation de la section et de la surface d'arret
38//*******************************************************
b311480e 39GeomFill_FunctionDraft::GeomFill_FunctionDraft
7fd59977 40 (const Handle(Adaptor3d_HSurface)& S, const Handle(Adaptor3d_HCurve)& C)
41{
42 TheCurve = C ;
43 TheSurface = S;
44}
45
46//*******************************************************
47// Function : NbVariables (t, u, v)
48// Purpose :
49//*******************************************************
50 Standard_Integer GeomFill_FunctionDraft::NbVariables()const
51{
52 return 3;
53}
54
55//*******************************************************
56// Function : NbEquations
57// Purpose :
58//*******************************************************
59 Standard_Integer GeomFill_FunctionDraft::NbEquations()const
60{
61 return 3;
62}
63
64//*******************************************************
65// Function : Value
66// Purpose : calcul of the value of the function at <X>
67//*******************************************************
68 Standard_Boolean GeomFill_FunctionDraft::Value(const math_Vector& X,
69 math_Vector& F)
70{
71 gp_Pnt P,P1;
72 TheCurve->D0(X(1), P);
73 TheSurface->D0(X(2), X(3), P1);
74
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);
78
79 return Standard_True;
80}
81
82//*******************************************************
83// Function : Derivatives
84// Purpose :calcul of the derivative of the function
85//*******************************************************
86 Standard_Boolean GeomFill_FunctionDraft::Derivatives(const math_Vector& X,
87 math_Matrix& D)
88{
89 Standard_Integer i;
90 gp_Pnt P,P1;
91 gp_Vec DP,DP1U,DP1V;
92 TheCurve->D1(X(1),P,DP);
93 TheSurface->D1(X(2),X(3),P1,DP1U,DP1V);
94
95 for (i=1;i<=3;i++)
96 {
97 D(i,1) = DP.Coord(i);
98 D(i,2) = -DP1U.Coord(i);
99 D(i,3) = -DP1V.Coord(i);
100 }
101 return Standard_True;
102}
103
104//*******************************************************
105// Function : Values
106// Purpose : calcul of the value and the derivative of the function
107//*******************************************************
108 Standard_Boolean GeomFill_FunctionDraft::Values(const math_Vector& X,
109 math_Vector& F,
110 math_Matrix& D)
111{
112 Standard_Integer i;
113 gp_Pnt P,P1;
114 gp_Vec DP,DP1U,DP1V;
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
117
118 for (i=1;i<=3;i++)
119 {
120 F(i) = P.Coord(i) - P1.Coord(i);
121
122 D(i,1) = DP.Coord(i);
123 D(i,2) = -DP1U.Coord(i);
124 D(i,3) = -DP1V.Coord(i);
125 }
126
127 return Standard_True;
128}
129
130//*******************************************************
131// Function : DerivT
132// Purpose : calcul of the first derivative from t
133//*******************************************************
134 Standard_Boolean GeomFill_FunctionDraft::DerivT(const Handle(Adaptor3d_HCurve)& C,
135 const Standard_Real Param,
136 const Standard_Real W,
137 const gp_Vec & dN,
138 const Standard_Real teta,
139 math_Vector& F)
140
141{
142 gp_Pnt P;
143 gp_Vec DP;
144
145 C->D1(Param, P, DP); // derivee de la section
146
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);
150
151 return Standard_True;
152}
153
154//*******************************************************
155// Function : Deriv2T
156// Purpose : calcul of the second derivatice from t
157//*******************************************************
158 Standard_Boolean GeomFill_FunctionDraft::Deriv2T(const Handle(Adaptor3d_HCurve)& C,
159 const Standard_Real Param,
160 const Standard_Real W,
161 const gp_Vec & d2N,
162 const Standard_Real teta,
163 math_Vector& F)
164{
165 gp_Pnt P;
166 gp_Vec DP,D2P;
167
168 C->D2(Param, P, DP, D2P); // derivee de la section
169
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);
173
174 return Standard_True;
175}
176
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,
183 math_Matrix& D)
184{
185// gp_Pnt P;
186// gp_Vec DP,D2P;
187
188 Standard_Integer i;
189 for (i=1;i<=3;i++)
190 {
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
194 }
195
196 return Standard_True;
197}
198
199//*******************************************************
200// Function : Deriv2X
201// Purpose : calcul of the second derivative from x
202//*******************************************************
203 Standard_Boolean GeomFill_FunctionDraft::Deriv2X(const math_Vector & X,
204 GeomFill_Tensor& T)
205{
206 gp_Pnt P;
207 gp_Vec DPu,DPv;
208 gp_Vec D2Pu, D2Pv, D2Puv;
209 Standard_Integer i;
210
211 TheSurface->D2(X(2), X(3), P, DPu, DPv, D2Pu, D2Pv, D2Puv);
212
213 T.Init(0.); // tenseur
214
215 for (i=1;i<=3;i++)
216 {
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);
220 }
221
222 return Standard_True;
223}
224
225
226