Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:14:13

0001 // Created on: 1996-01-23
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1996-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_GenExtCS_HeaderFile
0018 #define _Extrema_GenExtCS_HeaderFile
0019 
0020 #include <Extrema_FuncExtCS.hxx>
0021 #include <gp_Pnt.hxx>
0022 #include <NCollection_Array2.hxx>
0023 #include <NCollection_HArray2.hxx>
0024 
0025 class Adaptor3d_Curve;
0026 class Adaptor3d_Surface;
0027 class Extrema_POnCurv;
0028 class Extrema_POnSurf;
0029 
0030 //! It calculates all the extremum distances
0031 //! between acurve and a surface.
0032 //! These distances can be minimum or maximum.
0033 class Extrema_GenExtCS
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Empty constructor.
0039   Standard_EXPORT Extrema_GenExtCS();
0040 
0041   //! Destructor.
0042   Standard_EXPORT ~Extrema_GenExtCS();
0043 
0044   //! It calculates all the distances.
0045   //! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
0046   //! extremum when gradient(F)=0. The algorithm searches
0047   //! all the zeros inside the definition ranges of the
0048   //! surfaces.
0049   //! NbU and NbV are used to locate the close points on the
0050   //! surface and NbT on the curve to find the zeros.
0051   Standard_EXPORT Extrema_GenExtCS(const Adaptor3d_Curve&   C,
0052                                    const Adaptor3d_Surface& S,
0053                                    const int                NbT,
0054                                    const int                NbU,
0055                                    const int                NbV,
0056                                    const double             Tol1,
0057                                    const double             Tol2);
0058 
0059   //! It calculates all the distances.
0060   //! The function F(u,v)=distance(P,S(u,v)) has an
0061   //! extremum when gradient(F)=0. The algorithm searches
0062   //! all the zeros inside the definition ranges of the
0063   //! surface.
0064   //! NbT,NbU and NbV are used to locate the close points
0065   //! to find the zeros.
0066   Standard_EXPORT Extrema_GenExtCS(const Adaptor3d_Curve&   C,
0067                                    const Adaptor3d_Surface& S,
0068                                    const int                NbT,
0069                                    const int                NbU,
0070                                    const int                NbV,
0071                                    const double             tmin,
0072                                    const double             tsup,
0073                                    const double             Umin,
0074                                    const double             Usup,
0075                                    const double             Vmin,
0076                                    const double             Vsup,
0077                                    const double             Tol1,
0078                                    const double             Tol2);
0079 
0080   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S,
0081                                   const int                NbU,
0082                                   const int                NbV,
0083                                   const double             Tol2);
0084 
0085   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S,
0086                                   const int                NbU,
0087                                   const int                NbV,
0088                                   const double             Umin,
0089                                   const double             Usup,
0090                                   const double             Vmin,
0091                                   const double             Vsup,
0092                                   const double             Tol2);
0093 
0094   //! the algorithm is done with S
0095   //! An exception is raised if the fields have not
0096   //! been initialized.
0097   Standard_EXPORT void Perform(const Adaptor3d_Curve& C, const int NbT, const double Tol1);
0098 
0099   //! the algorithm is done with C
0100   //! An exception is raised if the fields have not
0101   //! been initialized.
0102   Standard_EXPORT void Perform(const Adaptor3d_Curve& C,
0103                                const int              NbT,
0104                                const double           tmin,
0105                                const double           tsup,
0106                                const double           Tol1);
0107 
0108   //! Returns True if the distances are found.
0109   Standard_EXPORT bool IsDone() const;
0110 
0111   //! Returns the number of extremum distances.
0112   Standard_EXPORT int NbExt() const;
0113 
0114   //! Returns the value of the Nth resulting square distance.
0115   Standard_EXPORT double SquareDistance(const int N) const;
0116 
0117   //! Returns the point of the Nth resulting distance.
0118   Standard_EXPORT const Extrema_POnCurv& PointOnCurve(const int N) const;
0119 
0120   //! Returns the point of the Nth resulting distance.
0121   Standard_EXPORT const Extrema_POnSurf& PointOnSurface(const int N) const;
0122 
0123 private:
0124   Standard_EXPORT void GlobMinGenCS(const Adaptor3d_Curve& theC,
0125                                     const int              theNbParticles,
0126                                     const math_Vector&     theTUVinf,
0127                                     const math_Vector&     theTUVsup,
0128                                     math_Vector&           theTUV);
0129 
0130   Standard_EXPORT void GlobMinConicS(const Adaptor3d_Curve& theC,
0131                                      const int              theNbParticles,
0132                                      const math_Vector&     theTUVinf,
0133                                      const math_Vector&     theTUVsup,
0134                                      math_Vector&           theTUV);
0135 
0136   Standard_EXPORT void GlobMinCQuadric(const Adaptor3d_Curve& theC,
0137                                        const int              theNbParticles,
0138                                        const math_Vector&     theTUVinf,
0139                                        const math_Vector&     theTUVsup,
0140                                        math_Vector&           theTUV);
0141 
0142 private:
0143   // disallow copies
0144   Extrema_GenExtCS(const Extrema_GenExtCS&)            = delete;
0145   Extrema_GenExtCS& operator=(const Extrema_GenExtCS&) = delete;
0146 
0147 private:
0148   bool                                     myDone;
0149   double                                   mytmin;
0150   double                                   mytsup;
0151   double                                   myumin;
0152   double                                   myusup;
0153   double                                   myvmin;
0154   double                                   myvsup;
0155   int                                      mytsample;
0156   int                                      myusample;
0157   int                                      myvsample;
0158   double                                   mytol1;
0159   double                                   mytol2;
0160   Extrema_FuncExtCS                        myF;
0161   const Adaptor3d_Surface*                 myS;
0162   occ::handle<NCollection_HArray2<gp_Pnt>> mySurfPnts;
0163 };
0164 
0165 #endif // _Extrema_GenExtCS_HeaderFile