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_EPCOfExtPC_HeaderFile
18 #define _Extrema_EPCOfExtPC_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <Extrema_PCFOfEPCOfExtPC.hxx>
28 class StdFail_NotDone;
29 class Standard_OutOfRange;
30 class Standard_TypeMismatch;
31 class Adaptor3d_Curve;
32 class Extrema_CurveTool;
33 class Extrema_POnCurv;
36 class Extrema_PCFOfEPCOfExtPC;
38 class Extrema_EPCOfExtPC
45 Standard_EXPORT Extrema_EPCOfExtPC();
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
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.
57 Standard_EXPORT Extrema_EPCOfExtPC(const gp_Pnt& P, const Adaptor3d_Curve& C, const Standard_Integer NbU, const Standard_Real TolU, const Standard_Real TolF);
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
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.
70 Standard_EXPORT Extrema_EPCOfExtPC(const gp_Pnt& P, const Adaptor3d_Curve& C, const Standard_Integer NbU, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolU, const Standard_Real TolF);
72 //! sets the fields of the algorithm.
73 Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Integer NbU, const Standard_Real TolU, const Standard_Real TolF);
75 //! sets the fields of the algorithm.
76 Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Integer NbU, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real TolU, const Standard_Real TolF);
78 //! sets the fields of the algorithm.
79 Standard_EXPORT void Initialize (const Adaptor3d_Curve& C);
81 //! sets the fields of the algorithm.
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);
84 //! the algorithm is done with the point P.
85 //! An exception is raised if the fields have not
87 Standard_EXPORT void Perform (const gp_Pnt& P);
89 //! True if the distances are found.
90 Standard_EXPORT Standard_Boolean IsDone() const;
92 //! Returns the number of extremum distances.
93 Standard_EXPORT Standard_Integer NbExt() const;
95 //! Returns the value of the Nth extremum square distance.
96 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
98 //! Returns True if the Nth extremum distance is a
100 Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
102 //! Returns the point of the Nth extremum distance.
103 Standard_EXPORT const Extrema_POnCurv& Point (const Standard_Integer N) const;
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_PCFOfEPCOfExtPC myF;
136 #endif // _Extrema_EPCOfExtPC_HeaderFile