ea3c8bc91a6f35ab456d37b394be146816825388
[occt.git] / src / Extrema / Extrema_EPCOfELPCOfLocateExtPC2d.hxx
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_EPCOfELPCOfLocateExtPC2d_HeaderFile
18 #define _Extrema_EPCOfELPCOfLocateExtPC2d_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <Extrema_PCFOfEPCOfELPCOfLocateExtPC2d.hxx>
28 class StdFail_NotDone;
29 class Standard_OutOfRange;
30 class Standard_TypeMismatch;
31 class Adaptor2d_Curve2d;
32 class Extrema_Curve2dTool;
33 class Extrema_POnCurv2d;
34 class gp_Pnt2d;
35 class gp_Vec2d;
36 class Extrema_PCFOfEPCOfELPCOfLocateExtPC2d;
37 class Extrema_SeqPCOfPCFOfEPCOfELPCOfLocateExtPC2d;
38
39
40
41 class Extrema_EPCOfELPCOfLocateExtPC2d 
42 {
43 public:
44
45   DEFINE_STANDARD_ALLOC
46
47   
48   Standard_EXPORT Extrema_EPCOfELPCOfLocateExtPC2d();
49   
50   //! It calculates all the distances.
51   //! The function F(u)=distance(P,C(u)) has an extremum
52   //! when g(u)=dF/du=0. The algorithm searchs all the
53   //! zeros inside the definition range of the curve.
54   //! NbU is used to locate the close points to
55   //! find the zeros.
56   //! Tol and TolU are used to decide to stop the
57   //! iterations according to the following condition:
58   //! if n is the number of iterations,
59   //! abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
60   Standard_EXPORT Extrema_EPCOfELPCOfLocateExtPC2d(const gp_Pnt2d& P, const Adaptor2d_Curve2d& C, const Standard_Integer NbU, const Standard_Real TolU, const Standard_Real TolF);
61   
62   //! It calculates all the distances.
63   //! The function F(u)=distance(P,C(u)) has an extremum
64   //! when g(u)=dF/du=0. The algorithm searchs all the
65   //! zeros inside the definition range of the curve.
66   //! NbU is used to locate the close points to
67   //! find the zeros.
68   //! Zeros are searched between umin and usup.
69   //! Tol and TolU are used to decide to stop the
70   //! iterations according to the following condition:
71   //! if n is the number of iterations,
72   //! abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
73   Standard_EXPORT Extrema_EPCOfELPCOfLocateExtPC2d(const gp_Pnt2d& P, const Adaptor2d_Curve2d& C, const Standard_Integer NbU, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolU, const Standard_Real TolF);
74   
75   //! sets the fields of the algorithm.
76   Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Integer NbU, const Standard_Real TolU, const Standard_Real TolF);
77   
78   //! sets the fields of the algorithm.
79   Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Integer NbU, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolU, const Standard_Real TolF);
80   
81   //! sets the fields of the algorithm.
82   Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C);
83   
84   //! sets the fields of the algorithm.
85   Standard_EXPORT void Initialize (const Standard_Integer NbU, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolU, const Standard_Real TolF);
86   
87   //! the algorithm is done with the point P.
88   //! An exception is raised if the fields have not
89   //! been initialized.
90   Standard_EXPORT void Perform (const gp_Pnt2d& P);
91   
92   //! True if the distances are found.
93   Standard_EXPORT Standard_Boolean IsDone() const;
94   
95   //! Returns the number of extremum distances.
96   Standard_EXPORT Standard_Integer NbExt() const;
97   
98   //! Returns the value of the Nth extremum square distance.
99   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
100   
101   //! Returns True if the Nth extremum distance is a
102   //! minimum.
103   Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
104   
105   //! Returns the point of the Nth extremum distance.
106   Standard_EXPORT const Extrema_POnCurv2d& Point (const Standard_Integer N) const;
107
108
109
110
111 protected:
112
113
114
115
116
117 private:
118
119
120
121   Standard_Boolean myDone;
122   Standard_Boolean myInit;
123   Standard_Integer mynbsample;
124   Standard_Real myumin;
125   Standard_Real myusup;
126   Standard_Real mytolu;
127   Standard_Real mytolF;
128   Extrema_PCFOfEPCOfELPCOfLocateExtPC2d myF;
129
130
131 };
132
133
134
135
136
137
138
139 #endif // _Extrema_EPCOfELPCOfLocateExtPC2d_HeaderFile