42cf5bc1 |
1 | // Created on: 1993-02-19 |
2 | // Created by: Remi LEQUETTE |
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 _BRepAdaptor_Curve_HeaderFile |
18 | #define _BRepAdaptor_Curve_HeaderFile |
19 | |
c22b52d6 |
20 | #include <Adaptor3d_CurveOnSurface.hxx> |
42cf5bc1 |
21 | #include <gp_Trsf.hxx> |
22 | #include <GeomAdaptor_Curve.hxx> |
23 | #include <TopoDS_Edge.hxx> |
24 | #include <Adaptor3d_Curve.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <GeomAbs_Shape.hxx> |
28 | #include <Standard_Integer.hxx> |
29 | #include <TColStd_Array1OfReal.hxx> |
30 | #include <GeomAbs_CurveType.hxx> |
c22b52d6 |
31 | |
42cf5bc1 |
32 | class TopoDS_Face; |
42cf5bc1 |
33 | class Adaptor3d_CurveOnSurface; |
42cf5bc1 |
34 | class gp_Pnt; |
35 | class gp_Vec; |
36 | class gp_Lin; |
37 | class gp_Circ; |
38 | class gp_Elips; |
39 | class gp_Hypr; |
40 | class gp_Parab; |
41 | class Geom_BezierCurve; |
42 | class Geom_BSplineCurve; |
f4dee9bb |
43 | class Geom_OffsetCurve; |
42cf5bc1 |
44 | |
c22b52d6 |
45 | DEFINE_STANDARD_HANDLE(BRepAdaptor_Curve, Adaptor3d_Curve) |
42cf5bc1 |
46 | |
47 | //! The Curve from BRepAdaptor allows to use an Edge |
48 | //! of the BRep topology like a 3D curve. |
49 | //! |
50 | //! It has the methods the class Curve from Adaptor3d. |
51 | //! |
52 | //! It is created or Initialized with an Edge. It |
53 | //! takes into account local coordinate systems. If |
54 | //! the Edge has a 3D curve it is use with priority. |
55 | //! If the edge has no 3D curve one of the curves on |
56 | //! surface is used. It is possible to enforce using a |
57 | //! curve on surface by creating or initialising with |
58 | //! an Edge and a Face. |
59 | class BRepAdaptor_Curve : public Adaptor3d_Curve |
60 | { |
c22b52d6 |
61 | DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Curve, Adaptor3d_Curve) |
42cf5bc1 |
62 | public: |
63 | |
42cf5bc1 |
64 | //! Creates an undefined Curve with no Edge loaded. |
65 | Standard_EXPORT BRepAdaptor_Curve(); |
66 | |
54adc5e9 |
67 | //! Creates a Curve to access the geometry of edge |
42cf5bc1 |
68 | //! <E>. |
69 | Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E); |
70 | |
54adc5e9 |
71 | //! Creates a Curve to access the geometry of edge |
42cf5bc1 |
72 | //! <E>. The geometry will be computed using the |
73 | //! parametric curve of <E> on the face <F>. An Error |
74 | //! is raised if the edge does not have a pcurve on |
75 | //! the face. |
76 | Standard_EXPORT BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F); |
4ba5491a |
77 | |
872a7e3a |
78 | //! Shallow copy of adaptor |
79 | Standard_EXPORT virtual Handle(Adaptor3d_Curve) ShallowCopy() const Standard_OVERRIDE; |
80 | |
4ba5491a |
81 | //! Reset currently loaded curve (undone Load()). |
82 | Standard_EXPORT void Reset(); |
83 | |
54adc5e9 |
84 | //! Sets the Curve <me> to access the geometry of |
42cf5bc1 |
85 | //! edge <E>. |
86 | Standard_EXPORT void Initialize (const TopoDS_Edge& E); |
87 | |
54adc5e9 |
88 | //! Sets the Curve <me> to access the geometry of |
42cf5bc1 |
89 | //! edge <E>. The geometry will be computed using the |
90 | //! parametric curve of <E> on the face <F>. An Error |
91 | //! is raised if the edge does not have a pcurve on |
92 | //! the face. |
93 | Standard_EXPORT void Initialize (const TopoDS_Edge& E, const TopoDS_Face& F); |
94 | |
95 | //! Returns the coordinate system of the curve. |
96 | Standard_EXPORT const gp_Trsf& Trsf() const; |
97 | |
98 | //! Returns True if the edge geometry is computed from |
99 | //! a 3D curve. |
100 | Standard_EXPORT Standard_Boolean Is3DCurve() const; |
101 | |
102 | //! Returns True if the edge geometry is computed from |
103 | //! a pcurve on a surface. |
104 | Standard_EXPORT Standard_Boolean IsCurveOnSurface() const; |
105 | |
106 | //! Returns the Curve of the edge. |
107 | Standard_EXPORT const GeomAdaptor_Curve& Curve() const; |
108 | |
109 | //! Returns the CurveOnSurface of the edge. |
110 | Standard_EXPORT const Adaptor3d_CurveOnSurface& CurveOnSurface() const; |
111 | |
112 | //! Returns the edge. |
113 | Standard_EXPORT const TopoDS_Edge& Edge() const; |
114 | |
115 | //! Returns the edge tolerance. |
116 | Standard_EXPORT Standard_Real Tolerance() const; |
117 | |
118 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
119 | |
120 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
121 | |
122 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; |
123 | |
124 | //! Returns the number of intervals for continuity |
125 | //! <S>. May be one if Continuity(me) >= <S> |
126 | Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; |
127 | |
128 | //! Stores in <T> the parameters bounding the intervals |
129 | //! of continuity <S>. |
130 | //! |
21c7c457 |
131 | //! The array must provide enough room to accommodate |
42cf5bc1 |
132 | //! for the parameters. i.e. T.Length() > NbIntervals() |
133 | Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; |
134 | |
135 | //! Returns a curve equivalent of <me> between |
136 | //! parameters <First> and <Last>. <Tol> is used to |
137 | //! test for 3d points confusion. |
138 | //! If <First> >= <Last> |
c22b52d6 |
139 | Standard_EXPORT Handle(Adaptor3d_Curve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE; |
42cf5bc1 |
140 | |
141 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
142 | |
143 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
144 | |
145 | Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; |
146 | |
147 | //! Computes the point of parameter U on the curve |
148 | Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE; |
149 | |
150 | //! Computes the point of parameter U. |
151 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; |
152 | |
153 | //! Computes the point of parameter U on the curve |
154 | //! with its first derivative. |
155 | //! Raised if the continuity of the current interval |
156 | //! is not C1. |
157 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; |
158 | |
159 | |
160 | //! Returns the point P of parameter U, the first and second |
161 | //! derivatives V1 and V2. |
162 | //! Raised if the continuity of the current interval |
163 | //! is not C2. |
164 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE; |
165 | |
166 | |
167 | //! Returns the point P of parameter U, the first, the second |
168 | //! and the third derivative. |
169 | //! Raised if the continuity of the current interval |
170 | //! is not C3. |
171 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE; |
172 | |
173 | |
174 | //! The returned vector gives the value of the derivative for the |
175 | //! order of derivation N. |
176 | //! Raised if the continuity of the current interval |
177 | //! is not CN. |
178 | //! Raised if N < 1. |
179 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
180 | |
181 | //! returns the parametric resolution |
182 | Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE; |
183 | |
184 | Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; |
185 | |
186 | Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; |
187 | |
188 | Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; |
189 | |
190 | Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; |
191 | |
192 | Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; |
193 | |
194 | Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; |
195 | |
196 | Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; |
197 | |
198 | Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; |
199 | |
200 | Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; |
201 | |
202 | Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; |
203 | |
204 | |
b81b237f |
205 | //! Warning: |
206 | //! This will make a copy of the Bezier Curve since it applies to it myTsrf. |
207 | //! Be careful when using this method. |
42cf5bc1 |
208 | Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; |
209 | |
210 | |
b81b237f |
211 | //! Warning: |
212 | //! This will make a copy of the BSpline Curve since it applies to it myTsrf. |
213 | //! Be careful when using this method. |
42cf5bc1 |
214 | Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; |
215 | |
f4dee9bb |
216 | Standard_EXPORT Handle(Geom_OffsetCurve) OffsetCurve() const Standard_OVERRIDE; |
42cf5bc1 |
217 | |
42cf5bc1 |
218 | private: |
219 | |
42cf5bc1 |
220 | gp_Trsf myTrsf; |
221 | GeomAdaptor_Curve myCurve; |
c22b52d6 |
222 | Handle(Adaptor3d_CurveOnSurface) myConSurf; |
42cf5bc1 |
223 | TopoDS_Edge myEdge; |
224 | |
42cf5bc1 |
225 | }; |
226 | |
42cf5bc1 |
227 | #endif // _BRepAdaptor_Curve_HeaderFile |