1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <CPnts_MyRootFunction.hxx>
17 #include <math_GaussSingleIntegration.hxx>
18 #include <Standard_DomainError.hxx>
20 void CPnts_MyRootFunction::Init(const CPnts_RealFunction& F,
21 const Standard_Address D,
22 const Standard_Integer Order)
28 void CPnts_MyRootFunction::Init(const Standard_Real X0,
29 const Standard_Real L)
33 myTol = -1; //to supress the tolerance
36 void CPnts_MyRootFunction::Init(const Standard_Real X0,
37 const Standard_Real L,
38 const Standard_Real Tol)
45 Standard_Boolean CPnts_MyRootFunction::Value(const Standard_Real X,
48 math_GaussSingleIntegration Length;
50 if (myTol <= 0) Length = math_GaussSingleIntegration(myFunction, myX0, X, myOrder);
51 else Length = math_GaussSingleIntegration(myFunction, myX0, X, myOrder, myTol);
54 F= Length.Value() - myL;
58 return Standard_False;
62 Standard_Boolean CPnts_MyRootFunction::Derivative(const Standard_Real X,
65 return myFunction.Value(X,Df);
68 Standard_Boolean CPnts_MyRootFunction::Values(const Standard_Real X,
72 math_GaussSingleIntegration Length;
74 if (myTol <= 0) Length = math_GaussSingleIntegration(myFunction, myX0, X, myOrder);
75 else Length = math_GaussSingleIntegration(myFunction, myX0, X, myOrder, myTol);
78 F= Length.Value() - myL;
79 return myFunction.Value(X,Df);
82 return Standard_False;