42cf5bc1 |
1 | // Created on: 2001-12-20 |
2 | // Created by: Pavel TELKOV |
3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _ShapeCustom_Curve2d_HeaderFile |
17 | #define _ShapeCustom_Curve2d_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <TColgp_Array1OfPnt2d.hxx> |
25 | #include <Standard_Real.hxx> |
26 | class Geom2d_Line; |
27 | class Geom2d_Curve; |
28 | class Geom2d_BSplineCurve; |
29 | |
30 | |
31 | //! Converts curve2d to analytical form with given |
32 | //! precision or simpify curve2d. |
33 | class ShapeCustom_Curve2d |
34 | { |
35 | public: |
36 | |
37 | DEFINE_STANDARD_ALLOC |
38 | |
39 | |
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); |
43 | |
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); |
48 | |
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); |
53 | |
54 | |
55 | |
56 | |
57 | protected: |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | private: |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | }; |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | #endif // _ShapeCustom_Curve2d_HeaderFile |