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