Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:29

0001 // Created on: 2016-05-10
0002 // Created by: Alexander MALYSHEV
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2016 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Extrema_FuncPSDsit_HeaderFile
0018 #define _Extrema_FuncPSDsit_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <math_MultipleVarFunctionWithGradient.hxx>
0024 #include <Adaptor3d_Surface.hxx>
0025 
0026 #include <Standard_Boolean.hxx>
0027 
0028 template<typename T> class math_VectorBase;
0029 using math_Vector = math_VectorBase<double>;
0030 
0031 //! Functional for search of extremum of the square Euclidean distance between point P and
0032 //! surface S, starting from approximate solution (u0, v0).
0033 //!
0034 //! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
0035 //! for use in math_BFGS algorithm.
0036 //!
0037 //! The criteria is:
0038 //! F = SquareDist(P, S(u, v)) - > min
0039 //!
0040 //! The first derivative are:
0041 //! F1(u,v) = (S(u,v) - P) * Su
0042 //! F2(u,v) = (S(u,v) - P) * Sv
0043 //!
0044 //! Su and Sv are first derivatives of the surface, * symbol means dot product.
0045 class Extrema_FuncPSDist  : public math_MultipleVarFunctionWithGradient
0046 {
0047 public:
0048 
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Constructor.
0052   Standard_EXPORT Extrema_FuncPSDist(const Adaptor3d_Surface& theS,
0053                                      const gp_Pnt& theP);
0054 
0055   //! Number of variables.
0056   Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
0057 
0058   //! Value.
0059   Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
0060 
0061   //! Gradient.
0062   Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
0063 
0064   //! Value and gradient.
0065   Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
0066 
0067 private:
0068 
0069 
0070   //! Check point is inside of the surface parameter space.
0071   //! Returns true if inside and false otherwise.
0072   Standard_Boolean IsInside(const math_Vector& X);
0073 
0074   const Extrema_FuncPSDist& operator=(const Extrema_FuncPSDist&);
0075   Extrema_FuncPSDist(const Extrema_FuncPSDist&);
0076 
0077   const Adaptor3d_Surface &mySurf;
0078   const gp_Pnt &myP;
0079 };
0080 #endif // _Extrema_FuncPSDsit_HeaderFile