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