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_ELPCOfLocateExtPC2d_HeaderFile
18 #define _Extrema_ELPCOfLocateExtPC2d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Address.hxx>
25 #include <gp_Pnt2d.hxx>
26 #include <Extrema_ExtPElC2d.hxx>
27 #include <Extrema_SequenceOfPOnCurv2d.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Standard_Real.hxx>
30 #include <Extrema_EPCOfELPCOfLocateExtPC2d.hxx>
31 #include <Standard_Integer.hxx>
32 #include <GeomAbs_CurveType.hxx>
33 #include <TColStd_SequenceOfBoolean.hxx>
34 #include <TColStd_SequenceOfReal.hxx>
35 class StdFail_NotDone;
36 class Standard_OutOfRange;
37 class Standard_TypeMismatch;
38 class Adaptor2d_Curve2d;
39 class Extrema_Curve2dTool;
40 class Extrema_ExtPElC2d;
43 class Extrema_POnCurv2d;
44 class Extrema_EPCOfELPCOfLocateExtPC2d;
45 class Extrema_PCFOfEPCOfELPCOfLocateExtPC2d;
49 class Extrema_ELPCOfLocateExtPC2d
56 Standard_EXPORT Extrema_ELPCOfLocateExtPC2d();
58 //! It calculates all the distances.
59 //! The function F(u)=distance(P,C(u)) has an extremum
60 //! when g(u)=dF/du=0. The algorithm searchs all the
61 //! zeros inside the definition range of the curve.
62 //! Zeros are searched between uinf and usup.
63 //! Tol is used to decide to stop the
64 //! iterations according to the following condition:
65 //! if n is the number of iterations,
66 //! the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
67 Standard_EXPORT Extrema_ELPCOfLocateExtPC2d(const gp_Pnt2d& P, const Adaptor2d_Curve2d& C, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real TolF = 1.0e-10);
69 //! It calculates all the distances.
70 //! The function F(u)=distance(P,C(u)) has an extremum
71 //! when g(u)=dF/du=0. The algorithm searchs all the
72 //! zeros inside the definition range of the curve.
73 //! Tol is used to decide to stop the
74 //! iterations according to the following condition:
75 //! if n is the number of iterations,
76 //! the algorithm stops when abs(F(Un)-F(Un-1)) < Tol.
77 Standard_EXPORT Extrema_ELPCOfLocateExtPC2d(const gp_Pnt2d& P, const Adaptor2d_Curve2d& C, const Standard_Real TolF = 1.0e-10);
79 //! initializes the fields of the algorithm.
80 Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real TolF = 1.0e-10);
82 //! An exception is raised if the fields have not been
84 Standard_EXPORT void Perform (const gp_Pnt2d& P);
86 //! True if the distances are found.
87 Standard_EXPORT Standard_Boolean IsDone() const;
89 //! Returns the value of the <N>th extremum square distance.
90 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
92 //! Returns the number of extremum distances.
93 Standard_EXPORT Standard_Integer NbExt() const;
95 //! Returns True if the <N>th extremum distance is a
97 Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
99 //! Returns the point of the <N>th extremum distance.
100 Standard_EXPORT const Extrema_POnCurv2d& Point (const Standard_Integer N) const;
102 //! if the curve is a trimmed curve,
103 //! dist1 is a square distance between <P> and the point
104 //! of parameter FirstParameter <P1> and
105 //! dist2 is a square distance between <P> and the point
106 //! of parameter LastParameter <P2>.
107 Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dist1, Standard_Real& dist2, gp_Pnt2d& P1, gp_Pnt2d& P2) const;
115 Standard_EXPORT void IntervalPerform (const gp_Pnt2d& P);
117 Standard_EXPORT void AddSol(const Standard_Real theU,
118 const gp_Pnt2d& theP,
119 const Standard_Real theSqDist,
120 const Standard_Boolean isMin);
128 Standard_Address myC;
131 Extrema_ExtPElC2d myExtPElC;
132 Extrema_SequenceOfPOnCurv2d mypoint;
133 Standard_Boolean mydone;
134 Standard_Real mydist1;
135 Standard_Real mydist2;
136 Extrema_EPCOfELPCOfLocateExtPC2d myExtPC;
137 Standard_Real mytolu;
138 Standard_Real mytolf;
139 Standard_Integer mysample;
140 Standard_Real myintuinf;
141 Standard_Real myintusup;
142 Standard_Real myuinf;
143 Standard_Real myusup;
144 GeomAbs_CurveType type;
145 TColStd_SequenceOfBoolean myismin;
146 TColStd_SequenceOfReal mySqDist;
157 #endif // _Extrema_ELPCOfLocateExtPC2d_HeaderFile