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 | |
22 | class gp_Pnt; |
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_DistFunction : public math_Function |
29 | { |
30 | public: |
31 | Standard_EXPORT GCPnts_DistFunction(const Adaptor3d_Curve& theCurve, |
32 | const Standard_Real U1, const Standard_Real U2); |
33 | // |
34 | Standard_EXPORT GCPnts_DistFunction(const GCPnts_DistFunction& theOther); |
35 | |
36 | Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X, |
37 | Standard_Real& F); |
38 | private: |
39 | GCPnts_DistFunction & operator = (const GCPnts_DistFunction & theOther); |
40 | |
41 | const Adaptor3d_Curve& myCurve; |
42 | gp_Lin myLin; |
43 | Standard_Real myU1; |
44 | Standard_Real myU2; |
45 | }; |
46 | // |
47 | //! The same as class GCPnts_DistFunction, but it can be used in minimization algorithms that |
48 | //! requires multi variable function |
49 | class GCPnts_DistFunctionMV : public math_MultipleVarFunction |
50 | { |
51 | public: |
52 | Standard_EXPORT GCPnts_DistFunctionMV(GCPnts_DistFunction& theCurvLinDist); |
53 | |
54 | Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, |
55 | Standard_Real& F); |
56 | |
57 | Standard_EXPORT virtual Standard_Integer NbVariables() const; |
58 | |
59 | private: |
60 | GCPnts_DistFunctionMV & operator = (const GCPnts_DistFunctionMV & theOther); |
61 | GCPnts_DistFunction& myMaxCurvLinDist; |
62 | }; |
63 | |
64 | // |
65 | |
66 | |
67 | #endif // _GCPnts_DistFunction_HeaderFile |