0032806: Coding - get rid of unused headers [Contap to Extrema]
[occt.git] / src / Extrema / Extrema_ExtPC.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_ExtPC_HeaderFile
18 #define _Extrema_ExtPC_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22
23 #include <gp_Pnt.hxx>
24 #include <Extrema_ExtPElC.hxx>
25 #include <Extrema_EPCOfExtPC.hxx>
26 #include <Standard_Integer.hxx>
27 #include <GeomAbs_CurveType.hxx>
28 #include <TColStd_SequenceOfBoolean.hxx>
29 #include <TColStd_SequenceOfReal.hxx>
30 class StdFail_NotDone;
31 class Standard_OutOfRange;
32 class Standard_TypeMismatch;
33 class Adaptor3d_Curve;
34 class Extrema_CurveTool;
35 class Extrema_ExtPElC;
36 class gp_Pnt;
37 class gp_Vec;
38 class Extrema_POnCurv;
39 class Extrema_EPCOfExtPC;
40 class Extrema_PCFOfEPCOfExtPC;
41
42
43
44 class Extrema_ExtPC 
45 {
46 public:
47
48   DEFINE_STANDARD_ALLOC
49
50   
51   Standard_EXPORT Extrema_ExtPC();
52   
53   //! It calculates all the distances.
54   //! The function F(u)=distance(P,C(u)) has an extremum
55   //! when g(u)=dF/du=0. The algorithm searches all the
56   //! zeros inside the definition range of the curve.
57   //! Zeros are searched between uinf and usup.
58   //! Tol  is used to decide to stop the
59   //! iterations according to the following condition:
60   //! if n is the number of iterations,
61   //! the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
62   Standard_EXPORT Extrema_ExtPC(const gp_Pnt& P, const Adaptor3d_Curve& C, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real TolF = 1.0e-10);
63   
64   //! It calculates all the distances.
65   //! The function F(u)=distance(P,C(u)) has an extremum
66   //! when g(u)=dF/du=0. The algorithm searches all the
67   //! zeros inside the definition range of the curve.
68   //! Tol is used to decide to stop the
69   //! iterations according to the following condition:
70   //! if n is the number of iterations,
71   //! the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
72   Standard_EXPORT Extrema_ExtPC(const gp_Pnt& P, const Adaptor3d_Curve& C, const Standard_Real TolF = 1.0e-10);
73   
74   //! initializes the fields of the algorithm.
75   Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real TolF = 1.0e-10);
76   
77   //! An exception is raised if the fields have not been
78   //! initialized.
79   Standard_EXPORT void Perform (const gp_Pnt& P);
80   
81   //! True if the distances are found.
82   Standard_EXPORT Standard_Boolean IsDone() const;
83   
84   //! Returns the value of the <N>th extremum square distance.
85   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
86   
87   //! Returns the number of extremum distances.
88   Standard_EXPORT Standard_Integer NbExt() const;
89   
90   //! Returns True if the <N>th extremum distance is a
91   //! minimum.
92   Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
93   
94   //! Returns the point of the <N>th extremum distance.
95   Standard_EXPORT const Extrema_POnCurv& Point (const Standard_Integer N) const;
96   
97   //! if the curve is a trimmed curve,
98   //! dist1 is a square distance between <P> and the point
99   //! of parameter FirstParameter <P1> and
100   //! dist2 is a square distance between <P> and the point
101   //! of parameter LastParameter <P2>.
102   Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dist1, Standard_Real& dist2, gp_Pnt& P1, gp_Pnt& P2) const;
103
104
105
106
107 protected:
108
109   
110   Standard_EXPORT void IntervalPerform (const gp_Pnt& P);
111
112   Standard_EXPORT void AddSol(const Standard_Real theU, 
113                               const gp_Pnt& theP,
114                               const Standard_Real theSqDist, 
115                               const Standard_Boolean isMin);
116
117
118
119 private:
120
121
122
123   Standard_Address myC;
124   gp_Pnt Pf;
125   gp_Pnt Pl;
126   Extrema_ExtPElC myExtPElC;
127   Extrema_SequenceOfPOnCurv mypoint;
128   Standard_Boolean mydone;
129   Standard_Real mydist1;
130   Standard_Real mydist2;
131   Extrema_EPCOfExtPC myExtPC;
132   Standard_Real mytolu;
133   Standard_Real mytolf;
134   Standard_Integer mysample;
135   Standard_Real myintuinf;
136   Standard_Real myintusup;
137   Standard_Real myuinf;
138   Standard_Real myusup;
139   GeomAbs_CurveType type;
140   TColStd_SequenceOfBoolean myismin;
141   TColStd_SequenceOfReal mySqDist;
142
143
144 };
145
146
147
148
149
150
151
152 #endif // _Extrema_ExtPC_HeaderFile