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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Extrema_CCLocFOfLocECC2d_HeaderFile
18 #define _Extrema_CCLocFOfLocECC2d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Address.hxx>
25 #include <Standard_Real.hxx>
26 #include <gp_Pnt2d.hxx>
27 #include <gp_Vec2d.hxx>
28 #include <TColStd_SequenceOfReal.hxx>
29 #include <Extrema_SeqPOnCOfCCLocFOfLocECC2d.hxx>
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 Adaptor2d_Curve2d;
36 class Extrema_Curve2dTool;
37 class Extrema_POnCurv2d;
40 class Extrema_SeqPOnCOfCCLocFOfLocECC2d;
41 class Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d;
46 class Extrema_CCLocFOfLocECC2d : public math_FunctionSetWithDerivatives
53 Standard_EXPORT Extrema_CCLocFOfLocECC2d(const Standard_Real thetol = 1.0e-10);
55 Standard_EXPORT Extrema_CCLocFOfLocECC2d(const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2, const Standard_Real thetol = 1.0e-10);
57 Standard_EXPORT void SetCurve (const Standard_Integer theRank, const Adaptor2d_Curve2d& C1);
59 void SetTolerance (const Standard_Real theTol);
61 virtual Standard_Integer NbVariables() const Standard_OVERRIDE;
63 virtual Standard_Integer NbEquations() const Standard_OVERRIDE;
65 //! Calculate Fi(U,V).
66 Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& UV, math_Vector& F) Standard_OVERRIDE;
68 //! Calculate Fi'(U,V).
69 Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& UV, math_Matrix& DF);
71 //! Calculate Fi(U,V) and Fi'(U,V).
72 Standard_EXPORT Standard_Boolean Values (const math_Vector& UV, math_Vector& F, math_Matrix& DF);
74 //! Save the found extremum.
75 Standard_EXPORT virtual Standard_Integer GetStateNumber() Standard_OVERRIDE;
77 //! Return the number of found extrema.
78 Standard_Integer NbExt() const;
80 //! Return the value of the Nth distance.
81 Standard_Real SquareDistance (const Standard_Integer N) const;
83 //! Return the points of the Nth extreme distance.
84 Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv2d& P1, Extrema_POnCurv2d& P2) const;
86 //! Returns a pointer to the curve specified in the constructor
87 //! or in SetCurve() method.
88 Standard_Address CurvePtr (const Standard_Integer theRank) const;
90 //! Returns a tolerance specified in the constructor
91 //! or in SetTolerance() method.
92 Standard_Real Tolerance() const;
94 //! Determines of boundaries of subinterval for find of root.
95 Standard_EXPORT void SubIntervalInitialize (const math_Vector& theUfirst, const math_Vector& theUlast);
97 //! Computes a Tol value. If 1st derivative of curve
98 //! |D1|<Tol, it is considered D1=0.
99 Standard_EXPORT Standard_Real SearchOfTolerance (const Standard_Address C);
114 Standard_Address myC1;
115 Standard_Address myC2;
123 TColStd_SequenceOfReal mySqDist;
124 Extrema_SeqPOnCOfCCLocFOfLocECC2d myPoints;
125 Standard_Real myTolC1;
126 Standard_Real myTolC2;
127 Standard_Integer myMaxDerivOrderC1;
128 Standard_Integer myMaxDerivOrderC2;
129 Standard_Real myUinfium;
130 Standard_Real myUsupremum;
131 Standard_Real myVinfium;
132 Standard_Real myVsupremum;
137 #define Curve1 Adaptor2d_Curve2d
138 #define Curve1_hxx <Adaptor2d_Curve2d.hxx>
139 #define Tool1 Extrema_Curve2dTool
140 #define Tool1_hxx <Extrema_Curve2dTool.hxx>
141 #define Curve2 Adaptor2d_Curve2d
142 #define Curve2_hxx <Adaptor2d_Curve2d.hxx>
143 #define Tool2 Extrema_Curve2dTool
144 #define Tool2_hxx <Extrema_Curve2dTool.hxx>
145 #define POnC Extrema_POnCurv2d
146 #define POnC_hxx <Extrema_POnCurv2d.hxx>
148 #define Pnt_hxx <gp_Pnt2d.hxx>
150 #define Vec_hxx <gp_Vec2d.hxx>
151 #define Extrema_SeqPOnC Extrema_SeqPOnCOfCCLocFOfLocECC2d
152 #define Extrema_SeqPOnC_hxx <Extrema_SeqPOnCOfCCLocFOfLocECC2d.hxx>
153 #define Extrema_SequenceNodeOfSeqPOnC Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d
154 #define Extrema_SequenceNodeOfSeqPOnC_hxx <Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d.hxx>
155 #define Extrema_SequenceNodeOfSeqPOnC Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d
156 #define Extrema_SequenceNodeOfSeqPOnC_hxx <Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d.hxx>
157 #define Handle_Extrema_SequenceNodeOfSeqPOnC Handle(Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d)
158 #define Handle_Extrema_SequenceNodeOfSeqPOnC Handle(Extrema_SequenceNodeOfSeqPOnCOfCCLocFOfLocECC2d)
159 #define Extrema_FuncExtCC Extrema_CCLocFOfLocECC2d
160 #define Extrema_FuncExtCC_hxx <Extrema_CCLocFOfLocECC2d.hxx>
162 #include <Extrema_FuncExtCC.lxx>
178 #undef Extrema_SeqPOnC
179 #undef Extrema_SeqPOnC_hxx
180 #undef Extrema_SequenceNodeOfSeqPOnC
181 #undef Extrema_SequenceNodeOfSeqPOnC_hxx
182 #undef Extrema_SequenceNodeOfSeqPOnC
183 #undef Extrema_SequenceNodeOfSeqPOnC_hxx
184 #undef Handle_Extrema_SequenceNodeOfSeqPOnC
185 #undef Handle_Extrema_SequenceNodeOfSeqPOnC
186 #undef Extrema_FuncExtCC
187 #undef Extrema_FuncExtCC_hxx
192 #endif // _Extrema_CCLocFOfLocECC2d_HeaderFile