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