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_DistFunction_HeaderFile |
15 | #define _GCPnts_DistFunction_HeaderFile |
16 | |
17 | #include <gp_Lin.hxx> |
18 | #include <math_Function.hxx> |
19 | #include <math_MultipleVarFunction.hxx> |
20 | #include <Adaptor3d_Curve.hxx> |
21 | |
9c1519c4 |
22 | |
23 | //! Class to define function, which calculates square distance between point on curve |
24 | //! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2) |
3d42fbc1 |
25 | //! This function is used in any minimization algorithm to define maximal deviation between curve and line, |
9c1519c4 |
26 | //! which required one variable function without derivative (for ex. math_BrentMinimum) |
27 | class GCPnts_DistFunction : public math_Function |
28 | { |
29 | public: |
30 | Standard_EXPORT GCPnts_DistFunction(const Adaptor3d_Curve& theCurve, |
31 | const Standard_Real U1, const Standard_Real U2); |
32 | // |
33 | Standard_EXPORT GCPnts_DistFunction(const GCPnts_DistFunction& theOther); |
34 | |
35 | Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X, |
36 | Standard_Real& F); |
37 | private: |
38 | GCPnts_DistFunction & operator = (const GCPnts_DistFunction & theOther); |
39 | |
40 | const Adaptor3d_Curve& myCurve; |
41 | gp_Lin myLin; |
42 | Standard_Real myU1; |
43 | Standard_Real myU2; |
44 | }; |
45 | // |
46 | //! The same as class GCPnts_DistFunction, but it can be used in minimization algorithms that |
47 | //! requires multi variable function |
48 | class GCPnts_DistFunctionMV : public math_MultipleVarFunction |
49 | { |
50 | public: |
51 | Standard_EXPORT GCPnts_DistFunctionMV(GCPnts_DistFunction& theCurvLinDist); |
52 | |
53 | Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, |
54 | Standard_Real& F); |
55 | |
56 | Standard_EXPORT virtual Standard_Integer NbVariables() const; |
57 | |
58 | private: |
59 | GCPnts_DistFunctionMV & operator = (const GCPnts_DistFunctionMV & theOther); |
60 | GCPnts_DistFunction& myMaxCurvLinDist; |
61 | }; |
62 | |
63 | // |
64 | |
65 | |
66 | #endif // _GCPnts_DistFunction_HeaderFile |