42cf5bc1 |
1 | // Created on: 1991-02-26 |
2 | // Created by: Isabelle GRIGNON |
3 | // Copyright (c) 1991-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Extrema_CCLocFOfLocECC2d_HeaderFile |
18 | #define _Extrema_CCLocFOfLocECC2d_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
42cf5bc1 |
24 | #include <gp_Pnt2d.hxx> |
25 | #include <gp_Vec2d.hxx> |
26 | #include <TColStd_SequenceOfReal.hxx> |
5d88fd54 |
27 | #include <Extrema_SequenceOfPOnCurv2d.hxx> |
42cf5bc1 |
28 | #include <math_FunctionSetWithDerivatives.hxx> |
29 | #include <Standard_Boolean.hxx> |
30 | #include <math_Vector.hxx> |
31 | class Standard_OutOfRange; |
32 | class Adaptor2d_Curve2d; |
33 | class Extrema_Curve2dTool; |
34 | class Extrema_POnCurv2d; |
35 | class gp_Pnt2d; |
36 | class gp_Vec2d; |
42cf5bc1 |
37 | class math_Matrix; |
38 | |
39 | |
40 | |
41 | class Extrema_CCLocFOfLocECC2d : public math_FunctionSetWithDerivatives |
42 | { |
43 | public: |
44 | |
45 | DEFINE_STANDARD_ALLOC |
46 | |
47 | |
48 | Standard_EXPORT Extrema_CCLocFOfLocECC2d(const Standard_Real thetol = 1.0e-10); |
49 | |
50 | Standard_EXPORT Extrema_CCLocFOfLocECC2d(const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2, const Standard_Real thetol = 1.0e-10); |
51 | |
52 | Standard_EXPORT void SetCurve (const Standard_Integer theRank, const Adaptor2d_Curve2d& C1); |
53 | |
54 | void SetTolerance (const Standard_Real theTol); |
55 | |
56 | virtual Standard_Integer NbVariables() const Standard_OVERRIDE; |
57 | |
58 | virtual Standard_Integer NbEquations() const Standard_OVERRIDE; |
59 | |
36b9ff75 |
60 | //! Calculate Fi(U,V). |
42cf5bc1 |
61 | Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& UV, math_Vector& F) Standard_OVERRIDE; |
62 | |
36b9ff75 |
63 | //! Calculate Fi'(U,V). |
79104795 |
64 | Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& UV, math_Matrix& DF) Standard_OVERRIDE; |
42cf5bc1 |
65 | |
36b9ff75 |
66 | //! Calculate Fi(U,V) and Fi'(U,V). |
79104795 |
67 | Standard_EXPORT Standard_Boolean Values (const math_Vector& UV, math_Vector& F, math_Matrix& DF) Standard_OVERRIDE; |
42cf5bc1 |
68 | |
36b9ff75 |
69 | //! Save the found extremum. |
42cf5bc1 |
70 | Standard_EXPORT virtual Standard_Integer GetStateNumber() Standard_OVERRIDE; |
71 | |
36b9ff75 |
72 | //! Return the number of found extrema. |
42cf5bc1 |
73 | Standard_Integer NbExt() const; |
74 | |
36b9ff75 |
75 | //! Return the value of the Nth distance. |
42cf5bc1 |
76 | Standard_Real SquareDistance (const Standard_Integer N) const; |
77 | |
36b9ff75 |
78 | //! Return the points of the Nth extreme distance. |
42cf5bc1 |
79 | Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv2d& P1, Extrema_POnCurv2d& P2) const; |
80 | |
36b9ff75 |
81 | //! Returns a pointer to the curve specified in the constructor |
82 | //! or in SetCurve() method. |
42cf5bc1 |
83 | Standard_Address CurvePtr (const Standard_Integer theRank) const; |
84 | |
36b9ff75 |
85 | //! Returns a tolerance specified in the constructor |
86 | //! or in SetTolerance() method. |
42cf5bc1 |
87 | Standard_Real Tolerance() const; |
88 | |
36b9ff75 |
89 | //! Determines of boundaries of subinterval for find of root. |
42cf5bc1 |
90 | Standard_EXPORT void SubIntervalInitialize (const math_Vector& theUfirst, const math_Vector& theUlast); |
91 | |
36b9ff75 |
92 | //! Computes a Tol value. If 1st derivative of curve |
93 | //! |D1|<Tol, it is considered D1=0. |
42cf5bc1 |
94 | Standard_EXPORT Standard_Real SearchOfTolerance (const Standard_Address C); |
95 | |
96 | |
97 | |
98 | |
99 | protected: |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | private: |
106 | |
107 | |
108 | |
109 | Standard_Address myC1; |
110 | Standard_Address myC2; |
111 | Standard_Real myTol; |
112 | Standard_Real myU; |
113 | Standard_Real myV; |
114 | gp_Pnt2d myP1; |
115 | gp_Pnt2d myP2; |
116 | gp_Vec2d myDu; |
117 | gp_Vec2d myDv; |
118 | TColStd_SequenceOfReal mySqDist; |
5d88fd54 |
119 | Extrema_SequenceOfPOnCurv2d myPoints; |
42cf5bc1 |
120 | Standard_Real myTolC1; |
121 | Standard_Real myTolC2; |
122 | Standard_Integer myMaxDerivOrderC1; |
123 | Standard_Integer myMaxDerivOrderC2; |
124 | Standard_Real myUinfium; |
125 | Standard_Real myUsupremum; |
126 | Standard_Real myVinfium; |
127 | Standard_Real myVsupremum; |
128 | |
129 | |
130 | }; |
131 | |
132 | #define Curve1 Adaptor2d_Curve2d |
133 | #define Curve1_hxx <Adaptor2d_Curve2d.hxx> |
134 | #define Tool1 Extrema_Curve2dTool |
135 | #define Tool1_hxx <Extrema_Curve2dTool.hxx> |
136 | #define Curve2 Adaptor2d_Curve2d |
137 | #define Curve2_hxx <Adaptor2d_Curve2d.hxx> |
138 | #define Tool2 Extrema_Curve2dTool |
139 | #define Tool2_hxx <Extrema_Curve2dTool.hxx> |
140 | #define POnC Extrema_POnCurv2d |
141 | #define POnC_hxx <Extrema_POnCurv2d.hxx> |
142 | #define Pnt gp_Pnt2d |
143 | #define Pnt_hxx <gp_Pnt2d.hxx> |
144 | #define Vec gp_Vec2d |
145 | #define Vec_hxx <gp_Vec2d.hxx> |
5d88fd54 |
146 | #define Extrema_SeqPOnC Extrema_SequenceOfPOnCurv2d |
147 | #define Extrema_SeqPOnC_hxx <Extrema_SequenceOfPOnCurv2d.hxx> |
42cf5bc1 |
148 | #define Extrema_FuncExtCC Extrema_CCLocFOfLocECC2d |
149 | #define Extrema_FuncExtCC_hxx <Extrema_CCLocFOfLocECC2d.hxx> |
150 | |
151 | #include <Extrema_FuncExtCC.lxx> |
152 | |
153 | #undef Curve1 |
154 | #undef Curve1_hxx |
155 | #undef Tool1 |
156 | #undef Tool1_hxx |
157 | #undef Curve2 |
158 | #undef Curve2_hxx |
159 | #undef Tool2 |
160 | #undef Tool2_hxx |
161 | #undef POnC |
162 | #undef POnC_hxx |
163 | #undef Pnt |
164 | #undef Pnt_hxx |
165 | #undef Vec |
166 | #undef Vec_hxx |
167 | #undef Extrema_SeqPOnC |
168 | #undef Extrema_SeqPOnC_hxx |
42cf5bc1 |
169 | #undef Extrema_FuncExtCC |
170 | #undef Extrema_FuncExtCC_hxx |
171 | |
172 | |
173 | |
174 | |
175 | #endif // _Extrema_CCLocFOfLocECC2d_HeaderFile |