Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created: 1998-06-03 
0002 // 
0003 // Copyright (c) 1999-2013 OPEN CASCADE SAS 
0004 // 
0005 // This file is part of commercial software by OPEN CASCADE SAS, 
0006 // furnished in accordance with the terms and conditions of the contract 
0007 // and with the inclusion of this copyright notice. 
0008 // This file or any part thereof may not be provided or otherwise 
0009 // made available to any third party. 
0010 // 
0011 // No ownership title to the software is transferred hereby. 
0012 // 
0013 // OPEN CASCADE SAS makes no representation or warranties with respect to the 
0014 // performance of this software, and specifically disclaims any responsibility 
0015 // for any damages, special or consequential, connected with its use. 
0016 
0017 #ifndef _GeomConvert_SurfToAnaSurf_HeaderFile
0018 #define _GeomConvert_SurfToAnaSurf_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Real.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <GeomConvert_ConvType.hxx>
0027 #include <GeomAbs_SurfaceType.hxx>
0028 #include <TColgp_HArray1OfXYZ.hxx>
0029 class Geom_Surface;
0030 class Geom_SurfaceOfRevolution;
0031 class Geom_Circle;
0032 
0033 //! Converts a surface to the analitical form with given
0034 //! precision. Conversion is done only the surface is bspline
0035 //! of bezier and this can be approximed by some analytical
0036 //! surface with that precision.
0037 class GeomConvert_SurfToAnaSurf 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042   
0043   Standard_EXPORT GeomConvert_SurfToAnaSurf();
0044   
0045   Standard_EXPORT GeomConvert_SurfToAnaSurf(const Handle(Geom_Surface)& S);
0046   
0047   Standard_EXPORT void Init (const Handle(Geom_Surface)& S);
0048 
0049   void SetConvType(const GeomConvert_ConvType theConvType = GeomConvert_Simplest)
0050   {
0051     myConvType = theConvType;
0052   }
0053   void SetTarget(const GeomAbs_SurfaceType theSurfType = GeomAbs_Plane)
0054   {
0055     myTarget = theSurfType;
0056   }
0057 
0058   //! Returns maximal deviation of converted surface from the original
0059   //! one computed by last call to ConvertToAnalytical
0060   Standard_Real Gap() const
0061   {
0062     return myGap;
0063   }
0064   
0065   //! Tries to convert the Surface to an Analytic form
0066   //! Returns the result
0067   //! In case of failure, returns a Null Handle
0068   //!
0069   Standard_EXPORT Handle(Geom_Surface) ConvertToAnalytical (const Standard_Real InitialToler);
0070   Standard_EXPORT Handle(Geom_Surface) ConvertToAnalytical (const Standard_Real InitialToler,
0071                                                             const Standard_Real Umin, const Standard_Real Umax,
0072                                                             const Standard_Real Vmin, const Standard_Real Vmax);
0073  
0074   //! Returns true if surfaces is same with the given tolerance
0075   Standard_EXPORT static Standard_Boolean IsSame (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real tol);
0076   
0077   //! Returns true, if surface is canonical
0078   Standard_EXPORT static Standard_Boolean IsCanonical (const Handle(Geom_Surface)& S);
0079 
0080 private:
0081   //!static method for checking surface of revolution
0082   //!To avoid two-parts cone-like surface
0083   static void CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSurf,
0084     Standard_Real& V1, Standard_Real& V2);
0085 
0086   //!static method to try create cylindrical or conical surface
0087   static Handle(Geom_Surface) TryCylinerCone(const Handle(Geom_Surface)& theSurf, const Standard_Boolean theVCase,
0088     const Handle(Geom_Curve)& theUmidiso, const Handle(Geom_Curve)& theVmidiso,
0089     const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
0090     const Standard_Real theToler);
0091 
0092   //!static method to try create cylinrical surface using least square method
0093   static Standard_Boolean GetCylByLS(const Handle(TColgp_HArray1OfXYZ)& thePoints,
0094     const Standard_Real theTol,
0095     gp_Ax3& thePos, Standard_Real& theR,
0096     Standard_Real& theGap);
0097 
0098   //!static method to try create cylinrical surface based on its Gauss field
0099   static Handle(Geom_Surface) TryCylinderByGaussField(const Handle(Geom_Surface)& theSurf,
0100     const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
0101     const Standard_Real theToler, const Standard_Integer theNbU = 20, const Standard_Integer theNbV = 20,
0102     const Standard_Boolean theLeastSquare = Standard_False);
0103 
0104   //! static method to try create toroidal surface.
0105   //! In case <isTryUMajor> = Standard_True try to use V isoline radius as minor radaius.
0106   static Handle(Geom_Surface) TryTorusSphere(const Handle(Geom_Surface)& theSurf,
0107     const Handle(Geom_Circle)& circle,
0108     const Handle(Geom_Circle)& otherCircle,
0109     const Standard_Real Param1,
0110     const Standard_Real Param2,
0111     const Standard_Real aParam1ToCrv,
0112     const Standard_Real aParam2ToCrv,
0113     const Standard_Real toler,
0114     const Standard_Boolean isTryUMajor);
0115 
0116   static Standard_Real ComputeGap(const Handle(Geom_Surface)& theSurf,
0117     const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
0118     const Handle(Geom_Surface)& theNewSurf, const Standard_Real theTol = RealLast());
0119 
0120 
0121 
0122 
0123 protected:
0124 
0125 private:
0126 
0127   Handle(Geom_Surface) mySurf;
0128   Standard_Real myGap;
0129   GeomConvert_ConvType myConvType;
0130   GeomAbs_SurfaceType myTarget;
0131 
0132 };
0133 
0134 
0135 #endif // _GeomConvert_SurfToAnaSurf_HeaderFile