Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:20:09

0001 // Created on: 1996-01-18
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_GenExtSS_HeaderFile
0018 #define _Extrema_GenExtSS_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Pnt.hxx>
0025 #include <NCollection_Array2.hxx>
0026 #include <NCollection_HArray2.hxx>
0027 #include <Extrema_FuncExtSS.hxx>
0028 
0029 class Adaptor3d_Surface;
0030 class Extrema_POnSurf;
0031 
0032 //! It calculates all the extremum distances
0033 //! between two surfaces.
0034 //! These distances can be minimum or maximum.
0035 class Extrema_GenExtSS
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   //! Empty constructor.
0041   Standard_EXPORT Extrema_GenExtSS();
0042 
0043   //! Destructor.
0044   Standard_EXPORT ~Extrema_GenExtSS();
0045 
0046   //! It calculates all the distances.
0047   //! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
0048   //! extremum when gradient(F)=0. The algorithm searches
0049   //! all the zeros inside the definition ranges of the
0050   //! surfaces.
0051   //! NbU and NbV are used to locate the close points
0052   //! to find the zeros.
0053   Standard_EXPORT Extrema_GenExtSS(const Adaptor3d_Surface& S1,
0054                                    const Adaptor3d_Surface& S2,
0055                                    const int                NbU,
0056                                    const int                NbV,
0057                                    const double             Tol1,
0058                                    const double             Tol2);
0059 
0060   //! It calculates all the distances.
0061   //! The function F(u,v)=distance(P,S(u,v)) has an
0062   //! extremum when gradient(F)=0. The algorithm searches
0063   //! all the zeros inside the definition ranges of the
0064   //! surface.
0065   //! NbU and NbV are used to locate the close points
0066   //! to find the zeros.
0067   Standard_EXPORT Extrema_GenExtSS(const Adaptor3d_Surface& S1,
0068                                    const Adaptor3d_Surface& S2,
0069                                    const int                NbU,
0070                                    const int                NbV,
0071                                    const double             U1min,
0072                                    const double             U1sup,
0073                                    const double             V1min,
0074                                    const double             V1sup,
0075                                    const double             U2min,
0076                                    const double             U2sup,
0077                                    const double             V2min,
0078                                    const double             V2sup,
0079                                    const double             Tol1,
0080                                    const double             Tol2);
0081 
0082   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S2,
0083                                   const int                NbU,
0084                                   const int                NbV,
0085                                   const double             Tol2);
0086 
0087   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S2,
0088                                   const int                NbU,
0089                                   const int                NbV,
0090                                   const double             U2min,
0091                                   const double             U2sup,
0092                                   const double             V2min,
0093                                   const double             V2sup,
0094                                   const double             Tol2);
0095 
0096   //! the algorithm is done with S1
0097   //! An exception is raised if the fields have not
0098   //! been initialized.
0099   Standard_EXPORT void Perform(const Adaptor3d_Surface& S1, const double Tol1);
0100 
0101   //! the algorithm is done withS1
0102   //! An exception is raised if the fields have not
0103   //! been initialized.
0104   Standard_EXPORT void Perform(const Adaptor3d_Surface& S1,
0105                                const double             U1min,
0106                                const double             U1sup,
0107                                const double             V1min,
0108                                const double             V1sup,
0109                                const double             Tol1);
0110 
0111   //! Returns True if the distances are found.
0112   Standard_EXPORT bool IsDone() const;
0113 
0114   //! Returns the number of extremum distances.
0115   Standard_EXPORT int NbExt() const;
0116 
0117   //! Returns the value of the Nth resulting square distance.
0118   Standard_EXPORT double SquareDistance(const int N) const;
0119 
0120   //! Returns the point of the Nth resulting distance.
0121   Standard_EXPORT const Extrema_POnSurf& PointOnS1(const int N) const;
0122 
0123   //! Returns the point of the Nth resulting distance.
0124   Standard_EXPORT const Extrema_POnSurf& PointOnS2(const int N) const;
0125 
0126 private:
0127   // disallow copies
0128   Extrema_GenExtSS(const Extrema_GenExtSS&)            = delete;
0129   Extrema_GenExtSS& operator=(const Extrema_GenExtSS&) = delete;
0130 
0131 private:
0132   bool                                     myDone;
0133   bool                                     myInit;
0134   double                                   myu1min;
0135   double                                   myu1sup;
0136   double                                   myv1min;
0137   double                                   myv1sup;
0138   double                                   myu2min;
0139   double                                   myu2sup;
0140   double                                   myv2min;
0141   double                                   myv2sup;
0142   int                                      myusample;
0143   int                                      myvsample;
0144   occ::handle<NCollection_HArray2<gp_Pnt>> mypoints1;
0145   occ::handle<NCollection_HArray2<gp_Pnt>> mypoints2;
0146   double                                   mytol1;
0147   double                                   mytol2;
0148   Extrema_FuncExtSS                        myF;
0149   const Adaptor3d_Surface*                 myS2;
0150 };
0151 
0152 #endif // _Extrema_GenExtSS_HeaderFile