7fd59977 |
1 | // File: Adaptor3d_InterFunc.cxx |
2 | // Created: Wed Feb 18 09:29:56 1998 |
3 | // Author: Jeanine PANCIATICI |
4 | // <jpi@sgi38> |
5 | |
6 | |
7 | #include <Adaptor3d_InterFunc.ixx> |
8 | #include <Adaptor2d_HCurve2d.hxx> |
9 | #include <gp_Pnt2d.hxx> |
10 | #include <gp_Vec2d.hxx> |
11 | |
12 | Adaptor3d_InterFunc::Adaptor3d_InterFunc(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real FixVal, const Standard_Integer Fix) : myCurve2d(C),myFixVal(FixVal),myFix(Fix) |
13 | { |
14 | if(Fix != 1 && Fix != 2 ) Standard_ConstructionError::Raise(); |
15 | |
16 | } |
17 | |
18 | Standard_Boolean Adaptor3d_InterFunc::Value(const Standard_Real X , Standard_Real& F) |
19 | { |
20 | gp_Pnt2d C; |
21 | myCurve2d->D0(X,C); |
22 | if(myFix == 1) |
23 | F=C.X()-myFixVal; |
24 | else |
25 | F=C.Y()-myFixVal; |
26 | |
27 | return Standard_True; |
28 | } |
29 | Standard_Boolean Adaptor3d_InterFunc::Derivative(const Standard_Real X , Standard_Real& D) |
30 | { |
31 | Standard_Real F; |
32 | return Values(X,F,D); |
33 | } |
34 | Standard_Boolean Adaptor3d_InterFunc::Values(const Standard_Real X , Standard_Real& F,Standard_Real& D) |
35 | { |
36 | gp_Pnt2d C; |
37 | gp_Vec2d DC; |
38 | myCurve2d->D1(X,C,DC); |
39 | if(myFix == 1) { |
40 | F=C.X()-myFixVal; |
41 | D=DC.X();} |
42 | else { |
43 | F=C.Y()-myFixVal; |
44 | D=DC.Y();} |
45 | return Standard_True; |
46 | } |