Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:29

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 <TColgp_HArray2OfPnt.hxx>
0022 
0023 class Adaptor3d_Curve;
0024 class Adaptor3d_Surface;
0025 class Extrema_POnCurv;
0026 class Extrema_POnSurf;
0027 
0028 
0029 //! It calculates all the extremum distances
0030 //! between acurve and a surface.
0031 //! These distances can be minimum or maximum.
0032 class Extrema_GenExtCS 
0033 {
0034 public:
0035 
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, const Adaptor3d_Surface& S, const Standard_Integer NbT, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol1, const Standard_Real Tol2);
0052   
0053   //! It calculates all the distances.
0054   //! The function F(u,v)=distance(P,S(u,v)) has an
0055   //! extremum when gradient(F)=0. The algorithm searches
0056   //! all the zeros inside the definition ranges of the
0057   //! surface.
0058   //! NbT,NbU and NbV are used to locate the close points
0059   //! to find the zeros.
0060   Standard_EXPORT Extrema_GenExtCS(const Adaptor3d_Curve& C, const Adaptor3d_Surface& S, const Standard_Integer NbT, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real tmin, const Standard_Real tsup, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tol1, const Standard_Real Tol2);
0061   
0062   Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Tol2);
0063   
0064   Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tol2);
0065   
0066   //! the algorithm is done with S
0067   //! An exception is raised if the fields have not
0068   //! been initialized.
0069   Standard_EXPORT void Perform (const Adaptor3d_Curve& C, const Standard_Integer NbT, const Standard_Real Tol1);
0070   
0071   //! the algorithm is done with C
0072   //! An exception is raised if the fields have not
0073   //! been initialized.
0074   Standard_EXPORT void Perform (const Adaptor3d_Curve& C, const Standard_Integer NbT, const Standard_Real tmin, const Standard_Real tsup, const Standard_Real Tol1);
0075   
0076   //! Returns True if the distances are found.
0077   Standard_EXPORT Standard_Boolean IsDone() const;
0078   
0079   //! Returns the number of extremum distances.
0080   Standard_EXPORT Standard_Integer NbExt() const;
0081   
0082   //! Returns the value of the Nth resulting square distance.
0083   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
0084   
0085   //! Returns the point of the Nth resulting distance.
0086   Standard_EXPORT const Extrema_POnCurv& PointOnCurve (const Standard_Integer N) const;
0087   
0088   //! Returns the point of the Nth resulting distance.
0089   Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
0090 
0091 private:
0092 
0093   Standard_EXPORT void GlobMinGenCS(const Adaptor3d_Curve& theC,
0094     const Standard_Integer theNbParticles,
0095     const math_Vector& theTUVinf,
0096     const math_Vector& theTUVsup,
0097     math_Vector& theTUV);
0098 
0099   Standard_EXPORT void GlobMinConicS(const Adaptor3d_Curve& theC,
0100     const Standard_Integer theNbParticles,
0101     const math_Vector& theTUVinf,
0102     const math_Vector& theTUVsup,
0103     math_Vector& theTUV);
0104 
0105   Standard_EXPORT void GlobMinCQuadric(const Adaptor3d_Curve& theC,
0106     const Standard_Integer theNbParticles,
0107     const math_Vector& theTUVinf,
0108     const math_Vector& theTUVsup,
0109     math_Vector& theTUV);
0110 
0111 private:
0112 
0113   // disallow copies
0114   Extrema_GenExtCS            (const Extrema_GenExtCS& ) Standard_DELETE;
0115   Extrema_GenExtCS& operator= (const Extrema_GenExtCS& ) Standard_DELETE;
0116 
0117 private:
0118 
0119   Standard_Boolean myDone;
0120   Standard_Real mytmin;
0121   Standard_Real mytsup;
0122   Standard_Real myumin;
0123   Standard_Real myusup;
0124   Standard_Real myvmin;
0125   Standard_Real myvsup;
0126   Standard_Integer mytsample;
0127   Standard_Integer myusample;
0128   Standard_Integer myvsample;
0129   Standard_Real mytol1;
0130   Standard_Real mytol2;
0131   Extrema_FuncExtCS myF;
0132   const Adaptor3d_Surface* myS;
0133   Handle(TColgp_HArray2OfPnt) mySurfPnts;
0134 
0135 };
0136 
0137 #endif // _Extrema_GenExtCS_HeaderFile