0023024: Update headers of OCCT files
[occt.git] / src / Adaptor3d / Adaptor3d_InterFunc.cxx
CommitLineData
b311480e 1// Created on: 1998-02-18
2// Created by: Jeanine PANCIATICI
3// Copyright (c) 1998-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23#include <Adaptor3d_InterFunc.ixx>
24#include <Adaptor2d_HCurve2d.hxx>
25#include <gp_Pnt2d.hxx>
26#include <gp_Vec2d.hxx>
27
28Adaptor3d_InterFunc::Adaptor3d_InterFunc(const Handle(Adaptor2d_HCurve2d)& C, const Standard_Real FixVal, const Standard_Integer Fix) : myCurve2d(C),myFixVal(FixVal),myFix(Fix)
29{
30 if(Fix != 1 && Fix != 2 ) Standard_ConstructionError::Raise();
31
32}
33
34Standard_Boolean Adaptor3d_InterFunc::Value(const Standard_Real X , Standard_Real& F)
35{
36 gp_Pnt2d C;
37 myCurve2d->D0(X,C);
38 if(myFix == 1)
39 F=C.X()-myFixVal;
40 else
41 F=C.Y()-myFixVal;
42
43 return Standard_True;
44}
45Standard_Boolean Adaptor3d_InterFunc::Derivative(const Standard_Real X , Standard_Real& D)
46{
47 Standard_Real F;
48 return Values(X,F,D);
49}
50Standard_Boolean Adaptor3d_InterFunc::Values(const Standard_Real X , Standard_Real& F,Standard_Real& D)
51{
52 gp_Pnt2d C;
53 gp_Vec2d DC;
54 myCurve2d->D1(X,C,DC);
55 if(myFix == 1) {
56 F=C.X()-myFixVal;
57 D=DC.X();}
58 else {
59 F=C.Y()-myFixVal;
60 D=DC.Y();}
61 return Standard_True;
62}