1 // Created on: 2016-05-10
2 // Created by: Alexander MALYSHEV
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2016 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Extrema_FuncPSDsit_HeaderFile
18 #define _Extrema_FuncPSDsit_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
23 #include <math_MultipleVarFunctionWithGradient.hxx>
25 #include <Adaptor3d_Surface.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Standard_Integer.hxx>
33 //! Functional for search of extremum of the square Euclidean distance between point P and
34 //! surface S, starting from approximate solution (u0, v0).
36 //! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
37 //! for use in math_BFGS algorithm.
40 //! F = SquareDist(P, S(u, v)) - > min
42 //! The first derivative are:
43 //! F1(u,v) = (S(u,v) - P) * Su
44 //! F2(u,v) = (S(u,v) - P) * Sv
46 //! Su and Sv are first derivatives of the surface, * symbol means dot product.
47 class Extrema_FuncPSDist : public math_MultipleVarFunctionWithGradient
54 Standard_EXPORT Extrema_FuncPSDist(const Adaptor3d_Surface& theS,
57 //! Number of variables.
58 Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
61 Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
64 Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
66 //! Value and gradient.
67 Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
72 //! Check point is inside of the surface parameter space.
73 //! Returns true if inside and false otherwise.
74 Standard_Boolean IsInside(const math_Vector& X);
76 const Extrema_FuncPSDist& operator=(const Extrema_FuncPSDist&);
77 Extrema_FuncPSDist(const Extrema_FuncPSDist&);
79 const Adaptor3d_Surface &mySurf;
82 #endif // _Extrema_FuncPSDsit_HeaderFile