0031313: Foundation Classes - Dump improvement for classes
[occt.git] / src / Geom2dGcc / Geom2dGcc_FunctionTanCuCuOnCu.cxx
CommitLineData
b311480e 1// Created on: 1992-01-20
2// Created by: Remi GILET
3// Copyright (c) 1992-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
54e37688 17
7fd59977 18#include <ElCLib.hxx>
42cf5bc1 19#include <Geom2dAdaptor_Curve.hxx>
54e37688 20#include <Geom2dGcc_CurveTool.hxx>
42cf5bc1 21#include <Geom2dGcc_FunctionTanCuCuOnCu.hxx>
22#include <gp_Circ2d.hxx>
23#include <gp_Lin2d.hxx>
24#include <gp_Pnt2d.hxx>
25#include <gp_Vec2d.hxx>
26#include <math_Matrix.hxx>
27#include <Standard_ConstructionError.hxx>
54e37688 28
29void Geom2dGcc_FunctionTanCuCuOnCu::
7fd59977 30 InitDerivative(const math_Vector& X,
31 gp_Pnt2d& Point1,
32 gp_Pnt2d& Point2,
33 gp_Pnt2d& Point3,
34 gp_Vec2d& Tan1,
35 gp_Vec2d& Tan2,
36 gp_Vec2d& Tan3,
37 gp_Vec2d& D21,
38 gp_Vec2d& D22,
39 gp_Vec2d& D23) {
40 switch (TheType) {
54e37688 41 case Geom2dGcc_CuCuOnCu:
7fd59977 42 {
54e37688 43 Geom2dGcc_CurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
44 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
45 Geom2dGcc_CurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
7fd59977 46 }
47 break;
54e37688 48 case Geom2dGcc_CiCuOnCu:
7fd59977 49 {
50 ElCLib::D2(X(1),Circ1,Point1,Tan1,D21);
54e37688 51 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
52 Geom2dGcc_CurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
7fd59977 53 }
54 break;
54e37688 55 case Geom2dGcc_LiCuOnCu:
7fd59977 56 {
57 ElCLib::D1(X(1),Lin1,Point1,Tan1);
58 D21 = gp_Vec2d(0.,0.);
54e37688 59 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
60 Geom2dGcc_CurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
7fd59977 61 }
62 break;
54e37688 63 case Geom2dGcc_CuPtOnCu:
7fd59977 64 {
54e37688 65 Geom2dGcc_CurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
66 Geom2dGcc_CurveTool::D2(Curvon,X(3),Point3,Tan3,D23);
7fd59977 67 Point2 = Pnt2;
68 Tan2 = gp_Vec2d(0.,0.);
69 D22 = gp_Vec2d(0.,0.);
70 }
71 break;
54e37688 72 case Geom2dGcc_CuCuOnCi:
7fd59977 73 {
54e37688 74 Geom2dGcc_CurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
75 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
7fd59977 76 ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
77 }
78 break;
54e37688 79 case Geom2dGcc_CiCuOnCi:
7fd59977 80 {
81 ElCLib::D2(X(1),Circ1,Point1,Tan1,D21);
54e37688 82 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
7fd59977 83 ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
84 }
85 break;
54e37688 86 case Geom2dGcc_LiCuOnCi:
7fd59977 87 {
88 ElCLib::D1(X(1),Lin1,Point1,Tan1);
89 D21 = gp_Vec2d(0.,0.);
54e37688 90 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
7fd59977 91 ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
92 }
93 break;
54e37688 94 case Geom2dGcc_CuPtOnCi:
7fd59977 95 {
54e37688 96 Geom2dGcc_CurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
7fd59977 97 Point2 = Pnt2;
98 Tan2 = gp_Vec2d(0.,0.);
99 D22 = gp_Vec2d(0.,0.);
100 ElCLib::D2(X(3),Circon,Point3,Tan3,D23);
101 }
102 break;
54e37688 103 case Geom2dGcc_CuCuOnLi:
7fd59977 104 {
54e37688 105 Geom2dGcc_CurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
106 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
7fd59977 107 ElCLib::D1(X(3),Linon,Point3,Tan3);
108 D23 = gp_Vec2d(0.,0.);
109 }
110 break;
54e37688 111 case Geom2dGcc_CiCuOnLi:
7fd59977 112 {
113 ElCLib::D2(X(1),Circ1,Point1,Tan1,D21);
54e37688 114 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
7fd59977 115 ElCLib::D1(X(3),Linon,Point3,Tan3);
116 D23 = gp_Vec2d(0.,0.);
117 }
118 break;
54e37688 119 case Geom2dGcc_LiCuOnLi:
7fd59977 120 {
121 ElCLib::D1(X(1),Lin1,Point1,Tan1);
54e37688 122 Geom2dGcc_CurveTool::D2(Curv2,X(2),Point2,Tan2,D22);
7fd59977 123 D21 = gp_Vec2d(0.,0.);
124 ElCLib::D1(X(3),Linon,Point3,Tan3);
125 D23 = gp_Vec2d(0.,0.);
126 }
127 break;
54e37688 128 case Geom2dGcc_CuPtOnLi:
7fd59977 129 {
54e37688 130 Geom2dGcc_CurveTool::D2(Curv1,X(1),Point1,Tan1,D21);
7fd59977 131 Point2 = Pnt2;
132 Tan2 = gp_Vec2d(0.,0.);
133 D22 = gp_Vec2d(0.,0.);
134 ElCLib::D1(X(3),Linon,Point3,Tan3);
135 D23 = gp_Vec2d(0.,0.);
136 }
137 break;
138 default:
139 {
9775fa61 140 throw Standard_ConstructionError();
7fd59977 141 }
142 }
143}
144
54e37688 145Geom2dGcc_FunctionTanCuCuOnCu::
146 Geom2dGcc_FunctionTanCuCuOnCu(const Geom2dAdaptor_Curve& C1 ,
147 const Geom2dAdaptor_Curve& C2 ,
148 const Geom2dAdaptor_Curve& C3 ,
7fd59977 149 const Standard_Real Rad ) {
150 Curv1 = C1;
151 Curv2 = C2;
152 Curvon = C3;
153 FirstRad = Rad;
54e37688 154 TheType = Geom2dGcc_CuCuOnCu;
7fd59977 155}
156
54e37688 157Geom2dGcc_FunctionTanCuCuOnCu::
158 Geom2dGcc_FunctionTanCuCuOnCu(const gp_Circ2d& C1 ,
159 const Geom2dAdaptor_Curve& C2 ,
160 const Geom2dAdaptor_Curve& C3 ,
7fd59977 161 const Standard_Real Rad ) {
162 Circ1 = C1;
163 Curv2 = C2;
164 Curvon = C3;
165 FirstRad = Rad;
54e37688 166 TheType = Geom2dGcc_CiCuOnCu;
7fd59977 167}
168
54e37688 169Geom2dGcc_FunctionTanCuCuOnCu::
170 Geom2dGcc_FunctionTanCuCuOnCu(const gp_Lin2d& L1 ,
171 const Geom2dAdaptor_Curve& C2 ,
172 const Geom2dAdaptor_Curve& C3 ,
7fd59977 173 const Standard_Real Rad ) {
174 Lin1 = L1;
175 Curv2 = C2;
176 Curvon = C3;
177 FirstRad = Rad;
54e37688 178 TheType = Geom2dGcc_LiCuOnCu;
7fd59977 179}
180
54e37688 181Geom2dGcc_FunctionTanCuCuOnCu::
182 Geom2dGcc_FunctionTanCuCuOnCu(const Geom2dAdaptor_Curve& C1 ,
7fd59977 183 const gp_Pnt2d& P2 ,
54e37688 184 const Geom2dAdaptor_Curve& C3 ,
7fd59977 185 const Standard_Real Rad ) {
186 Curv1 = C1;
187 Pnt2 = P2;
188 Curvon = C3;
189 FirstRad = Rad;
54e37688 190 TheType = Geom2dGcc_CuPtOnCu;
7fd59977 191}
192
54e37688 193Geom2dGcc_FunctionTanCuCuOnCu::
194 Geom2dGcc_FunctionTanCuCuOnCu(const Geom2dAdaptor_Curve& C1 ,
195 const Geom2dAdaptor_Curve& C2 ,
7fd59977 196 const gp_Lin2d& OnLi ,
197 const Standard_Real Rad ) {
198 Curv1 = C1;
199 Curv2 = C2;
200 Linon = OnLi;
201 FirstRad = Rad;
54e37688 202 TheType = Geom2dGcc_CuCuOnLi;
7fd59977 203}
204
54e37688 205Geom2dGcc_FunctionTanCuCuOnCu::
206 Geom2dGcc_FunctionTanCuCuOnCu(const gp_Circ2d& C1 ,
207 const Geom2dAdaptor_Curve& C2 ,
7fd59977 208 const gp_Lin2d& OnLi ,
209 const Standard_Real Rad ) {
210 Circ1 = C1;
211 Curv2 = C2;
212 Linon = OnLi;
213 FirstRad = Rad;
54e37688 214 TheType = Geom2dGcc_CiCuOnLi;
7fd59977 215}
216
54e37688 217Geom2dGcc_FunctionTanCuCuOnCu::
218 Geom2dGcc_FunctionTanCuCuOnCu(const gp_Lin2d& L1 ,
219 const Geom2dAdaptor_Curve& C2 ,
7fd59977 220 const gp_Lin2d& OnLi ,
221 const Standard_Real Rad ) {
222 Lin1 = L1;
223 Curv2 = C2;
224 Linon = OnLi;
225 FirstRad = Rad;
54e37688 226 TheType = Geom2dGcc_LiCuOnLi;
7fd59977 227}
228
54e37688 229Geom2dGcc_FunctionTanCuCuOnCu::
230 Geom2dGcc_FunctionTanCuCuOnCu(const Geom2dAdaptor_Curve& C1 ,
7fd59977 231 const gp_Pnt2d& P2 ,
232 const gp_Lin2d& OnLi ,
233 const Standard_Real Rad ) {
234 Curv1 = C1;
235 Pnt2 = P2;
236 Linon = OnLi;
237 FirstRad = Rad;
54e37688 238 TheType = Geom2dGcc_CuPtOnLi;
7fd59977 239}
240
54e37688 241Geom2dGcc_FunctionTanCuCuOnCu::
242 Geom2dGcc_FunctionTanCuCuOnCu(const Geom2dAdaptor_Curve& C1 ,
243 const Geom2dAdaptor_Curve& C2 ,
7fd59977 244 const gp_Circ2d& OnCi ,
245 const Standard_Real Rad ) {
246 Curv1 = C1;
247 Curv2 = C2;
248 Circon = OnCi;
249 FirstRad = Rad;
54e37688 250 TheType = Geom2dGcc_CuCuOnCi;
7fd59977 251}
252
54e37688 253Geom2dGcc_FunctionTanCuCuOnCu::
254 Geom2dGcc_FunctionTanCuCuOnCu(const gp_Circ2d& C1 ,
255 const Geom2dAdaptor_Curve& C2 ,
7fd59977 256 const gp_Circ2d& OnCi ,
257 const Standard_Real Rad ) {
258 Circ1 = C1;
259 Curv2 = C2;
260 Circon = OnCi;
261 FirstRad = Rad;
54e37688 262 TheType = Geom2dGcc_CuCuOnCi;
7fd59977 263}
264
54e37688 265Geom2dGcc_FunctionTanCuCuOnCu::
266 Geom2dGcc_FunctionTanCuCuOnCu(const gp_Lin2d& L1 ,
267 const Geom2dAdaptor_Curve& C2 ,
7fd59977 268 const gp_Circ2d& OnCi ,
269 const Standard_Real Rad ) {
270 Lin1 = L1;
271 Curv2 = C2;
272 Circon = OnCi;
273 FirstRad = Rad;
54e37688 274 TheType = Geom2dGcc_LiCuOnCi;
7fd59977 275}
276
54e37688 277Geom2dGcc_FunctionTanCuCuOnCu::
278 Geom2dGcc_FunctionTanCuCuOnCu(const Geom2dAdaptor_Curve& C1 ,
7fd59977 279 const gp_Pnt2d& P2 ,
280 const gp_Circ2d& OnCi ,
281 const Standard_Real Rad ) {
282 Curv1 = C1;
283 Pnt2 = P2;
284 Circon = OnCi;
285 FirstRad = Rad;
54e37688 286 TheType = Geom2dGcc_CuPtOnCi;
7fd59977 287}
288
54e37688 289Standard_Integer Geom2dGcc_FunctionTanCuCuOnCu::
7fd59977 290 NbVariables () const { return 4; }
291
54e37688 292Standard_Integer Geom2dGcc_FunctionTanCuCuOnCu::
7fd59977 293 NbEquations () const { return 4; }
294
54e37688 295Standard_Boolean Geom2dGcc_FunctionTanCuCuOnCu::
7fd59977 296 Value (const math_Vector& X ,
297 math_Vector& Fval ) {
298 gp_Pnt2d Point1,Point2,Point3;
299 gp_Vec2d Tan1,Tan2,Tan3,D21,D22,D23;
300 InitDerivative(X,Point1,Point2,Point3,Tan1,Tan2,Tan3,D21,D22,D23);
301//pipj (normes) et PiPj (non Normes).
302 gp_Vec2d P1P2(Point1,Point2);
303 gp_Vec2d P2P3(Point2,Point3);
304 gp_Vec2d P3P1(Point3,Point1);
305 gp_Vec2d p1p2,p2p3,p3p1;
306// if (FirstRad < 1.) {FirstRad = 1.; }
307 p1p2 = P1P2/FirstRad;
308 p2p3 = P2P3/FirstRad;
309 p3p1 = P3P1/FirstRad;
310//norme des Tani.
311 Standard_Real nnor1 = Tan1.Magnitude();
312 Standard_Real nnor2 = Tan2.Magnitude();
7fd59977 313// Fonctions Fui.
314// ==============
315 Fval(1) = (P3P1.Dot(P3P1)-X(4)*X(4))/(FirstRad*FirstRad);
316 Fval(2) = (P2P3.Dot(P2P3)-X(4)*X(4))/(FirstRad*FirstRad);
317 Fval(3) = P3P1.Dot(Tan1)/(nnor1*FirstRad);
318 Fval(4) = P2P3.Dot(Tan2)/(nnor2*FirstRad);
319 return Standard_True;
320}
321
54e37688 322Standard_Boolean Geom2dGcc_FunctionTanCuCuOnCu::
7fd59977 323 Derivatives (const math_Vector& X ,
324 math_Matrix& Deriv ) {
325 gp_Pnt2d Point1,Point2,Point3;
326 gp_Vec2d Tan1,Tan2,Tan3;
327 gp_Vec2d D21,D22,D23;
328 InitDerivative(X,Point1,Point2,Point3,Tan1,Tan2,Tan3,D21,D22,D23);
329//pipj (normes) et PiPj (non Normes).
330 gp_Vec2d P1P2(Point1,Point2);
331 gp_Vec2d P2P3(Point2,Point3);
332 gp_Vec2d P3P1(Point3,Point1);
333 gp_Vec2d p1p2,p2p3,p3p1;
334// if (FirstRad < 1.) {FirstRad = 1.; }
335 p1p2 = P1P2/FirstRad;
336 p2p3 = P2P3/FirstRad;
337 p3p1 = P3P1/FirstRad;
338//normales au courbes normees Nori et non nromees nori et norme des nori.
339 Standard_Real nnor1 = Tan1.Magnitude();
340 Standard_Real nnor2 = Tan2.Magnitude();
7fd59977 341// Derivees dFui/uj 1 <= ui <= 3 , 1 <= uj <= 3
342// =============================================
343 Deriv(1,1) = 2.*Tan1.Dot(P3P1)/(FirstRad*FirstRad);
344 Deriv(1,2) = 0.;
345 Deriv(1,3) = -2.*Tan3.Dot(P3P1)/(FirstRad*FirstRad);
346 Deriv(1,4) = -2.*X(4)/(FirstRad*FirstRad);
347
348 Deriv(2,1) = 0.;
349 Deriv(2,2) = -2.*Tan2.Dot(P2P3)/(FirstRad*FirstRad);
350 Deriv(2,3) = 2.*Tan3.Dot(P2P3)/(FirstRad*FirstRad);
351 Deriv(2,4) = -2.*X(4)/(FirstRad*FirstRad);
352
353 Deriv(3,1) = (P3P1.Dot(D21)+Tan1.Dot(Tan1))/(FirstRad*nnor1)-
354 (P3P1.Dot(Tan1)*D21.Dot(Tan1))/(FirstRad*nnor1*nnor1*nnor1);
355 Deriv(3,2) = 0.;
356 Deriv(3,3) = -(Tan3.Dot(Tan1))/(FirstRad*nnor1);
357 Deriv(3,4) = 0.;
358
359 Deriv(4,1) = 0.;
360 Deriv(4,2) = (P2P3.Dot(D22)-Tan2.Dot(Tan2))/(FirstRad*nnor2)-
361 P2P3.Dot(Tan2)*Tan2.Dot(D22)/(FirstRad*nnor2*nnor2*nnor2);
362 Deriv(4,3) = Tan3.Dot(Tan2)/(FirstRad*nnor1);
363 Deriv(4,4) = 0.;
364 return Standard_True;
365}
366
54e37688 367Standard_Boolean Geom2dGcc_FunctionTanCuCuOnCu::
7fd59977 368 Values (const math_Vector& X ,
369 math_Vector& Fval ,
370 math_Matrix& Deriv ) {
371 gp_Pnt2d Point1,Point2,Point3;
372 gp_Vec2d Tan1,Tan2,Tan3;
373 gp_Vec2d D21,D22,D23;
374 InitDerivative(X,Point1,Point2,Point3,Tan1,Tan2,Tan3,D21,D22,D23);
375//pipj (normes) et PiPj (non Normes).
376 gp_Vec2d P1P2(Point1,Point2);
377 gp_Vec2d P2P3(Point2,Point3);
378 gp_Vec2d P3P1(Point3,Point1);
379 gp_Vec2d p1p2,p2p3,p3p1;
380// if (FirstRad < 1.) {FirstRad = 1.; }
381 p1p2 = P1P2/FirstRad;
382 p2p3 = P2P3/FirstRad;
383 p3p1 = P3P1/FirstRad;
384//normales au courbes normees Nori et non nromees nori et norme des nori.
385 Standard_Real nnor1 = Tan1.Magnitude();
386 Standard_Real nnor2 = Tan2.Magnitude();
7fd59977 387// Fonctions Fui.
388// ==============
389 Fval(1) = (P3P1.Dot(P3P1)-X(4)*X(4))/(FirstRad*FirstRad);
390 Fval(2) = (P2P3.Dot(P2P3)-X(4)*X(4))/(FirstRad*FirstRad);
391 Fval(3) = P3P1.Dot(Tan1)/(nnor1*FirstRad);
392 Fval(4) = P2P3.Dot(Tan2)/(nnor2*FirstRad);
393// Derivees dFui/uj 1 <= ui <= 3 , 1 <= uj <= 3
394// =============================================
395 Deriv(1,1) = 2.*Tan1.Dot(P3P1)/(FirstRad*FirstRad);
396 Deriv(1,2) = 0.;
397 Deriv(1,3) = -2.*Tan3.Dot(P3P1)/(FirstRad*FirstRad);
398 Deriv(1,4) = -2.*X(4)/(FirstRad*FirstRad);
399
400 Deriv(2,1) = 0.;
401 Deriv(2,2) = -2.*Tan2.Dot(P2P3)/(FirstRad*FirstRad);
402 Deriv(2,3) = 2.*Tan3.Dot(P2P3)/(FirstRad*FirstRad);
403 Deriv(2,4) = -2.*X(4)/(FirstRad*FirstRad);
404
405 Deriv(3,1) = (P3P1.Dot(D21)+Tan1.Dot(Tan1))/(FirstRad*nnor1)-
406 (P3P1.Dot(Tan1)*D21.Dot(Tan1))/(FirstRad*nnor1*nnor1*nnor1);
407 Deriv(3,2) = 0.;
408 Deriv(3,3) = -(Tan3.Dot(Tan1))/(FirstRad*nnor1);
409 Deriv(3,4) = 0.;
410
411 Deriv(4,1) = 0.;
412 Deriv(4,2) = (P2P3.Dot(D22)-Tan2.Dot(Tan2))/(FirstRad*nnor2)-
413 P2P3.Dot(Tan2)*Tan2.Dot(D22)/(FirstRad*nnor2*nnor2*nnor2);
414 Deriv(4,3) = Tan3.Dot(Tan2)/(FirstRad*nnor1);
415 Deriv(4,4) = 0.;
416 return Standard_True;
417}
418