Commit | Line | Data |
---|---|---|
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. | |
34e4e9f2 BB |
52 | //! |
53 | //! Polynomial coefficients of BSpline curves used for their evaluation are | |
54 | //! cached for better performance. Therefore these evaluations are not | |
55 | //! thread-safe and parallel evaluations need to be prevented. | |
42cf5bc1 | 56 | class Adaptor2d_Curve2d |
57 | { | |
58 | public: | |
59 | ||
60 | DEFINE_STANDARD_ALLOC | |
61 | ||
62 | ||
63 | Standard_EXPORT virtual Standard_Real FirstParameter() const; | |
64 | ||
65 | Standard_EXPORT virtual Standard_Real LastParameter() const; | |
66 | ||
67 | Standard_EXPORT virtual GeomAbs_Shape Continuity() const; | |
68 | ||
69 | //! If necessary, breaks the curve in intervals of | |
70 | //! continuity <S>. And returns the number of | |
71 | //! intervals. | |
72 | Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const; | |
73 | ||
74 | //! Stores in <T> the parameters bounding the intervals | |
75 | //! of continuity <S>. | |
76 | //! | |
21c7c457 | 77 | //! The array must provide enough room to accommodate |
42cf5bc1 | 78 | //! for the parameters. i.e. T.Length() > NbIntervals() |
79 | Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; | |
80 | ||
81 | //! Returns a curve equivalent of <me> between | |
82 | //! parameters <First> and <Last>. <Tol> is used to | |
83 | //! test for 3d points confusion. | |
84 | //! If <First> >= <Last> | |
85 | Standard_EXPORT virtual Handle(Adaptor2d_HCurve2d) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const; | |
86 | ||
87 | Standard_EXPORT virtual Standard_Boolean IsClosed() const; | |
88 | ||
89 | Standard_EXPORT virtual Standard_Boolean IsPeriodic() const; | |
90 | ||
91 | Standard_EXPORT virtual Standard_Real Period() const; | |
92 | ||
93 | //! Computes the point of parameter U on the curve. | |
94 | Standard_EXPORT virtual gp_Pnt2d Value (const Standard_Real U) const; | |
95 | ||
96 | //! Computes the point of parameter U on the curve. | |
97 | Standard_EXPORT virtual void D0 (const Standard_Real U, gp_Pnt2d& P) const; | |
98 | ||
99 | //! Computes the point of parameter U on the curve with its | |
100 | //! first derivative. | |
101 | //! Raised if the continuity of the current interval | |
102 | //! is not C1. | |
103 | Standard_EXPORT virtual void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const; | |
104 | ||
105 | ||
106 | //! Returns the point P of parameter U, the first and second | |
107 | //! derivatives V1 and V2. | |
108 | //! Raised if the continuity of the current interval | |
109 | //! is not C2. | |
110 | Standard_EXPORT virtual void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const; | |
111 | ||
112 | ||
113 | //! Returns the point P of parameter U, the first, the second | |
114 | //! and the third derivative. | |
115 | //! Raised if the continuity of the current interval | |
116 | //! is not C3. | |
117 | Standard_EXPORT virtual void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const; | |
118 | ||
119 | ||
120 | //! The returned vector gives the value of the derivative for the | |
121 | //! order of derivation N. | |
122 | //! Raised if the continuity of the current interval | |
123 | //! is not CN. | |
124 | //! Raised if N < 1. | |
125 | Standard_EXPORT virtual gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const; | |
126 | ||
127 | //! Returns the parametric resolution corresponding | |
128 | //! to the real space resolution <R3d>. | |
129 | Standard_EXPORT virtual Standard_Real Resolution (const Standard_Real R3d) const; | |
130 | ||
131 | //! Returns the type of the curve in the current | |
132 | //! interval : Line, Circle, Ellipse, Hyperbola, | |
133 | //! Parabola, BezierCurve, BSplineCurve, OtherCurve. | |
134 | Standard_EXPORT virtual GeomAbs_CurveType GetType() const; | |
135 | ||
136 | Standard_EXPORT virtual gp_Lin2d Line() const; | |
137 | ||
138 | Standard_EXPORT virtual gp_Circ2d Circle() const; | |
139 | ||
140 | Standard_EXPORT virtual gp_Elips2d Ellipse() const; | |
141 | ||
142 | Standard_EXPORT virtual gp_Hypr2d Hyperbola() const; | |
143 | ||
144 | Standard_EXPORT virtual gp_Parab2d Parabola() const; | |
145 | ||
146 | Standard_EXPORT virtual Standard_Integer Degree() const; | |
147 | ||
148 | Standard_EXPORT virtual Standard_Boolean IsRational() const; | |
149 | ||
150 | Standard_EXPORT virtual Standard_Integer NbPoles() const; | |
151 | ||
152 | Standard_EXPORT virtual Standard_Integer NbKnots() const; | |
153 | ||
154 | Standard_EXPORT virtual Standard_Integer NbSamples() const; | |
155 | ||
156 | Standard_EXPORT virtual Handle(Geom2d_BezierCurve) Bezier() const; | |
157 | ||
158 | Standard_EXPORT virtual Handle(Geom2d_BSplineCurve) BSpline() const; | |
159 | Standard_EXPORT virtual ~Adaptor2d_Curve2d(); | |
160 | ||
161 | ||
162 | ||
163 | ||
164 | protected: | |
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 | private: | |
171 | ||
172 | ||
173 | ||
174 | ||
175 | ||
176 | }; | |
177 | ||
178 | ||
179 | ||
180 | ||
181 | ||
182 | ||
183 | ||
184 | #endif // _Adaptor2d_Curve2d_HeaderFile |