Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1997-09-11
0002 // Created by: Roman BORISOV
0003 // Copyright (c) 1997-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 _Geom2dConvert_ApproxCurve_HeaderFile
0018 #define _Geom2dConvert_ApproxCurve_HeaderFile
0019 
0020 #include <Adaptor2d_Curve2d.hxx>
0021 #include <GeomAbs_Shape.hxx>
0022 #include <Standard_OStream.hxx>
0023 
0024 class Geom2d_BSplineCurve;
0025 class Geom2d_Curve;
0026 
0027 //! A framework to convert a 2D curve to a BSpline.
0028 //! This is done by approximation within a given tolerance.
0029 class Geom2dConvert_ApproxCurve 
0030 {
0031 public:
0032 
0033   DEFINE_STANDARD_ALLOC
0034 
0035   
0036   //! Constructs an approximation framework defined by
0037   //! -   the 2D conic Curve
0038   //! -   the tolerance value Tol2d
0039   //! -   the degree of continuity Order
0040   //! -   the maximum number of segments allowed MaxSegments
0041   //! -   the highest degree MaxDegree which the
0042   //! polynomial defining the BSpline is allowed to have.
0043   Standard_EXPORT Geom2dConvert_ApproxCurve(const Handle(Geom2d_Curve)& Curve, const Standard_Real Tol2d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
0044   
0045   //! Constructs an approximation framework defined by
0046   //! -   the 2D conic Curve
0047   //! -   the tolerance value Tol2d
0048   //! -   the degree of continuity Order
0049   //! -   the maximum number of segments allowed MaxSegments
0050   //! -   the highest degree MaxDegree which the
0051   //! polynomial defining the BSpline is allowed to have.
0052   Standard_EXPORT Geom2dConvert_ApproxCurve(const Handle(Adaptor2d_Curve2d)& Curve, const Standard_Real Tol2d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
0053   
0054   //! Returns the 2D BSpline curve resulting from the
0055   //! approximation algorithm.
0056   Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve() const;
0057   
0058   //! returns  Standard_True  if  the  approximation  has
0059   //! been  done  with  within  required tolerance
0060   Standard_EXPORT Standard_Boolean IsDone() const;
0061   
0062   //! returns  Standard_True if the approximation did come out
0063   //! with a result that  is not NECESSARELY within the required tolerance
0064   Standard_EXPORT Standard_Boolean HasResult() const;
0065   
0066   //! Returns the greatest distance between a point on the
0067   //! source conic and the BSpline curve resulting from the
0068   //! approximation. (>0 when an approximation
0069   //! has  been  done, 0  if  no  approximation)
0070   Standard_EXPORT Standard_Real MaxError() const;
0071   
0072   //! Print on the stream  o  information about the object
0073   Standard_EXPORT void Dump (Standard_OStream& o) const;
0074 
0075 
0076 
0077 
0078 protected:
0079 
0080 
0081 
0082 
0083 
0084 private:
0085 
0086   
0087   //! Converts a curve to B-spline
0088   Standard_EXPORT void Approximate (const Handle(Adaptor2d_Curve2d)& theCurve, const Standard_Real theTol3d, const GeomAbs_Shape theOrder, const Standard_Integer theMaxSegments, const Standard_Integer theMaxDegree);
0089 
0090 
0091   Standard_Boolean myIsDone;
0092   Standard_Boolean myHasResult;
0093   Handle(Geom2d_BSplineCurve) myBSplCurve;
0094   Standard_Real myMaxError;
0095 
0096 
0097 };
0098 
0099 
0100 
0101 
0102 
0103 
0104 
0105 #endif // _Geom2dConvert_ApproxCurve_HeaderFile