1
<?xml version="1.0" encoding="UTF-8"?>
2
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
4
Name="BSplineCurve2dPy"
6
Twin="Geom2dBSplineCurve"
7
TwinPointer="Geom2dBSplineCurve"
8
PythonName="Part.Geom2d.BSplineCurve2d"
9
FatherInclude="Mod/Part/App/Geom2d/Curve2dPy.h"
10
Include="Mod/Part/App/Geometry2d.h"
12
FatherNamespace="Part"
15
<Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer@users.sourceforge.net"/>
16
<UserDocu>Describes a B-Spline curve in 3D space</UserDocu>
18
<Attribute Name="Degree" ReadOnly="true">
20
<UserDocu>Returns the polynomial degree of this B-Spline curve.</UserDocu>
22
<Parameter Name="Degree" Type="Long"/>
24
<Attribute Name="MaxDegree" ReadOnly="true">
26
<UserDocu>Returns the value of the maximum polynomial degree of any
27
B-Spline curve curve. This value is 25.</UserDocu>
29
<Parameter Name="MaxDegree" Type="Long"/>
31
<Attribute Name="NbPoles" ReadOnly="true">
33
<UserDocu>Returns the number of poles of this B-Spline curve.</UserDocu>
35
<Parameter Name="NbPoles" Type="Long"/>
37
<Attribute Name="NbKnots" ReadOnly="true">
39
<UserDocu>Returns the number of knots of this B-Spline curve.</UserDocu>
41
<Parameter Name="NbPoles" Type="Long"/>
43
<Attribute Name="StartPoint" ReadOnly="true">
45
<UserDocu>Returns the start point of this B-Spline curve.</UserDocu>
47
<Parameter Name="StartPoint" Type="Object"/>
49
<Attribute Name="EndPoint" ReadOnly="true">
51
<UserDocu>Returns the end point of this B-Spline curve.</UserDocu>
53
<Parameter Name="EndPoint" Type="Object"/>
55
<Attribute Name="FirstUKnotIndex" ReadOnly="true">
57
<UserDocu>Returns the index in the knot array of the knot
58
corresponding to the first or last parameter
59
of this B-Spline curve.</UserDocu>
61
<Parameter Name="FirstUKnotIndex" Type="Object"/>
63
<Attribute Name="LastUKnotIndex" ReadOnly="true">
65
<UserDocu>Returns the index in the knot array of the knot
66
corresponding to the first or last parameter
67
of this B-Spline curve.</UserDocu>
69
<Parameter Name="LastUKnotIndex" Type="Object"/>
71
<Attribute Name="KnotSequence" ReadOnly="true">
73
<UserDocu>Returns the knots sequence of this B-Spline curve.</UserDocu>
75
<Parameter Name="KnotSequence" Type="List"/>
77
<Methode Name="isRational">
79
<UserDocu>Returns true if this B-Spline curve is rational.
80
A B-Spline curve is rational if, at the time of construction,
81
the weight table has been initialized.</UserDocu>
84
<Methode Name="isPeriodic">
86
<UserDocu>Returns true if this BSpline curve is periodic.</UserDocu>
89
<Methode Name="isClosed">
91
<UserDocu>Returns true if the distance between the start point and end point of
92
this B-Spline curve is less than or equal to gp::Resolution().</UserDocu>
95
<Methode Name="increaseDegree">
97
<UserDocu>increase(Int=Degree)
98
Increases the degree of this B-Spline curve to Degree.
99
As a result, the poles, weights and multiplicities tables
100
are modified; the knots table is not changed. Nothing is
101
done if Degree is less than or equal to the current degree.</UserDocu>
104
<Methode Name="increaseMultiplicity">
106
<UserDocu>increaseMultiplicity(int index, int mult)
107
increaseMultiplicity(int start, int end, int mult)
108
Increases multiplicity of knots up to mult.
110
index: the index of a knot to modify (1-based)
111
start, end: index range of knots to modify.
112
If mult is lower or equal to the current multiplicity nothing is done. If mult is higher than the degree the degree is used.</UserDocu>
115
<Methode Name="incrementMultiplicity">
117
<UserDocu>incrementMultiplicity(int start, int end, int mult)
118
Raises multiplicity of knots by mult.
120
start, end: index range of knots to modify.</UserDocu>
123
<Methode Name="insertKnot">
125
<UserDocu>insertKnot(u, mult = 1, tol = 0.0)
126
Inserts a knot value in the sequence of knots. If u is an existing knot the
127
multiplicity is increased by mult.</UserDocu>
130
<Methode Name="insertKnots">
132
<UserDocu>insertKnots(list_of_floats, list_of_ints, tol = 0.0, bool_add = True)
133
Inserts a set of knots values in the sequence of knots.
135
For each u = list_of_floats[i], mult = list_of_ints[i]
137
If u is an existing knot the multiplicity is increased by mult if bool_add is
138
True, otherwise increased to mult.
140
If u is not on the parameter range nothing is done.
142
If the multiplicity is negative or null nothing is done. The new multiplicity
143
is limited to the degree.
145
The tolerance criterion for knots equality is the max of Epsilon(U) and ParametricTolerance.</UserDocu>
148
<Methode Name="removeKnot">
150
<UserDocu>removeKnot(Index, M, tol)
152
Reduces the multiplicity of the knot of index Index to M.
153
If M is equal to 0, the knot is removed.
154
With a modification of this type, the array of poles is also modified.
155
Two different algorithms are systematically used to compute the new
156
poles of the curve. If, for each pole, the distance between the pole
157
calculated using the first algorithm and the same pole calculated using
158
the second algorithm, is less than Tolerance, this ensures that the curve
159
is not modified by more than Tolerance. Under these conditions, true is
160
returned; otherwise, false is returned.
162
A low tolerance is used to prevent modification of the curve.
163
A high tolerance is used to 'smooth' the curve.</UserDocu>
166
<Methode Name="segment">
168
<UserDocu>segment(u1,u2)
169
Modifies this B-Spline curve by segmenting it.</UserDocu>
172
<Methode Name="setKnot">
174
<UserDocu>Set a knot of the B-Spline curve.</UserDocu>
177
<Methode Name="getKnot">
179
<UserDocu>Get a knot of the B-Spline curve.</UserDocu>
182
<Methode Name="setKnots">
184
<UserDocu>Set knots of the B-Spline curve.</UserDocu>
187
<Methode Name="getKnots">
189
<UserDocu>Get all knots of the B-Spline curve.</UserDocu>
192
<Methode Name="setPole">
194
<UserDocu>Modifies this B-Spline curve by assigning P
195
to the pole of index Index in the poles table.</UserDocu>
198
<Methode Name="getPole">
200
<UserDocu>Get a pole of the B-Spline curve.</UserDocu>
203
<Methode Name="getPoles">
205
<UserDocu>Get all poles of the B-Spline curve.</UserDocu>
208
<Methode Name="setWeight">
210
<UserDocu>Set a weight of the B-Spline curve.</UserDocu>
213
<Methode Name="getWeight">
215
<UserDocu>Get a weight of the B-Spline curve.</UserDocu>
218
<Methode Name="getWeights">
220
<UserDocu>Get all weights of the B-Spline curve.</UserDocu>
223
<Methode Name="getPolesAndWeights">
225
<UserDocu>Returns the table of poles and weights in homogeneous coordinates.</UserDocu>
228
<Methode Name="getResolution" Const="true">
230
<UserDocu>Computes for this B-Spline curve the parametric tolerance (UTolerance)
231
for a given 3D tolerance (Tolerance3D).
232
If f(t) is the equation of this B-Spline curve, the parametric tolerance
234
|t1-t0| < UTolerance =""==> |f(t1)-f(t0)| < Tolerance3D</UserDocu>
237
<Methode Name="movePoint">
239
<UserDocu>movePoint(U, P, Index1, Index2)
240
Moves the point of parameter U of this B-Spline curve to P.
241
Index1 and Index2 are the indexes in the table of poles of this B-Spline curve
242
of the first and last poles designated to be moved.
244
Returns: (FirstModifiedPole, LastModifiedPole). They are the indexes of the
245
first and last poles which are effectively modified.</UserDocu>
248
<Methode Name="setNotPeriodic">
250
<UserDocu>Changes this B-Spline curve into a non-periodic curve.
251
If this curve is already non-periodic, it is not modified.</UserDocu>
254
<Methode Name="setPeriodic">
256
<UserDocu>Changes this B-Spline curve into a periodic curve.</UserDocu>
259
<Methode Name="setOrigin">
261
<UserDocu>Assigns the knot of index Index in the knots table
262
as the origin of this periodic B-Spline curve. As a consequence,
263
the knots and poles tables are modified.</UserDocu>
266
<Methode Name="getMultiplicity">
268
<UserDocu>Returns the multiplicity of the knot of index
269
from the knots table of this B-Spline curve.</UserDocu>
272
<Methode Name="getMultiplicities">
274
<UserDocu>Returns the multiplicities table M of the knots of this B-Spline curve.</UserDocu>
277
<Methode Name="approximate" Keyword="true">
279
<UserDocu>Replaces this B-Spline curve by approximating a set of points.
280
The function accepts keywords as arguments.
282
approximate2(Points = list_of_points)
286
DegMin = integer (3) : Minimum degree of the curve.
287
DegMax = integer (8) : Maximum degree of the curve.
288
Tolerance = float (1e-3) : approximating tolerance.
289
Continuity = string ('C2') : Desired continuity of the curve.
290
Possible values : 'C0','G1','C1','G2','C2','C3','CN'
292
LengthWeight = float, CurvatureWeight = float, TorsionWeight = float
293
If one of these arguments is not null, the functions approximates the
294
points using variational smoothing algorithm, which tries to minimize
295
additional criterium:
296
LengthWeight*CurveLength + CurvatureWeight*Curvature + TorsionWeight*Torsion
297
Continuity must be C0, C1 or C2, else defaults to C2.
299
Parameters = list of floats : knot sequence of the approximated points.
300
This argument is only used if the weights above are all null.
302
ParamType = string ('Uniform','Centripetal' or 'ChordLength')
303
Parameterization type. Only used if weights and Parameters above aren't specified.
305
Note : Continuity of the spline defaults to C2. However, it may not be applied if
306
it conflicts with other parameters ( especially DegMax ).</UserDocu>
309
<Methode Name="getCardinalSplineTangents" Keyword="true">
311
<UserDocu>Compute the tangents for a Cardinal spline</UserDocu>
314
<Methode Name="interpolate" Keyword="true">
316
<UserDocu>Replaces this B-Spline curve by interpolating a set of points.
317
The function accepts keywords as arguments.
319
interpolate(Points = list_of_points)
323
PeriodicFlag = bool (False) : Sets the curve closed or opened.
324
Tolerance = float (1e-6) : interpolating tolerance
326
Parameters : knot sequence of the interpolated points.
327
If not supplied, the function defaults to chord-length parameterization.
328
If PeriodicFlag == True, one extra parameter must be appended.
330
EndPoint Tangent constraints :
332
InitialTangent = vector, FinalTangent = vector
333
specify tangent vectors for starting and ending points
334
of the BSpline. Either none, or both must be specified.
336
Full Tangent constraints :
338
Tangents = list_of_vectors, TangentFlags = list_of_bools
339
Both lists must have the same length as Points list.
340
Tangents specifies the tangent vector of each point in Points list.
341
TangentFlags (bool) activates or deactivates the corresponding tangent.
342
These arguments will be ignored if EndPoint Tangents (above) are also defined.
344
Note : Continuity of the spline defaults to C2. However, if periodic, or tangents
345
are supplied, the continuity will drop to C1.</UserDocu>
348
<Methode Name="buildFromPoles">
350
<UserDocu>Builds a B-Spline by a list of poles.</UserDocu>
353
<Methode Name="buildFromPolesMultsKnots" Keyword="true">
355
<UserDocu>Builds a B-Spline by a lists of Poles, Mults, Knots.
356
arguments: poles (sequence of Base.Vector), [mults , knots, periodic, degree, weights (sequence of float), CheckRational]
359
from FreeCAD import Base
362
poles=[V(-10,-10),V(10,-10),V(10,10),V(-10,10)]
364
# non-periodic spline
365
n=Part.BSplineCurve()
366
n.buildFromPolesMultsKnots(poles,(3,1,3),(0,0.5,1),False,2)
367
Part.show(n.toShape())
370
p=Part.BSplineCurve()
371
p.buildFromPolesMultsKnots(poles,(1,1,1,1,1),(0,0.25,0.5,0.75,1),True,2)
372
Part.show(p.toShape())
374
# periodic and rational spline
375
r=Part.BSplineCurve()
376
r.buildFromPolesMultsKnots(poles,(1,1,1,1,1),(0,0.25,0.5,0.75,1),True,2,(1,0.8,0.7,0.2))
377
Part.show(r.toShape())</UserDocu>
380
<Methode Name="toBezier">
382
<UserDocu>Build a list of Bezier splines.</UserDocu>
385
<Methode Name="toBiArcs">
387
<UserDocu>Build a list of arcs and lines to approximate the B-spline.
388
toBiArcs(tolerance) -> list.</UserDocu>
391
<Methode Name="join">
393
<UserDocu>Build a new spline by joining this and a second spline.</UserDocu>
396
<Methode Name="makeC1Continuous">
398
<UserDocu>makeC1Continuous(tol = 1e-6, ang_tol = 1e-7)
399
Reduces as far as possible the multiplicities of the knots of this BSpline
400
(keeping the geometry). It returns a new BSpline, which could still be C0.
401
tol is a geometrical tolerance.
402
The tol_ang is angular tolerance, in radians. It sets tolerable angle mismatch
403
of the tangents on the left and on the right to decide if the curve is G1 or
404
not at a given point.</UserDocu>