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