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