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_LocateExtPC_HeaderFile |
18 | #define _Extrema_LocateExtPC_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Extrema_POnCurv.hxx> |
25 | #include <Standard_Address.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <Extrema_LocEPCOfLocateExtPC.hxx> |
29 | #include <Extrema_ELPCOfLocateExtPC.hxx> |
30 | #include <GeomAbs_CurveType.hxx> |
31 | #include <Standard_Integer.hxx> |
32 | #include <Extrema_SequenceOfPOnCurv.hxx> |
33 | class Standard_DomainError; |
34 | class StdFail_NotDone; |
35 | class Adaptor3d_Curve; |
36 | class Extrema_CurveTool; |
37 | class Extrema_ExtPElC; |
38 | class gp_Pnt; |
39 | class gp_Vec; |
40 | class Extrema_POnCurv; |
41 | class Extrema_ELPCOfLocateExtPC; |
42 | class Extrema_EPCOfELPCOfLocateExtPC; |
43 | class Extrema_LocEPCOfLocateExtPC; |
44 | class Extrema_PCLocFOfLocEPCOfLocateExtPC; |
45 | |
46 | |
47 | |
48 | class Extrema_LocateExtPC |
49 | { |
50 | public: |
51 | |
52 | DEFINE_STANDARD_ALLOC |
53 | |
54 | |
55 | Standard_EXPORT Extrema_LocateExtPC(); |
56 | |
36b9ff75 |
57 | //! Calculates the distance with a close point. |
58 | //! The close point is defined by the parameter value |
59 | //! U0. |
60 | //! The function F(u)=distance(P,C(u)) has an extremum |
61 | //! when g(u)=dF/du=0. The algorithm searchs a zero |
62 | //! near the close point. |
63 | //! TolF is used to decide to stop the iterations. |
64 | //! At the nth iteration, the criteria is: |
65 | //! abs(Un - Un-1) < TolF. |
42cf5bc1 |
66 | Standard_EXPORT Extrema_LocateExtPC(const gp_Pnt& P, const Adaptor3d_Curve& C, const Standard_Real U0, const Standard_Real TolF); |
67 | |
36b9ff75 |
68 | //! Calculates the distance with a close point. |
69 | //! The close point is defined by the parameter value |
70 | //! U0. |
71 | //! The function F(u)=distance(P,C(u)) has an extremum |
72 | //! when g(u)=dF/du=0. The algorithm searchs a zero |
73 | //! near the close point. |
74 | //! Zeros are searched between Umin et Usup. |
75 | //! TolF is used to decide to stop the iterations. |
76 | //! At the nth iteration, the criteria is: |
77 | //! abs(Un - Un-1) < TolF. |
42cf5bc1 |
78 | Standard_EXPORT Extrema_LocateExtPC(const gp_Pnt& P, const Adaptor3d_Curve& C, const Standard_Real U0, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolF); |
79 | |
36b9ff75 |
80 | //! sets the fields of the algorithm. |
42cf5bc1 |
81 | Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolF); |
82 | |
83 | Standard_EXPORT void Perform (const gp_Pnt& P, const Standard_Real U0); |
84 | |
36b9ff75 |
85 | //! Returns True if the distance is found. |
42cf5bc1 |
86 | Standard_EXPORT Standard_Boolean IsDone() const; |
87 | |
36b9ff75 |
88 | //! Returns the value of the extremum square distance. |
42cf5bc1 |
89 | Standard_EXPORT Standard_Real SquareDistance() const; |
90 | |
36b9ff75 |
91 | //! Returns True if the extremum distance is a minimum. |
42cf5bc1 |
92 | Standard_EXPORT Standard_Boolean IsMin() const; |
93 | |
36b9ff75 |
94 | //! Returns the point of the extremum distance. |
42cf5bc1 |
95 | Standard_EXPORT const Extrema_POnCurv& Point() const; |
96 | |
97 | |
98 | |
99 | |
100 | protected: |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | private: |
107 | |
108 | |
109 | |
110 | Extrema_POnCurv mypp; |
111 | Standard_Address myC; |
112 | Standard_Real mydist2; |
113 | Standard_Boolean myismin; |
114 | Standard_Boolean myDone; |
115 | Standard_Real myumin; |
116 | Standard_Real myusup; |
117 | Standard_Real mytol; |
118 | Extrema_LocEPCOfLocateExtPC myLocExtPC; |
119 | Extrema_ELPCOfLocateExtPC myExtremPC; |
120 | GeomAbs_CurveType type; |
121 | Standard_Integer numberext; |
122 | |
123 | |
124 | }; |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | #endif // _Extrema_LocateExtPC_HeaderFile |