1 // Created on: 2001-12-20
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _ShapeCustom_Curve2d_HeaderFile
17 #define _ShapeCustom_Curve2d_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TColgp_Array1OfPnt2d.hxx>
25 #include <Standard_Real.hxx>
28 class Geom2d_BSplineCurve;
31 //! Converts curve2d to analytical form with given
32 //! precision or simpify curve2d.
33 class ShapeCustom_Curve2d
40 //! Check if poleses is in the plane with given precision
41 //! Returns false if no.
42 Standard_EXPORT static Standard_Boolean IsLinear (const TColgp_Array1OfPnt2d& thePoles, const Standard_Real theTolerance, Standard_Real& theDeviation);
44 //! Try to convert BSpline2d or Bezier2d to line 2d
45 //! only if it is linear. Recalculate first and last parameters.
46 //! Returns line2d or null curve2d.
47 Standard_EXPORT static Handle(Geom2d_Line) ConvertToLine2d (const Handle(Geom2d_Curve)& theCurve, const Standard_Real theFirstIn, const Standard_Real theLastIn, const Standard_Real theTolerance, Standard_Real& theNewFirst, Standard_Real& theNewLast, Standard_Real& theDeviation);
49 //! Try to remove knots from bspline where local derivatives are the same.
50 //! Remove knots with given precision.
51 //! Returns false if Bsplien was not modified
52 Standard_EXPORT static Standard_Boolean SimplifyBSpline2d (Handle(Geom2d_BSplineCurve)& theBSpline2d, const Standard_Real theTolerance);
77 #endif // _ShapeCustom_Curve2d_HeaderFile