Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-22 09:13:24

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