summaryrefslogtreecommitdiff
path: root/inc/GccIter_FunctionTanObl.gxx
blob: e466359045e254e2798ad90d5578d4e39fea6a83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// File:	GccIter_FunctionTanObl.gxx
// Created:	Mon Jan 20 16:35:40 1992
// Author:	Remi GILET
//		<reg@phobox>

#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>

GccIter_FunctionTanObl::
  GccIter_FunctionTanObl(const TheCurve& C      ,
			const gp_Dir2d& Dir    ) {
  TheCurv = C;
  TheDirection = Dir;
 }


Standard_Boolean GccIter_FunctionTanObl::
  Value (const Standard_Real  X    ,
	       Standard_Real& Fval ) {
  gp_Pnt2d Point;
  gp_Vec2d Vect;
  TheCurveTool::D1(TheCurv,X,Point,Vect);
  Standard_Real NormeD1 = Vect.Magnitude();
  Fval = TheDirection.XY().Crossed(Vect.XY())/NormeD1;
  return Standard_True;
}

Standard_Boolean GccIter_FunctionTanObl::
  Derivative (const Standard_Real  X     ,
	            Standard_Real& Deriv ) {
  gp_Pnt2d Point;
  gp_Vec2d Vec1;
  gp_Vec2d Vec2;
  TheCurveTool::D2(TheCurv,X,Point,Vec1,Vec2);
  Standard_Real NormeD1 = Vec1.Magnitude();
  Deriv = TheDirection.XY().Crossed(Vec2.XY())/NormeD1-
      Vec1.XY().Dot(Vec2.XY())*TheDirection.XY().Crossed(Vec1.XY())/NormeD1;
  return Standard_True;
}

Standard_Boolean GccIter_FunctionTanObl::
  Values (const Standard_Real  X     ,
	        Standard_Real& Fval  ,
	        Standard_Real& Deriv ) {
  gp_Pnt2d Point;
  gp_Vec2d Vec1;
  gp_Vec2d Vec2;
  TheCurveTool::D2(TheCurv,X,Point,Vec1,Vec2);
  Standard_Real NormeD1 = Vec1.Magnitude();
  Fval = TheDirection.XY().Crossed(Vec1.XY())/NormeD1;
  Deriv = TheDirection.XY().Crossed(Vec2.XY())/NormeD1-
      Vec1.XY().Dot(Vec2.XY())*TheDirection.XY().Crossed(Vec1.XY())/NormeD1;
  return Standard_True;
}