1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _Convert_CompBezierCurvesToBSplineCurve_HeaderFile
#define _Convert_CompBezierCurvesToBSplineCurve_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Convert_SequenceOfArray1OfPoles_HeaderFile
#include <Convert_SequenceOfArray1OfPoles.hxx>
#endif
#ifndef _TColgp_SequenceOfPnt_HeaderFile
#include <TColgp_SequenceOfPnt.hxx>
#endif
#ifndef _TColStd_SequenceOfReal_HeaderFile
#include <TColStd_SequenceOfReal.hxx>
#endif
#ifndef _TColStd_SequenceOfInteger_HeaderFile
#include <TColStd_SequenceOfInteger.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Standard_ConstructionError;
class TColgp_Array1OfPnt;
class TColStd_Array1OfReal;
class TColStd_Array1OfInteger;
//! An algorithm to convert a sequence of adjacent <br>
//! non-rational Bezier curves into a BSpline curve. <br>
//! A CompBezierCurvesToBSplineCurve object provides a framework for: <br>
//! - defining the sequence of adjacent non-rational Bezier <br>
//! curves to be converted into a BSpline curve, <br>
//! - implementing the computation algorithm, and <br>
//! - consulting the results. <br>
//! Warning <br>
//! Do not attempt to convert rational Bezier curves using this type of algorithm. <br>
class Convert_CompBezierCurvesToBSplineCurve {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Constructs a framework for converting a sequence of <br>
//! adjacent non-rational Bezier curves into a BSpline curve. <br>
//! Knots will be created on the computed BSpline curve at <br>
//! each junction point of two consecutive Bezier curves. The <br>
//! degree of continuity of the BSpline curve will be increased at <br>
//! the junction point of two consecutive Bezier curves if their <br>
//! tangent vectors at this point are parallel. AngularTolerance <br>
//! (given in radians, and defaulted to 1.0 e-4) will be used <br>
//! to check the parallelism of the two tangent vectors. <br>
//! Use the following functions: <br>
//! - AddCurve to define in sequence the adjacent Bezier <br>
//! curves to be converted, <br>
//! - Perform to compute the data needed to build the BSpline curve, <br>
//! - and the available consultation functions to access the <br>
//! computed data. This data may be used to construct the BSpline curve. <br>
Standard_EXPORT Convert_CompBezierCurvesToBSplineCurve(const Standard_Real AngularTolerance = 1.0e-4);
//! Adds the Bezier curve defined by the table of poles Poles, to <br>
//! the sequence (still contained in this framework) of adjacent <br>
//! Bezier curves to be converted into a BSpline curve. <br>
//! Only polynomial (i.e. non-rational) Bezier curves are <br>
//! converted using this framework. <br>
//! If this is not the first call to the function (i.e. if this framework <br>
//! still contains data in its Bezier curve sequence), the degree <br>
//! of continuity of the BSpline curve will be increased at the <br>
//! time of computation at the first point of the added Bezier <br>
//! curve (i.e. the first point of the Poles table). This will be the <br>
//! case if the tangent vector of the curve at this point is <br>
//! parallel to the tangent vector at the end point of the <br>
//! preceding Bezier curve in the Bezier curve sequence still <br>
//! contained in this framework. An angular tolerance given at <br>
//! the time of construction of this framework will be used to <br>
//! check the parallelism of the two tangent vectors. This <br>
//! checking procedure and all related computations will be <br>
//! performed by the Perform function. <br>
//! When the adjacent Bezier curve sequence is complete, use <br>
//! the following functions: <br>
//! - Perform to compute the data needed to build the BSpline curve, <br>
//! - and the available consultation functions to access the <br>
//! computed data. This data may be used to construct the BSpline curve. <br>
//! Warning <br>
//! The Bezier curve sequence treated by this framework is <br>
//! automatically initialized with the first Bezier curve when the <br>
//! function is first called. During subsequent use of this function, <br>
//! ensure that the first point of the added Bezier curve (i.e. the <br>
//! first point of the Poles table) is coincident with the last point <br>
//! of the Bezier curve sequence (i.e. the last point of the <br>
//! preceding Bezier curve in the sequence) still contained in <br>
//! this framework. An error may occur at the time of <br>
//! computation if this condition is not satisfied. Particular care <br>
//! must be taken with respect to the above, as this condition is <br>
//! not checked either when defining the Bezier curve <br>
//! sequence or at the time of computation. <br>
Standard_EXPORT void AddCurve(const TColgp_Array1OfPnt& Poles) ;
//! Computes all the data needed to build a BSpline curve <br>
//! equivalent to the adjacent Bezier curve sequence still <br>
//! contained in this framework. <br>
//! A knot is inserted on the computed BSpline curve at the <br>
//! junction point of two consecutive Bezier curves. The <br>
//! degree of continuity of the BSpline curve will be increased <br>
//! at the junction point of two consecutive Bezier curves if <br>
//! their tangent vectors at this point are parallel. An angular <br>
//! tolerance given at the time of construction of this <br>
//! framework is used to check the parallelism of the two <br>
//! tangent vectors. <br>
//! Use the available consultation functions to access the <br>
//! computed data. This data may then be used to construct <br>
//! the BSpline curve. <br>
//! Warning <br>
//! Make sure that the curves in the Bezier curve sequence <br>
//! contained in this framework are adjacent. An error may <br>
//! occur at the time of computation if this condition is not <br>
//! satisfied. Particular care must be taken with respect to the <br>
//! above as this condition is not checked, either when <br>
//! defining the Bezier curve sequence or at the time of computation. <br>
Standard_EXPORT void Perform() ;
//! Returns the degree of the BSpline curve whose data is <br>
//! computed in this framework. <br>
//! Warning <br>
//! Take particular care not to use this function before the <br>
//! computation is performed (Perform function), as this <br>
//! condition is not checked and an error may therefore occur. <br>
Standard_EXPORT Standard_Integer Degree() const;
//! Returns the number of poles of the BSpline curve whose <br>
//! data is computed in this framework. <br>
//! Warning <br>
//! Take particular care not to use this function before the <br>
//! computation is performed (Perform function), as this <br>
//! condition is not checked and an error may therefore occur. <br>
Standard_EXPORT Standard_Integer NbPoles() const;
//! Loads the Poles table with the poles of the BSpline curve <br>
//! whose data is computed in this framework. <br>
//! Warning <br>
//! - Do not use this function before the computation is <br>
//! performed (Perform function). <br>
//! - The length of the Poles array must be equal to the <br>
//! number of poles of the BSpline curve whose data is <br>
//! computed in this framework. <br>
//! Particular care must be taken with respect to the above, as <br>
//! these conditions are not checked, and an error may occur. <br>
Standard_EXPORT void Poles(TColgp_Array1OfPnt& Poles) const;
//! Returns the number of knots of the BSpline curve whose <br>
//! data is computed in this framework. <br>
//! Warning <br>
//! Take particular care not to use this function before the <br>
//! computation is performed (Perform function), as this <br>
//! condition is not checked and an error may therefore occur. <br>
Standard_EXPORT Standard_Integer NbKnots() const;
//! - loads the Knots table with the knots, <br>
//! - and loads the Mults table with the corresponding multiplicities <br>
//! of the BSpline curve whose data is computed in this framework. <br>
//! Warning <br>
//! - Do not use this function before the computation is <br>
//! performed (Perform function). <br>
//! - The length of the Knots and Mults arrays must be equal <br>
//! to the number of knots in the BSpline curve whose data is <br>
//! computed in this framework. <br>
//! Particular care must be taken with respect to the above as <br>
//! these conditions are not checked, and an error may occur. <br>
Standard_EXPORT void KnotsAndMults(TColStd_Array1OfReal& Knots,TColStd_Array1OfInteger& Mults) const;
protected:
private:
Convert_SequenceOfArray1OfPoles mySequence;
TColgp_SequenceOfPnt CurvePoles;
TColStd_SequenceOfReal CurveKnots;
TColStd_SequenceOfInteger KnotsMultiplicities;
Standard_Integer myDegree;
Standard_Real myAngular;
Standard_Boolean myDone;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif
|