42cf5bc1 |
1 | // Created on: 1998-07-14 |
2 | // Created by: data exchange team |
3 | // Copyright (c) 1998-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _ShapeConstruct_Curve_HeaderFile |
18 | #define _ShapeConstruct_Curve_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <TColStd_HArray1OfReal.hxx> |
27 | #include <TColStd_Array1OfReal.hxx> |
28 | class Geom_Curve; |
29 | class gp_Pnt; |
30 | class Geom2d_Curve; |
31 | class gp_Pnt2d; |
32 | class Geom_BSplineCurve; |
33 | class Geom2d_BSplineCurve; |
34 | |
35 | |
36 | //! Adjusts curve to have start and end points at the given |
37 | //! points (currently works on lines and B-Splines only) |
38 | class ShapeConstruct_Curve |
39 | { |
40 | public: |
41 | |
42 | DEFINE_STANDARD_ALLOC |
43 | |
44 | |
45 | //! Modifies a curve in order to make its bounds confused with |
46 | //! given points. |
47 | //! Works only on lines and B-Splines, returns True in this case, |
48 | //! else returns False. |
49 | //! For line considers both bounding points, for B-Splines only |
50 | //! specified. |
51 | //! |
52 | //! Warning : Does not check if curve should be reversed |
53 | Standard_EXPORT Standard_Boolean AdjustCurve (const Handle(Geom_Curve)& C3D, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Boolean take1 = Standard_True, const Standard_Boolean take2 = Standard_True) const; |
54 | |
55 | //! Modifies a curve in order to make its bounds confused with |
56 | //! given points. |
57 | //! Works only on lines and B-Splines. |
58 | //! |
59 | //! For lines works as previous method, B-Splines are segmented |
60 | //! at the given values and then are adjusted to the points. |
61 | Standard_EXPORT Standard_Boolean AdjustCurveSegment (const Handle(Geom_Curve)& C3D, const gp_Pnt& P1, const gp_Pnt& P2, const Standard_Real U1, const Standard_Real U2) const; |
62 | |
63 | //! Modifies a curve in order to make its bounds confused with |
64 | //! given points. |
65 | //! Works only on lines and B-Splines, returns True in this case, |
66 | //! else returns False. |
67 | //! |
68 | //! For line considers both bounding points, for B-Splines only |
69 | //! specified. |
70 | //! |
71 | //! Warning : Does not check if curve should be reversed |
72 | Standard_EXPORT Standard_Boolean AdjustCurve2d (const Handle(Geom2d_Curve)& C2D, const gp_Pnt2d& P1, const gp_Pnt2d& P2, const Standard_Boolean take1 = Standard_True, const Standard_Boolean take2 = Standard_True) const; |
73 | |
74 | //! Converts a curve of any type (only part from first to last) |
75 | //! to bspline. The method of conversion depends on the type |
76 | //! of original curve: |
77 | //! BSpline -> C.Segment(first,last) |
78 | //! Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last) |
79 | //! Conic and Other -> Approx_Curve3d(C[first,last],prec,C1,9,1000) |
80 | Standard_EXPORT Handle(Geom_BSplineCurve) ConvertToBSpline (const Handle(Geom_Curve)& C, const Standard_Real first, const Standard_Real last, const Standard_Real prec) const; |
81 | |
82 | //! Converts a curve of any type (only part from first to last) |
83 | //! to bspline. The method of conversion depends on the type |
84 | //! of original curve: |
85 | //! BSpline -> C.Segment(first,last) |
86 | //! Bezier and Line -> GeomConvert::CurveToBSplineCurve(C).Segment(first,last) |
87 | //! Conic and Other -> Approx_Curve2d(C[first,last],prec,C1,9,1000) |
88 | Standard_EXPORT Handle(Geom2d_BSplineCurve) ConvertToBSpline (const Handle(Geom2d_Curve)& C, const Standard_Real first, const Standard_Real last, const Standard_Real prec) const; |
89 | |
90 | Standard_EXPORT static Standard_Boolean FixKnots (Handle(TColStd_HArray1OfReal)& knots); |
91 | |
92 | //! Fix bspline knots to ensure that there is enough |
93 | //! gap between neighbouring values |
94 | //! Returns True if something fixed (by shifting knot) |
95 | Standard_EXPORT static Standard_Boolean FixKnots (TColStd_Array1OfReal& knots); |
96 | |
97 | |
98 | |
99 | |
100 | protected: |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | private: |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | }; |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | |
120 | #endif // _ShapeConstruct_Curve_HeaderFile |