42cf5bc1 |
1 | // Created on: 1993-04-02 |
2 | // Created by: Bruno DUMORTIER |
3 | // Copyright (c) 1993-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 _Adaptor2d_Curve2d_HeaderFile |
18 | #define _Adaptor2d_Curve2d_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 <GeomAbs_CurveType.hxx> |
30 | class Standard_OutOfRange; |
31 | class Standard_NoSuchObject; |
32 | class Standard_DomainError; |
33 | class Adaptor2d_HCurve2d; |
34 | class gp_Pnt2d; |
35 | class gp_Vec2d; |
36 | class gp_Lin2d; |
37 | class gp_Circ2d; |
38 | class gp_Elips2d; |
39 | class gp_Hypr2d; |
40 | class gp_Parab2d; |
41 | class Geom2d_BezierCurve; |
42 | class Geom2d_BSplineCurve; |
43 | |
44 | |
45 | //! Root class for 2D curves on which geometric |
46 | //! algorithms work. |
47 | //! An adapted curve is an interface between the |
48 | //! services provided by a curve, and those required of |
49 | //! the curve by algorithms, which use it. |
50 | //! A derived concrete class is provided: |
51 | //! Geom2dAdaptor_Curve for a curve from the Geom2d package. |
52 | class Adaptor2d_Curve2d |
53 | { |
54 | public: |
55 | |
56 | DEFINE_STANDARD_ALLOC |
57 | |
58 | |
59 | Standard_EXPORT virtual Standard_Real FirstParameter() const; |
60 | |
61 | Standard_EXPORT virtual Standard_Real LastParameter() const; |
62 | |
63 | Standard_EXPORT virtual GeomAbs_Shape Continuity() const; |
64 | |
65 | //! If necessary, breaks the curve in intervals of |
66 | //! continuity <S>. And returns the number of |
67 | //! intervals. |
68 | Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const; |
69 | |
70 | //! Stores in <T> the parameters bounding the intervals |
71 | //! of continuity <S>. |
72 | //! |
73 | //! The array must provide enough room to accomodate |
74 | //! for the parameters. i.e. T.Length() > NbIntervals() |
75 | Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; |
76 | |
77 | //! Returns a curve equivalent of <me> between |
78 | //! parameters <First> and <Last>. <Tol> is used to |
79 | //! test for 3d points confusion. |
80 | //! If <First> >= <Last> |
81 | Standard_EXPORT virtual Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const; |
82 | |
83 | Standard_EXPORT virtual Standard_Boolean IsClosed() const; |
84 | |
85 | Standard_EXPORT virtual Standard_Boolean IsPeriodic() const; |
86 | |
87 | Standard_EXPORT virtual Standard_Real Period() const; |
88 | |
89 | //! Computes the point of parameter U on the curve. |
90 | Standard_EXPORT virtual gp_Pnt2d Value (const Standard_Real U) const; |
91 | |
92 | //! Computes the point of parameter U on the curve. |
93 | Standard_EXPORT virtual void D0 (const Standard_Real U, gp_Pnt2d& P) const; |
94 | |
95 | //! Computes the point of parameter U on the curve with its |
96 | //! first derivative. |
97 | //! Raised if the continuity of the current interval |
98 | //! is not C1. |
99 | Standard_EXPORT virtual void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const; |
100 | |
101 | |
102 | //! Returns the point P of parameter U, the first and second |
103 | //! derivatives V1 and V2. |
104 | //! Raised if the continuity of the current interval |
105 | //! is not C2. |
106 | Standard_EXPORT virtual void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const; |
107 | |
108 | |
109 | //! Returns the point P of parameter U, the first, the second |
110 | //! and the third derivative. |
111 | //! Raised if the continuity of the current interval |
112 | //! is not C3. |
113 | Standard_EXPORT virtual void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const; |
114 | |
115 | |
116 | //! The returned vector gives the value of the derivative for the |
117 | //! order of derivation N. |
118 | //! Raised if the continuity of the current interval |
119 | //! is not CN. |
120 | //! Raised if N < 1. |
121 | Standard_EXPORT virtual gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const; |
122 | |
123 | //! Returns the parametric resolution corresponding |
124 | //! to the real space resolution <R3d>. |
125 | Standard_EXPORT virtual Standard_Real Resolution (const Standard_Real R3d) const; |
126 | |
127 | //! Returns the type of the curve in the current |
128 | //! interval : Line, Circle, Ellipse, Hyperbola, |
129 | //! Parabola, BezierCurve, BSplineCurve, OtherCurve. |
130 | Standard_EXPORT virtual GeomAbs_CurveType GetType() const; |
131 | |
132 | Standard_EXPORT virtual gp_Lin2d Line() const; |
133 | |
134 | Standard_EXPORT virtual gp_Circ2d Circle() const; |
135 | |
136 | Standard_EXPORT virtual gp_Elips2d Ellipse() const; |
137 | |
138 | Standard_EXPORT virtual gp_Hypr2d Hyperbola() const; |
139 | |
140 | Standard_EXPORT virtual gp_Parab2d Parabola() const; |
141 | |
142 | Standard_EXPORT virtual Standard_Integer Degree() const; |
143 | |
144 | Standard_EXPORT virtual Standard_Boolean IsRational() const; |
145 | |
146 | Standard_EXPORT virtual Standard_Integer NbPoles() const; |
147 | |
148 | Standard_EXPORT virtual Standard_Integer NbKnots() const; |
149 | |
150 | Standard_EXPORT virtual Standard_Integer NbSamples() const; |
151 | |
152 | Standard_EXPORT virtual Handle(Geom2d_BezierCurve) Bezier() const; |
153 | |
154 | Standard_EXPORT virtual Handle(Geom2d_BSplineCurve) BSpline() const; |
155 | Standard_EXPORT virtual ~Adaptor2d_Curve2d(); |
156 | |
157 | |
158 | |
159 | |
160 | protected: |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | private: |
167 | |
168 | |
169 | |
170 | |
171 | |
172 | }; |
173 | |
174 | |
175 | |
176 | |
177 | |
178 | |
179 | |
180 | #endif // _Adaptor2d_Curve2d_HeaderFile |