Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created: 2001-05-21 
0002 // 
0003 // Copyright (c) 2001-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_CurveToAnaCurve_HeaderFile
0018 #define _GeomConvert_CurveToAnaCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 #include <Standard_Boolean.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <TColgp_Array1OfPnt.hxx>
0026 #include <GeomConvert_ConvType.hxx>
0027 #include <GeomAbs_CurveType.hxx>
0028 
0029 class Geom_Curve;
0030 class Geom_Line;
0031 class gp_Lin;
0032 class gp_Pnt;
0033 class gp_Circ;
0034 
0035 
0036 
0037 class GeomConvert_CurveToAnaCurve 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042  
0043   Standard_EXPORT GeomConvert_CurveToAnaCurve();
0044   
0045   Standard_EXPORT GeomConvert_CurveToAnaCurve(const Handle(Geom_Curve)& C);
0046   
0047   Standard_EXPORT void Init (const Handle(Geom_Curve)& C);
0048   
0049   //! Converts me to analytical if possible with given
0050   //! tolerance. The new first and last parameters are
0051   //! returned to newF, newL
0052   Standard_EXPORT Standard_Boolean ConvertToAnalytical (const Standard_Real theTol, Handle(Geom_Curve)& theResultCurve, const Standard_Real F, const Standard_Real L, Standard_Real& newF, Standard_Real& newL);
0053   
0054   Standard_EXPORT static Handle(Geom_Curve) ComputeCurve (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, 
0055     const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, 
0056     Standard_Real& theGap, const GeomConvert_ConvType theCurvType = GeomConvert_MinGap, const GeomAbs_CurveType theTarget = GeomAbs_Line);
0057   
0058   //! Tries to convert the given curve to circle with given
0059   //! tolerance. Returns NULL curve if conversion is
0060   //! not possible.
0061   Standard_EXPORT static Handle(Geom_Curve) ComputeCircle (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
0062   
0063   //! Tries to convert the given curve to ellipse with given
0064   //! tolerance. Returns NULL curve if conversion is
0065   //! not possible.
0066   Standard_EXPORT static Handle(Geom_Curve) ComputeEllipse (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
0067   
0068   //! Tries to convert the given curve to line with given
0069   //! tolerance. Returns NULL curve if conversion is
0070   //! not possible.
0071   Standard_EXPORT static Handle(Geom_Line) ComputeLine (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
0072   
0073   //! Returns true if the set of points is linear with given
0074   //! tolerance
0075   Standard_EXPORT static Standard_Boolean IsLinear (const TColgp_Array1OfPnt& aPoints, const Standard_Real tolerance, Standard_Real& Deviation);
0076    
0077   //! Creates line on two points.
0078   //! Resulting parameters returned
0079   Standard_EXPORT static gp_Lin GetLine(const gp_Pnt& P1, const gp_Pnt& P2, Standard_Real& cf, Standard_Real& cl);
0080 
0081   //! Creates circle on points. Returns true if OK.
0082   Standard_EXPORT static Standard_Boolean GetCircle(gp_Circ& Circ, const gp_Pnt& P0, const gp_Pnt& P1, const gp_Pnt& P2); 
0083 
0084   //! Returns maximal deviation of converted surface from the original
0085   //! one computed by last call to ConvertToAnalytical
0086   Standard_Real Gap() const
0087   {
0088     return myGap;
0089   }
0090 
0091   //! Returns conversion type 
0092   GeomConvert_ConvType GetConvType() const
0093   {
0094     return myConvType;
0095   }
0096 
0097   //! Sets type of convertion
0098   void SetConvType(const GeomConvert_ConvType theConvType)
0099   {
0100     myConvType = theConvType;
0101   }
0102 
0103   //! Returns target curve type 
0104   GeomAbs_CurveType GetTarget() const
0105   {
0106     return myTarget;
0107   }
0108 
0109   //! Sets target curve type
0110   void SetTarget(const GeomAbs_CurveType theTarget)
0111   {
0112     myTarget = theTarget;
0113   }
0114 
0115 
0116 protected:
0117 
0118 
0119 
0120 
0121 
0122 private:
0123 
0124   Handle(Geom_Curve) myCurve;
0125   Standard_Real myGap;
0126   GeomConvert_ConvType myConvType;
0127   GeomAbs_CurveType myTarget;
0128 
0129 };
0130 
0131 
0132 
0133 #endif // _GeomConvert_CurveToAnaCurve_HeaderFile