228b4f31116f5daf969eff606ea10755b3900834
[occt.git] / src / Extrema / Extrema_GlobOptFuncCS.hxx
1 // Created on: 2014-06-23
2 // Created by: Alexander Malyshev
3 // Copyright (c) 2014-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement
15
16 #ifndef _Extrema_GlobOptFuncCS_HeaderFile
17 #define _Extrema_GlobOptFuncCS_HeaderFile
18
19
20 #include <Adaptor3d_Curve.hxx>
21 #include <Adaptor3d_Surface.hxx>
22 #include <math_Matrix.hxx>
23 #include <math_Vector.hxx>
24 #include <math_MultipleVarFunctionWithHessian.hxx>
25
26 //! This class implements function which calculate Eucluidean distance
27 //! between point on curve and point on surface in case of continuity is C2.
28 class Extrema_GlobOptFuncCS : public math_MultipleVarFunctionWithHessian
29 {
30 public:
31
32   //! Curve and surface should exist during all the lifetime of Extrema_GlobOptFuncCS.
33   Standard_EXPORT  Extrema_GlobOptFuncCS(const Adaptor3d_Curve   *C,
34                                          const Adaptor3d_Surface *S);
35
36   Standard_EXPORT virtual Standard_Integer NbVariables() const;
37
38   Standard_EXPORT virtual Standard_Boolean Value(const math_Vector &theX,
39                                                  Standard_Real     &theF);
40
41   Standard_EXPORT virtual Standard_Boolean Gradient(const math_Vector &theX,
42                                                     math_Vector       &theG);
43
44   Standard_EXPORT virtual Standard_Boolean Values(const math_Vector &theX,
45                                                   Standard_Real     &theF,
46                                                   math_Vector       &theG);
47
48   Standard_EXPORT virtual Standard_Boolean Values(const math_Vector &theX,
49                                                   Standard_Real     &theF,
50                                                   math_Vector       &theG,
51                                                   math_Matrix       &theH);
52
53 private:
54
55   Standard_Boolean checkInputData(const math_Vector   &X,
56                                   Standard_Real       &cu,
57                                   Standard_Real       &su,
58                                   Standard_Real       &sv);
59
60   void value(Standard_Real cu,
61              Standard_Real su,
62              Standard_Real sv,
63              Standard_Real &F);
64
65   void gradient(Standard_Real cu,
66                 Standard_Real su,
67                 Standard_Real sv,
68                 math_Vector   &G);
69
70   void hessian(Standard_Real cu,
71                Standard_Real su,
72                Standard_Real sv,
73                math_Matrix   &H);
74
75   Extrema_GlobOptFuncCS & operator = (const Extrema_GlobOptFuncCS & theOther);
76
77   const Adaptor3d_Curve   *myC;
78   const Adaptor3d_Surface *myS;
79 };
80
81 #endif