42cf5bc1 |
1 | // Created on: 1995-07-17 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1995-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 _BRepBlend_HCurve2dTool_HeaderFile |
18 | #define _BRepBlend_HCurve2dTool_HeaderFile |
19 | |
c22b52d6 |
20 | #include <Adaptor2d_Curve2d.hxx> |
21 | #include <Geom2d_BezierCurve.hxx> |
22 | #include <Geom2d_BSplineCurve.hxx> |
42cf5bc1 |
23 | #include <GeomAbs_CurveType.hxx> |
c22b52d6 |
24 | #include <GeomAbs_Shape.hxx> |
42cf5bc1 |
25 | #include <gp_Lin2d.hxx> |
26 | #include <gp_Circ2d.hxx> |
27 | #include <gp_Elips2d.hxx> |
42cf5bc1 |
28 | #include <gp_Parab2d.hxx> |
c22b52d6 |
29 | #include <gp_Pnt2d.hxx> |
30 | #include <gp_Vec2d.hxx> |
31 | #include <gp_Hypr2d.hxx> |
32 | #include <TColStd_Array1OfReal.hxx> |
42cf5bc1 |
33 | |
34 | class BRepBlend_HCurve2dTool |
35 | { |
36 | public: |
37 | |
38 | DEFINE_STANDARD_ALLOC |
39 | |
40 | |
c22b52d6 |
41 | static Standard_Real FirstParameter (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
42 | |
c22b52d6 |
43 | static Standard_Real LastParameter (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
44 | |
c22b52d6 |
45 | static GeomAbs_Shape Continuity (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
46 | |
47 | //! Returns the number of intervals for continuity |
48 | //! <S>. May be one if Continuity(myclass) >= <S> |
c22b52d6 |
49 | static Standard_Integer NbIntervals (const Handle(Adaptor2d_Curve2d)& C, const GeomAbs_Shape S); |
42cf5bc1 |
50 | |
51 | //! Stores in <T> the parameters bounding the intervals |
52 | //! of continuity <S>. |
53 | //! |
21c7c457 |
54 | //! The array must provide enough room to accommodate |
42cf5bc1 |
55 | //! for the parameters. i.e. T.Length() > NbIntervals() |
c22b52d6 |
56 | static void Intervals (const Handle(Adaptor2d_Curve2d)& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S); |
42cf5bc1 |
57 | |
c22b52d6 |
58 | static Standard_Boolean IsClosed (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
59 | |
c22b52d6 |
60 | static Standard_Boolean IsPeriodic (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
61 | |
c22b52d6 |
62 | static Standard_Real Period (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
63 | |
64 | //! Computes the point of parameter U on the curve. |
c22b52d6 |
65 | static gp_Pnt2d Value (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U); |
42cf5bc1 |
66 | |
67 | //! Computes the point of parameter U on the curve. |
c22b52d6 |
68 | static void D0 (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, gp_Pnt2d& P); |
42cf5bc1 |
69 | |
70 | //! Computes the point of parameter U on the curve with its |
71 | //! first derivative. |
72 | //! Raised if the continuity of the current interval |
73 | //! is not C1. |
c22b52d6 |
74 | static void D1 (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V); |
42cf5bc1 |
75 | |
76 | |
77 | //! Returns the point P of parameter U, the first and second |
78 | //! derivatives V1 and V2. |
79 | //! Raised if the continuity of the current interval |
80 | //! is not C2. |
c22b52d6 |
81 | static void D2 (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2); |
42cf5bc1 |
82 | |
83 | |
84 | //! Returns the point P of parameter U, the first, the second |
85 | //! and the third derivative. |
86 | //! Raised if the continuity of the current interval |
87 | //! is not C3. |
c22b52d6 |
88 | static void D3 (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3); |
42cf5bc1 |
89 | |
90 | |
91 | //! The returned vector gives the value of the derivative for the |
92 | //! order of derivation N. |
93 | //! Raised if the continuity of the current interval |
94 | //! is not CN. |
95 | //! Raised if N < 1. |
c22b52d6 |
96 | static gp_Vec2d DN (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U, const Standard_Integer N); |
42cf5bc1 |
97 | |
98 | //! Returns the parametric resolution corresponding |
99 | //! to the real space resolution <R3d>. |
c22b52d6 |
100 | static Standard_Real Resolution (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real R3d); |
42cf5bc1 |
101 | |
102 | //! Returns the type of the curve in the current |
103 | //! interval : Line, Circle, Ellipse, Hyperbola, |
104 | //! Parabola, BezierCurve, BSplineCurve, OtherCurve. |
c22b52d6 |
105 | static GeomAbs_CurveType GetType (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
106 | |
c22b52d6 |
107 | static gp_Lin2d Line (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
108 | |
c22b52d6 |
109 | static gp_Circ2d Circle (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
110 | |
c22b52d6 |
111 | static gp_Elips2d Ellipse (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
112 | |
c22b52d6 |
113 | static gp_Hypr2d Hyperbola (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
114 | |
c22b52d6 |
115 | static gp_Parab2d Parabola (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
116 | |
c22b52d6 |
117 | static Handle(Geom2d_BezierCurve) Bezier (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
118 | |
c22b52d6 |
119 | static Handle(Geom2d_BSplineCurve) BSpline (const Handle(Adaptor2d_Curve2d)& C); |
42cf5bc1 |
120 | |
c22b52d6 |
121 | Standard_EXPORT static Standard_Integer NbSamples (const Handle(Adaptor2d_Curve2d)& C, const Standard_Real U0, const Standard_Real U1); |
42cf5bc1 |
122 | |
123 | |
124 | |
125 | |
126 | protected: |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | private: |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | }; |
139 | |
140 | |
141 | #include <BRepBlend_HCurve2dTool.lxx> |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | #endif // _BRepBlend_HCurve2dTool_HeaderFile |