Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:57:49

0001 // Copyright (c) 2014-2014 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _GCPnts_DistFunction2d_HeaderFile
0015 #define _GCPnts_DistFunction2d_HeaderFile
0016 
0017 #include <math_Function.hxx>
0018 #include <math_MultipleVarFunction.hxx>
0019 #include <Adaptor2d_Curve2d.hxx>
0020 
0021 //! Class to define function, which calculates square distance between point on curve
0022 //! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
0023 //! This function is used in any minimisation algorithm to define maximal deviation between curve
0024 //! and line, which required one variable function without derivative (for ex. math_BrentMinimum)
0025 class GCPnts_DistFunction2d : public math_Function
0026 {
0027 public:
0028   Standard_EXPORT GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve,
0029                                         const double             U1,
0030                                         const double             U2);
0031   //
0032   Standard_EXPORT GCPnts_DistFunction2d(const GCPnts_DistFunction2d& theOther);
0033 
0034   Standard_EXPORT bool Value(const double X, double& F) override;
0035 
0036 private:
0037   GCPnts_DistFunction2d& operator=(const GCPnts_DistFunction2d& theOther);
0038 
0039   const Adaptor2d_Curve2d& myCurve;
0040   gp_Lin2d                 myLin;
0041   double                   myU1;
0042   double                   myU2;
0043 };
0044 
0045 //
0046 //! The same as class GCPnts_DistFunction2d,
0047 //! but it can be used in minimization algorithms that
0048 //! requires multi variable function
0049 class GCPnts_DistFunction2dMV : public math_MultipleVarFunction
0050 {
0051 public:
0052   Standard_EXPORT GCPnts_DistFunction2dMV(GCPnts_DistFunction2d& theCurvLinDist);
0053 
0054   Standard_EXPORT bool Value(const math_Vector& X, double& F) override;
0055 
0056   Standard_EXPORT int NbVariables() const override;
0057 
0058 private:
0059   GCPnts_DistFunction2dMV& operator=(const GCPnts_DistFunction2dMV& theOther) = delete;
0060   GCPnts_DistFunction2d&   myMaxCurvLinDist;
0061 };
0062 
0063 //
0064 
0065 #endif // _GCPnts_DistFunction2d_HeaderFile