Commit | Line | Data |
---|---|---|
42cf5bc1 | 1 | // Created on: 1998-08-20 |
2 | // Created by: Philippe MANGIN | |
3 | // Copyright (c) 1998-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_CompCurve_HeaderFile | |
18 | #define _BRepAdaptor_CompCurve_HeaderFile | |
19 | ||
20 | #include <Standard.hxx> | |
21 | #include <Standard_DefineAlloc.hxx> | |
22 | #include <Standard_Handle.hxx> | |
23 | ||
24 | #include <TopoDS_Wire.hxx> | |
25 | #include <Standard_Real.hxx> | |
26 | #include <BRepAdaptor_HArray1OfCurve.hxx> | |
27 | #include <TColStd_HArray1OfReal.hxx> | |
28 | #include <Standard_Integer.hxx> | |
29 | #include <Standard_Boolean.hxx> | |
30 | #include <Adaptor3d_Curve.hxx> | |
31 | #include <GeomAbs_Shape.hxx> | |
32 | #include <TColStd_Array1OfReal.hxx> | |
33 | #include <GeomAbs_CurveType.hxx> | |
34 | class Standard_NullObject; | |
35 | class Standard_DomainError; | |
36 | class Standard_OutOfRange; | |
37 | class Standard_NoSuchObject; | |
38 | class TopoDS_Wire; | |
39 | class TopoDS_Edge; | |
40 | class Adaptor3d_HCurve; | |
41 | class gp_Pnt; | |
42 | class gp_Vec; | |
43 | class gp_Lin; | |
44 | class gp_Circ; | |
45 | class gp_Elips; | |
46 | class gp_Hypr; | |
47 | class gp_Parab; | |
48 | class Geom_BezierCurve; | |
49 | class Geom_BSplineCurve; | |
50 | ||
51 | ||
52 | //! The Curve from BRepAdaptor allows to use a Wire | |
53 | //! of the BRep topology like a 3D curve. | |
54 | //! Warning: With this class of curve, C0 and C1 continuities | |
340549b0 | 55 | //! are not assumed. So be careful with some algorithm! |
f24150b8 | 56 | //! Please note that BRepAdaptor_CompCurve cannot be |
57 | //! periodic curve at all (even if it contains single | |
58 | //! periodic edge). | |
340549b0 BB |
59 | //! |
60 | //! BRepAdaptor_CompCurve can only work on valid wires where all edges are | |
61 | //! connected to each other to make a chain. | |
42cf5bc1 | 62 | class BRepAdaptor_CompCurve : public Adaptor3d_Curve |
63 | { | |
64 | public: | |
65 | ||
66 | DEFINE_STANDARD_ALLOC | |
67 | ||
68 | ||
69 | //! Creates an undefined Curve with no Wire loaded. | |
70 | Standard_EXPORT BRepAdaptor_CompCurve(); | |
71 | ||
72 | Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa = Standard_False); | |
73 | ||
74 | //! Creates a Curve to acces to the geometry of edge | |
75 | //! <W>. | |
76 | Standard_EXPORT BRepAdaptor_CompCurve(const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol); | |
77 | ||
78 | //! Sets the wire <W>. | |
79 | Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa); | |
80 | ||
81 | //! Sets wire <W> and trimmed parameter. | |
82 | Standard_EXPORT void Initialize (const TopoDS_Wire& W, const Standard_Boolean KnotByCurvilinearAbcissa, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol); | |
83 | ||
42cf5bc1 | 84 | //! Returns the wire. |
85 | Standard_EXPORT const TopoDS_Wire& Wire() const; | |
86 | ||
87 | //! returns an edge and one parameter on them | |
88 | //! corresponding to the parameter U. | |
89 | Standard_EXPORT void Edge (const Standard_Real U, TopoDS_Edge& E, Standard_Real& UonE) const; | |
90 | ||
91 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; | |
92 | ||
93 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; | |
94 | ||
95 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; | |
96 | ||
97 | //! Returns the number of intervals for continuity | |
98 | //! <S>. May be one if Continuity(me) >= <S> | |
99 | Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE; | |
100 | ||
101 | //! Stores in <T> the parameters bounding the intervals | |
102 | //! of continuity <S>. | |
103 | //! | |
21c7c457 | 104 | //! The array must provide enough room to accommodate |
42cf5bc1 | 105 | //! for the parameters. i.e. T.Length() > NbIntervals() |
106 | Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE; | |
107 | ||
108 | //! Returns a curve equivalent of <me> between | |
109 | //! parameters <First> and <Last>. <Tol> is used to | |
110 | //! test for 3d points confusion. | |
111 | //! If <First> >= <Last> | |
112 | Standard_EXPORT Handle(Adaptor3d_HCurve) Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE; | |
113 | ||
114 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; | |
115 | ||
116 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; | |
117 | ||
118 | Standard_EXPORT Standard_Real Period() const Standard_OVERRIDE; | |
119 | ||
120 | //! Computes the point of parameter U on the curve | |
121 | Standard_EXPORT gp_Pnt Value (const Standard_Real U) const Standard_OVERRIDE; | |
122 | ||
123 | //! Computes the point of parameter U. | |
124 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE; | |
125 | ||
126 | //! Computes the point of parameter U on the curve | |
127 | //! with its first derivative. | |
128 | //! Raised if the continuity of the current interval | |
129 | //! is not C1. | |
130 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V) const Standard_OVERRIDE; | |
131 | ||
132 | ||
133 | //! Returns the point P of parameter U, the first and second | |
134 | //! derivatives V1 and V2. | |
135 | //! Raised if the continuity of the current interval | |
136 | //! is not C2. | |
137 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE; | |
138 | ||
139 | ||
140 | //! Returns the point P of parameter U, the first, the second | |
141 | //! and the third derivative. | |
142 | //! Raised if the continuity of the current interval | |
143 | //! is not C3. | |
144 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE; | |
145 | ||
146 | ||
147 | //! The returned vector gives the value of the derivative for the | |
148 | //! order of derivation N. | |
149 | //! Raised if the continuity of the current interval | |
150 | //! is not CN. | |
151 | //! Raised if N < 1. | |
152 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; | |
153 | ||
154 | //! returns the parametric resolution | |
155 | Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const Standard_OVERRIDE; | |
156 | ||
157 | Standard_EXPORT GeomAbs_CurveType GetType() const Standard_OVERRIDE; | |
158 | ||
159 | Standard_EXPORT gp_Lin Line() const Standard_OVERRIDE; | |
160 | ||
161 | Standard_EXPORT gp_Circ Circle() const Standard_OVERRIDE; | |
162 | ||
163 | Standard_EXPORT gp_Elips Ellipse() const Standard_OVERRIDE; | |
164 | ||
165 | Standard_EXPORT gp_Hypr Hyperbola() const Standard_OVERRIDE; | |
166 | ||
167 | Standard_EXPORT gp_Parab Parabola() const Standard_OVERRIDE; | |
168 | ||
169 | Standard_EXPORT Standard_Integer Degree() const Standard_OVERRIDE; | |
170 | ||
171 | Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE; | |
172 | ||
173 | Standard_EXPORT Standard_Integer NbPoles() const Standard_OVERRIDE; | |
174 | ||
175 | Standard_EXPORT Standard_Integer NbKnots() const Standard_OVERRIDE; | |
176 | ||
177 | Standard_EXPORT Handle(Geom_BezierCurve) Bezier() const Standard_OVERRIDE; | |
178 | ||
179 | Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE; | |
180 | ||
181 | ||
182 | ||
183 | ||
184 | protected: | |
185 | ||
186 | ||
187 | ||
188 | ||
189 | ||
190 | private: | |
191 | ||
192 | ||
193 | Standard_EXPORT void Prepare (Standard_Real& W, Standard_Real& D, Standard_Integer& ind) const; | |
194 | ||
195 | Standard_EXPORT void InvPrepare (const Standard_Integer ind, Standard_Real& F, Standard_Real& D) const; | |
196 | ||
197 | ||
198 | TopoDS_Wire myWire; | |
199 | Standard_Real TFirst; | |
200 | Standard_Real TLast; | |
201 | Standard_Real PTol; | |
42cf5bc1 | 202 | Handle(BRepAdaptor_HArray1OfCurve) myCurves; |
203 | Handle(TColStd_HArray1OfReal) myKnots; | |
204 | Standard_Integer CurIndex; | |
205 | Standard_Boolean Forward; | |
206 | Standard_Boolean IsbyAC; | |
42cf5bc1 | 207 | }; |
208 | ||
209 | ||
210 | ||
211 | ||
212 | ||
213 | ||
214 | ||
215 | #endif // _BRepAdaptor_CompCurve_HeaderFile |