9c1519c4 |
1 | // Copyright (c) 2014-2014 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #ifndef _GCPnts_DistFunction2d_HeaderFile |
15 | #define _GCPnts_DistFunction2d_HeaderFile |
16 | |
17 | #include <gp_Lin2d.hxx> |
18 | #include <math_Function.hxx> |
19 | #include <math_MultipleVarFunction.hxx> |
20 | #include <Adaptor2d_Curve2d.hxx> |
21 | |
22 | class gp_Pnt2d; |
23 | |
24 | //! Class to define function, which calculates square distance between point on curve |
25 | //! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2) |
26 | //! This function is used in any minimisation algorithm to define maximal deviation between curve and line, |
27 | //! which required one variable function without derivative (for ex. math_BrentMinimum) |
28 | class GCPnts_DistFunction2d : public math_Function |
29 | { |
30 | public: |
31 | Standard_EXPORT GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve, |
32 | const Standard_Real U1, const Standard_Real U2); |
33 | // |
34 | Standard_EXPORT GCPnts_DistFunction2d(const GCPnts_DistFunction2d& theOther); |
35 | |
36 | Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X, |
37 | Standard_Real& F); |
38 | private: |
39 | GCPnts_DistFunction2d & operator = (const GCPnts_DistFunction2d & theOther); |
40 | |
41 | const Adaptor2d_Curve2d& myCurve; |
42 | gp_Lin2d myLin; |
43 | Standard_Real myU1; |
44 | Standard_Real myU2; |
45 | }; |
46 | // |
47 | //! The same as class GCPnts_DistFunction2d, |
48 | //! but it can be used in minimization algorithms that |
49 | //! requires multi variable function |
50 | class GCPnts_DistFunction2dMV : public math_MultipleVarFunction |
51 | { |
52 | public: |
53 | Standard_EXPORT GCPnts_DistFunction2dMV(GCPnts_DistFunction2d& theCurvLinDist); |
54 | |
55 | Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, |
56 | Standard_Real& F); |
57 | |
58 | |
59 | Standard_EXPORT virtual Standard_Integer NbVariables() const; |
60 | |
61 | private: |
62 | GCPnts_DistFunction2dMV & operator = (const GCPnts_DistFunction2dMV & theOther); |
63 | GCPnts_DistFunction2d& myMaxCurvLinDist; |
64 | }; |
65 | // |
66 | |
67 | |
68 | #endif // _GCPnts_DistFunction2d_HeaderFile |