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_CCLocFOfLocECC_HeaderFile |
18 | #define _Extrema_CCLocFOfLocECC_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Address.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <gp_Pnt.hxx> |
27 | #include <gp_Vec.hxx> |
28 | #include <TColStd_SequenceOfReal.hxx> |
5d88fd54 |
29 | #include <Extrema_SequenceOfPOnCurv.hxx> |
42cf5bc1 |
30 | #include <Standard_Integer.hxx> |
31 | #include <math_FunctionSetWithDerivatives.hxx> |
32 | #include <Standard_Boolean.hxx> |
33 | #include <math_Vector.hxx> |
34 | class Standard_OutOfRange; |
35 | class Adaptor3d_Curve; |
36 | class Extrema_CurveTool; |
37 | class Extrema_POnCurv; |
38 | class gp_Pnt; |
39 | class gp_Vec; |
42cf5bc1 |
40 | class math_Matrix; |
41 | |
42 | |
43 | |
44 | class Extrema_CCLocFOfLocECC : public math_FunctionSetWithDerivatives |
45 | { |
46 | public: |
47 | |
48 | DEFINE_STANDARD_ALLOC |
49 | |
50 | |
51 | Standard_EXPORT Extrema_CCLocFOfLocECC(const Standard_Real thetol = 1.0e-10); |
52 | |
53 | Standard_EXPORT Extrema_CCLocFOfLocECC(const Adaptor3d_Curve& C1, const Adaptor3d_Curve& C2, const Standard_Real thetol = 1.0e-10); |
54 | |
55 | Standard_EXPORT void SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C1); |
56 | |
57 | void SetTolerance (const Standard_Real theTol); |
58 | |
59 | virtual Standard_Integer NbVariables() const Standard_OVERRIDE; |
60 | |
61 | virtual Standard_Integer NbEquations() const Standard_OVERRIDE; |
62 | |
36b9ff75 |
63 | //! Calculate Fi(U,V). |
42cf5bc1 |
64 | Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& UV, math_Vector& F) Standard_OVERRIDE; |
65 | |
36b9ff75 |
66 | //! Calculate Fi'(U,V). |
79104795 |
67 | Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& UV, math_Matrix& DF) Standard_OVERRIDE; |
42cf5bc1 |
68 | |
36b9ff75 |
69 | //! Calculate Fi(U,V) and Fi'(U,V). |
79104795 |
70 | Standard_EXPORT Standard_Boolean Values (const math_Vector& UV, math_Vector& F, math_Matrix& DF) Standard_OVERRIDE; |
42cf5bc1 |
71 | |
36b9ff75 |
72 | //! Save the found extremum. |
42cf5bc1 |
73 | Standard_EXPORT virtual Standard_Integer GetStateNumber() Standard_OVERRIDE; |
74 | |
36b9ff75 |
75 | //! Return the number of found extrema. |
42cf5bc1 |
76 | Standard_Integer NbExt() const; |
77 | |
36b9ff75 |
78 | //! Return the value of the Nth distance. |
42cf5bc1 |
79 | Standard_Real SquareDistance (const Standard_Integer N) const; |
80 | |
36b9ff75 |
81 | //! Return the points of the Nth extreme distance. |
42cf5bc1 |
82 | Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv& P1, Extrema_POnCurv& P2) const; |
83 | |
36b9ff75 |
84 | //! Returns a pointer to the curve specified in the constructor |
85 | //! or in SetCurve() method. |
42cf5bc1 |
86 | Standard_Address CurvePtr (const Standard_Integer theRank) const; |
87 | |
36b9ff75 |
88 | //! Returns a tolerance specified in the constructor |
89 | //! or in SetTolerance() method. |
42cf5bc1 |
90 | Standard_Real Tolerance() const; |
91 | |
36b9ff75 |
92 | //! Determines of boundaries of subinterval for find of root. |
42cf5bc1 |
93 | Standard_EXPORT void SubIntervalInitialize (const math_Vector& theUfirst, const math_Vector& theUlast); |
94 | |
36b9ff75 |
95 | //! Computes a Tol value. If 1st derivative of curve |
96 | //! |D1|<Tol, it is considered D1=0. |
42cf5bc1 |
97 | Standard_EXPORT Standard_Real SearchOfTolerance (const Standard_Address C); |
98 | |
99 | |
100 | |
101 | |
102 | protected: |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | private: |
109 | |
110 | |
111 | |
112 | Standard_Address myC1; |
113 | Standard_Address myC2; |
114 | Standard_Real myTol; |
115 | Standard_Real myU; |
116 | Standard_Real myV; |
117 | gp_Pnt myP1; |
118 | gp_Pnt myP2; |
119 | gp_Vec myDu; |
120 | gp_Vec myDv; |
121 | TColStd_SequenceOfReal mySqDist; |
5d88fd54 |
122 | Extrema_SequenceOfPOnCurv myPoints; |
42cf5bc1 |
123 | Standard_Real myTolC1; |
124 | Standard_Real myTolC2; |
125 | Standard_Integer myMaxDerivOrderC1; |
126 | Standard_Integer myMaxDerivOrderC2; |
127 | Standard_Real myUinfium; |
128 | Standard_Real myUsupremum; |
129 | Standard_Real myVinfium; |
130 | Standard_Real myVsupremum; |
131 | |
132 | |
133 | }; |
134 | |
135 | #define Curve1 Adaptor3d_Curve |
136 | #define Curve1_hxx <Adaptor3d_Curve.hxx> |
137 | #define Tool1 Extrema_CurveTool |
138 | #define Tool1_hxx <Extrema_CurveTool.hxx> |
139 | #define Curve2 Adaptor3d_Curve |
140 | #define Curve2_hxx <Adaptor3d_Curve.hxx> |
141 | #define Tool2 Extrema_CurveTool |
142 | #define Tool2_hxx <Extrema_CurveTool.hxx> |
143 | #define POnC Extrema_POnCurv |
144 | #define POnC_hxx <Extrema_POnCurv.hxx> |
145 | #define Pnt gp_Pnt |
146 | #define Pnt_hxx <gp_Pnt.hxx> |
147 | #define Vec gp_Vec |
148 | #define Vec_hxx <gp_Vec.hxx> |
5d88fd54 |
149 | #define Extrema_SeqPOnC Extrema_SequenceOfPOnCurv |
150 | #define Extrema_SeqPOnC_hxx <Extrema_SequenceOfPOnCurv.hxx> |
42cf5bc1 |
151 | #define Extrema_FuncExtCC Extrema_CCLocFOfLocECC |
152 | #define Extrema_FuncExtCC_hxx <Extrema_CCLocFOfLocECC.hxx> |
153 | |
154 | #include <Extrema_FuncExtCC.lxx> |
155 | |
156 | #undef Curve1 |
157 | #undef Curve1_hxx |
158 | #undef Tool1 |
159 | #undef Tool1_hxx |
160 | #undef Curve2 |
161 | #undef Curve2_hxx |
162 | #undef Tool2 |
163 | #undef Tool2_hxx |
164 | #undef POnC |
165 | #undef POnC_hxx |
166 | #undef Pnt |
167 | #undef Pnt_hxx |
168 | #undef Vec |
169 | #undef Vec_hxx |
170 | #undef Extrema_SeqPOnC |
171 | #undef Extrema_SeqPOnC_hxx |
42cf5bc1 |
172 | #undef Extrema_FuncExtCC |
173 | #undef Extrema_FuncExtCC_hxx |
174 | |
175 | |
176 | |
177 | |
178 | #endif // _Extrema_CCLocFOfLocECC_HeaderFile |