Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:15:26

0001 // Created on: 1994-02-01
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1994-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_ExtPS_HeaderFile
0018 #define _Extrema_ExtPS_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Extrema_ExtPElS.hxx>
0025 #include <Extrema_GenExtPS.hxx>
0026 #include <Extrema_POnSurf.hxx>
0027 #include <NCollection_Sequence.hxx>
0028 #include <gp_Pnt.hxx>
0029 #include <GeomAbs_SurfaceType.hxx>
0030 #include <Extrema_ExtFlag.hxx>
0031 #include <Extrema_ExtAlgo.hxx>
0032 #include <Standard_Integer.hxx>
0033 class Extrema_ExtPExtS;
0034 class Extrema_ExtPRevS;
0035 class Adaptor3d_Surface;
0036 class Extrema_POnSurf;
0037 
0038 //! It calculates all the extremum distances
0039 //! between a point and a surface.
0040 //! These distances can be minimum or maximum.
0041 class Extrema_ExtPS
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   Standard_EXPORT Extrema_ExtPS();
0047 
0048   //! It calculates all the distances.
0049   //! NbU and NbV are used to locate the close points
0050   //! to find the zeros. They must be great enough
0051   //! such that if there is N extrema, there will
0052   //! be N extrema between P and the grid.
0053   //! TolU et TolV are used to determine the conditions
0054   //! to stop the iterations; at the iteration number n:
0055   //! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
0056   Standard_EXPORT Extrema_ExtPS(const gp_Pnt&            P,
0057                                 const Adaptor3d_Surface& S,
0058                                 const double             TolU,
0059                                 const double             TolV,
0060                                 const Extrema_ExtFlag    F = Extrema_ExtFlag_MINMAX,
0061                                 const Extrema_ExtAlgo    A = Extrema_ExtAlgo_Grad);
0062 
0063   //! It calculates all the distances.
0064   //! NbU and NbV are used to locate the close points
0065   //! to find the zeros. They must be great enough
0066   //! such that if there is N extrema, there will
0067   //! be N extrema between P and the grid.
0068   //! TolU et TolV are used to determine the conditions
0069   //! to stop the iterations; at the iteration number n:
0070   //! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
0071   Standard_EXPORT Extrema_ExtPS(const gp_Pnt&            P,
0072                                 const Adaptor3d_Surface& S,
0073                                 const double             Uinf,
0074                                 const double             Usup,
0075                                 const double             Vinf,
0076                                 const double             Vsup,
0077                                 const double             TolU,
0078                                 const double             TolV,
0079                                 const Extrema_ExtFlag    F = Extrema_ExtFlag_MINMAX,
0080                                 const Extrema_ExtAlgo    A = Extrema_ExtAlgo_Grad);
0081 
0082   //! Initializes the fields of the algorithm.
0083   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S,
0084                                   const double             Uinf,
0085                                   const double             Usup,
0086                                   const double             Vinf,
0087                                   const double             Vsup,
0088                                   const double             TolU,
0089                                   const double             TolV);
0090 
0091   //! Computes the distances.
0092   //! An exception is raised if the fields have not been
0093   //! initialized.
0094   Standard_EXPORT void Perform(const gp_Pnt& P);
0095 
0096   //! Returns True if the distances are found.
0097   Standard_EXPORT bool IsDone() const;
0098 
0099   //! Returns the number of extremum distances.
0100   Standard_EXPORT int NbExt() const;
0101 
0102   //! Returns the value of the Nth resulting square distance.
0103   Standard_EXPORT double SquareDistance(const int N) const;
0104 
0105   //! Returns the point of the Nth resulting distance.
0106   Standard_EXPORT const Extrema_POnSurf& Point(const int N) const;
0107 
0108   //! if the surface is a trimmed surface,
0109   //! dUfVf is a square distance between <P> and the point
0110   //! of parameter FirstUParameter and FirstVParameter <PUfVf>.
0111   //! dUfVl is a square distance between <P> and the point
0112   //! of parameter FirstUParameter and LastVParameter <PUfVl>.
0113   //! dUlVf is a square distance between <P> and the point
0114   //! of parameter LastUParameter and FirstVParameter <PUlVf>.
0115   //! dUlVl is a square distance between <P> and the point
0116   //! of parameter LastUParameter and LastVParameter <PUlVl>.
0117   Standard_EXPORT void TrimmedSquareDistances(double& dUfVf,
0118                                               double& dUfVl,
0119                                               double& dUlVf,
0120                                               double& dUlVl,
0121                                               gp_Pnt& PUfVf,
0122                                               gp_Pnt& PUfVl,
0123                                               gp_Pnt& PUlVf,
0124                                               gp_Pnt& PUlVl) const;
0125 
0126   Standard_EXPORT void SetFlag(const Extrema_ExtFlag F);
0127 
0128   Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A);
0129 
0130 private:
0131   Standard_EXPORT void TreatSolution(const Extrema_POnSurf& PS, const double Val);
0132 
0133 private:
0134   const Adaptor3d_Surface*              myS;
0135   bool                                  myDone;
0136   Extrema_ExtPElS                       myExtPElS;
0137   Extrema_GenExtPS                      myExtPS;
0138   NCollection_Sequence<Extrema_POnSurf> myPoints;
0139   double                                myuinf;
0140   double                                myusup;
0141   double                                myvinf;
0142   double                                myvsup;
0143   double                                mytolu;
0144   double                                mytolv;
0145   double                                d11;
0146   double                                d12;
0147   double                                d21;
0148   double                                d22;
0149   gp_Pnt                                P11;
0150   gp_Pnt                                P12;
0151   gp_Pnt                                P21;
0152   gp_Pnt                                P22;
0153   NCollection_Sequence<double>          mySqDist;
0154   GeomAbs_SurfaceType                   mytype;
0155   occ::handle<Extrema_ExtPExtS>         myExtPExtS;
0156   occ::handle<Extrema_ExtPRevS>         myExtPRevS;
0157 };
0158 
0159 #endif // _Extrema_ExtPS_HeaderFile