Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-04 08:45:14

0001 // Created on: 1991-02-26
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Extrema_EPCOfExtPC_HeaderFile
0018 #define _Extrema_EPCOfExtPC_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <Extrema_PCFOfEPCOfExtPC.hxx>
0025 class StdFail_NotDone;
0026 class Standard_OutOfRange;
0027 class Standard_TypeMismatch;
0028 class Adaptor3d_Curve;
0029 class Extrema_CurveTool;
0030 class Extrema_POnCurv;
0031 class gp_Pnt;
0032 class gp_Vec;
0033 class Extrema_PCFOfEPCOfExtPC;
0034 
0035 class Extrema_EPCOfExtPC
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   Standard_EXPORT Extrema_EPCOfExtPC();
0041 
0042   //! It calculates all the distances.
0043   //! The function F(u)=distance(P,C(u)) has an extremum
0044   //! when g(u)=dF/du=0. The algorithm searches all the
0045   //! zeros inside the definition range of the curve.
0046   //! NbU is used to locate the close points to
0047   //! find the zeros.
0048   //! Tol and TolU are used to decide to stop the
0049   //! iterations according to the following condition:
0050   //! if n is the number of iterations,
0051   //! abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
0052   Standard_EXPORT Extrema_EPCOfExtPC(const gp_Pnt&          P,
0053                                      const Adaptor3d_Curve& C,
0054                                      const Standard_Integer NbU,
0055                                      const Standard_Real    TolU,
0056                                      const Standard_Real    TolF);
0057 
0058   //! It calculates all the distances.
0059   //! The function F(u)=distance(P,C(u)) has an extremum
0060   //! when g(u)=dF/du=0. The algorithm searches all the
0061   //! zeros inside the definition range of the curve.
0062   //! NbU is used to locate the close points to
0063   //! find the zeros.
0064   //! Zeros are searched between umin and usup.
0065   //! Tol and TolU are used to decide to stop the
0066   //! iterations according to the following condition:
0067   //! if n is the number of iterations,
0068   //! abs(Un-Un-1) < TolU and abs(F(Un)-F(Un-1)) < Tol.
0069   Standard_EXPORT Extrema_EPCOfExtPC(const gp_Pnt&          P,
0070                                      const Adaptor3d_Curve& C,
0071                                      const Standard_Integer NbU,
0072                                      const Standard_Real    Umin,
0073                                      const Standard_Real    Usup,
0074                                      const Standard_Real    TolU,
0075                                      const Standard_Real    TolF);
0076 
0077   //! sets the fields of the algorithm.
0078   Standard_EXPORT void Initialize(const Adaptor3d_Curve& C,
0079                                   const Standard_Integer NbU,
0080                                   const Standard_Real    TolU,
0081                                   const Standard_Real    TolF);
0082 
0083   //! sets the fields of the algorithm.
0084   Standard_EXPORT void Initialize(const Adaptor3d_Curve& C,
0085                                   const Standard_Integer NbU,
0086                                   const Standard_Real    Umin,
0087                                   const Standard_Real    Usup,
0088                                   const Standard_Real    TolU,
0089                                   const Standard_Real    TolF);
0090 
0091   //! sets the fields of the algorithm.
0092   Standard_EXPORT void Initialize(const Adaptor3d_Curve& C);
0093 
0094   //! sets the fields of the algorithm.
0095   Standard_EXPORT void Initialize(const Standard_Integer NbU,
0096                                   const Standard_Real    Umin,
0097                                   const Standard_Real    Usup,
0098                                   const Standard_Real    TolU,
0099                                   const Standard_Real    TolF);
0100 
0101   //! the algorithm is done with the point P.
0102   //! An exception is raised if the fields have not
0103   //! been initialized.
0104   Standard_EXPORT void Perform(const gp_Pnt& P);
0105 
0106   //! True if the distances are found.
0107   Standard_EXPORT Standard_Boolean IsDone() const;
0108 
0109   //! Returns the number of extremum distances.
0110   Standard_EXPORT Standard_Integer NbExt() const;
0111 
0112   //! Returns the value of the Nth extremum square distance.
0113   Standard_EXPORT Standard_Real SquareDistance(const Standard_Integer N) const;
0114 
0115   //! Returns True if the Nth extremum distance is a
0116   //! minimum.
0117   Standard_EXPORT Standard_Boolean IsMin(const Standard_Integer N) const;
0118 
0119   //! Returns the point of the Nth extremum distance.
0120   Standard_EXPORT const Extrema_POnCurv& Point(const Standard_Integer N) const;
0121 
0122 protected:
0123 private:
0124   Standard_Boolean        myDone;
0125   Standard_Boolean        myInit;
0126   Standard_Integer        mynbsample;
0127   Standard_Real           myumin;
0128   Standard_Real           myusup;
0129   Standard_Real           mytolu;
0130   Standard_Real           mytolF;
0131   Extrema_PCFOfEPCOfExtPC myF;
0132 };
0133 
0134 #endif // _Extrema_EPCOfExtPC_HeaderFile