Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 09:03:20

0001 // Created on: 1991-02-21
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_ExtCS_HeaderFile
0018 #define _Extrema_ExtCS_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Extrema_ExtElCS.hxx>
0024 #include <Extrema_POnSurf.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <Extrema_POnCurv.hxx>
0027 #include <GeomAbs_SurfaceType.hxx>
0028 
0029 class Adaptor3d_Curve;
0030 class Adaptor3d_Surface;
0031 class Extrema_POnCurv;
0032 class Extrema_POnSurf;
0033 class gp_Pnt;
0034 
0035 //! It calculates all the extremum distances
0036 //! between a curve and a surface.
0037 //! These distances can be minimum or maximum.
0038 class Extrema_ExtCS
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   Standard_EXPORT Extrema_ExtCS();
0044 
0045   //! It calculates all the distances between C and S.
0046   Standard_EXPORT Extrema_ExtCS(const Adaptor3d_Curve&   C,
0047                                 const Adaptor3d_Surface& S,
0048                                 const double             TolC,
0049                                 const double             TolS);
0050 
0051   //! It calculates all the distances between C and S.
0052   //! UCinf and UCmax are the start and end parameters
0053   //! of the curve.
0054   Standard_EXPORT Extrema_ExtCS(const Adaptor3d_Curve&   C,
0055                                 const Adaptor3d_Surface& S,
0056                                 const double             UCinf,
0057                                 const double             UCsup,
0058                                 const double             Uinf,
0059                                 const double             Usup,
0060                                 const double             Vinf,
0061                                 const double             Vsup,
0062                                 const double             TolC,
0063                                 const double             TolS);
0064 
0065   //! Initializes the fields of the algorithm.
0066   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S, const double TolC, const double TolS);
0067 
0068   //! Initializes the fields of the algorithm.
0069   Standard_EXPORT void Initialize(const Adaptor3d_Surface& S,
0070                                   const double             Uinf,
0071                                   const double             Usup,
0072                                   const double             Vinf,
0073                                   const double             Vsup,
0074                                   const double             TolC,
0075                                   const double             TolS);
0076 
0077   //! Computes the distances.
0078   //! An exception is raised if the fields have not been
0079   //! initialized.
0080   Standard_EXPORT void Perform(const Adaptor3d_Curve& C, const double Uinf, const double Usup);
0081 
0082   //! Returns True if the distances are found.
0083   Standard_EXPORT bool IsDone() const;
0084 
0085   //! Returns True if the curve is on a parallel surface.
0086   Standard_EXPORT bool IsParallel() const;
0087 
0088   //! Returns the number of extremum distances.
0089   Standard_EXPORT int NbExt() const;
0090 
0091   //! Returns the value of the Nth resulting square distance.
0092   Standard_EXPORT double SquareDistance(const int N) const;
0093 
0094   //! Returns the point of the Nth resulting distance.
0095   Standard_EXPORT void Points(const int N, Extrema_POnCurv& P1, Extrema_POnSurf& P2) const;
0096 
0097 private:
0098   Standard_EXPORT bool AddSolution(const Adaptor3d_Curve& Curve,
0099                                    const double           T,
0100                                    const double           U,
0101                                    const double           V,
0102                                    const gp_Pnt&          PointOnCurve,
0103                                    const gp_Pnt&          PointOnSurf,
0104                                    const double           SquareDist);
0105 
0106 private:
0107   // disallow copies
0108   Extrema_ExtCS(Extrema_ExtCS&)            = delete;
0109   Extrema_ExtCS& operator=(Extrema_ExtCS&) = delete;
0110 
0111 private:
0112   const Adaptor3d_Surface*              myS;
0113   bool                                  myDone;
0114   bool                                  myIsPar;
0115   Extrema_ExtElCS                       myExtElCS;
0116   NCollection_Sequence<Extrema_POnSurf> myPOnS;
0117   NCollection_Sequence<Extrema_POnCurv> myPOnC;
0118   double                                myuinf;
0119   double                                myusup;
0120   double                                myvinf;
0121   double                                myvsup;
0122   double                                mytolC;
0123   double                                mytolS;
0124   double                                myucinf;
0125   double                                myucsup;
0126   NCollection_Sequence<double>          mySqDist;
0127   GeomAbs_SurfaceType                   myStype;
0128 };
0129 
0130 #endif // _Extrema_ExtCS_HeaderFile