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 | |
17 | #include <gp_Vec2d.hxx> |
18 | #include <gp_Pnt2d.hxx> |
19 | |
20 | GccIter_FunctionTanObl:: |
21 | GccIter_FunctionTanObl(const TheCurve& C , |
22 | const gp_Dir2d& Dir ) { |
23 | TheCurv = C; |
24 | TheDirection = Dir; |
25 | } |
26 | |
27 | |
28 | Standard_Boolean GccIter_FunctionTanObl:: |
29 | Value (const Standard_Real X , |
30 | Standard_Real& Fval ) { |
31 | gp_Pnt2d Point; |
32 | gp_Vec2d Vect; |
33 | TheCurveTool::D1(TheCurv,X,Point,Vect); |
34 | Standard_Real NormeD1 = Vect.Magnitude(); |
35 | Fval = TheDirection.XY().Crossed(Vect.XY())/NormeD1; |
36 | return Standard_True; |
37 | } |
38 | |
39 | Standard_Boolean GccIter_FunctionTanObl:: |
40 | Derivative (const Standard_Real X , |
41 | Standard_Real& Deriv ) { |
42 | gp_Pnt2d Point; |
43 | gp_Vec2d Vec1; |
44 | gp_Vec2d Vec2; |
45 | TheCurveTool::D2(TheCurv,X,Point,Vec1,Vec2); |
46 | Standard_Real NormeD1 = Vec1.Magnitude(); |
47 | Deriv = TheDirection.XY().Crossed(Vec2.XY())/NormeD1- |
48 | Vec1.XY().Dot(Vec2.XY())*TheDirection.XY().Crossed(Vec1.XY())/NormeD1; |
49 | return Standard_True; |
50 | } |
51 | |
52 | Standard_Boolean GccIter_FunctionTanObl:: |
53 | Values (const Standard_Real X , |
54 | Standard_Real& Fval , |
55 | Standard_Real& Deriv ) { |
56 | gp_Pnt2d Point; |
57 | gp_Vec2d Vec1; |
58 | gp_Vec2d Vec2; |
59 | TheCurveTool::D2(TheCurv,X,Point,Vec1,Vec2); |
60 | Standard_Real NormeD1 = Vec1.Magnitude(); |
61 | Fval = TheDirection.XY().Crossed(Vec1.XY())/NormeD1; |
62 | Deriv = TheDirection.XY().Crossed(Vec2.XY())/NormeD1- |
63 | Vec1.XY().Dot(Vec2.XY())*TheDirection.XY().Crossed(Vec1.XY())/NormeD1; |
64 | return Standard_True; |
65 | } |
66 | |