FreeCAD

Форк
0
/
BSplineCurve2dPy.xml 
408 строк · 18.4 Кб
1
<?xml version="1.0" encoding="UTF-8"?>
2
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
3
    <PythonExport
4
        Name="BSplineCurve2dPy"
5
        Namespace="Part"
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"
11
        Father="Curve2dPy"
12
        FatherNamespace="Part"
13
        Constructor="true">
14
        <Documentation>
15
            <Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer@users.sourceforge.net"/>
16
            <UserDocu>Describes a B-Spline curve in 3D space</UserDocu>
17
        </Documentation>
18
        <Attribute Name="Degree" ReadOnly="true">
19
            <Documentation>
20
                <UserDocu>Returns the polynomial degree of this B-Spline curve.</UserDocu>
21
            </Documentation>
22
            <Parameter Name="Degree" Type="Long"/>
23
        </Attribute>
24
        <Attribute Name="MaxDegree" ReadOnly="true">
25
            <Documentation>
26
                <UserDocu>Returns the value of the maximum polynomial degree of any
27
B-Spline curve curve. This value is 25.</UserDocu>
28
            </Documentation>
29
            <Parameter Name="MaxDegree" Type="Long"/>
30
        </Attribute>
31
        <Attribute Name="NbPoles" ReadOnly="true">
32
            <Documentation>
33
                <UserDocu>Returns the number of poles of this B-Spline curve.</UserDocu>
34
            </Documentation>
35
            <Parameter Name="NbPoles" Type="Long"/>
36
        </Attribute>
37
        <Attribute Name="NbKnots" ReadOnly="true">
38
            <Documentation>
39
                <UserDocu>Returns the number of knots of this B-Spline curve.</UserDocu>
40
            </Documentation>
41
            <Parameter Name="NbPoles" Type="Long"/>
42
        </Attribute>
43
        <Attribute Name="StartPoint" ReadOnly="true">
44
            <Documentation>
45
                <UserDocu>Returns the start point of this B-Spline curve.</UserDocu>
46
            </Documentation>
47
            <Parameter Name="StartPoint" Type="Object"/>
48
        </Attribute>
49
        <Attribute Name="EndPoint" ReadOnly="true">
50
            <Documentation>
51
                <UserDocu>Returns the end point of this B-Spline curve.</UserDocu>
52
            </Documentation>
53
            <Parameter Name="EndPoint" Type="Object"/>
54
        </Attribute>
55
        <Attribute Name="FirstUKnotIndex" ReadOnly="true">
56
            <Documentation>
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>
60
            </Documentation>
61
            <Parameter Name="FirstUKnotIndex" Type="Object"/>
62
        </Attribute>
63
        <Attribute Name="LastUKnotIndex" ReadOnly="true">
64
            <Documentation>
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>
68
            </Documentation>
69
            <Parameter Name="LastUKnotIndex" Type="Object"/>
70
        </Attribute>
71
        <Attribute Name="KnotSequence" ReadOnly="true">
72
            <Documentation>
73
                <UserDocu>Returns the knots sequence of this B-Spline curve.</UserDocu>
74
            </Documentation>
75
            <Parameter Name="KnotSequence" Type="List"/>
76
        </Attribute>
77
        <Methode Name="isRational">
78
            <Documentation>
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>
82
            </Documentation>
83
        </Methode>
84
        <Methode Name="isPeriodic">
85
            <Documentation>
86
                <UserDocu>Returns true if this BSpline curve is periodic.</UserDocu>
87
            </Documentation>
88
        </Methode>
89
        <Methode Name="isClosed">
90
            <Documentation>
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>
93
            </Documentation>
94
        </Methode>
95
        <Methode Name="increaseDegree">
96
            <Documentation>
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>
102
            </Documentation>
103
        </Methode>
104
        <Methode Name="increaseMultiplicity">
105
            <Documentation>
106
                <UserDocu>increaseMultiplicity(int index, int mult)
107
                increaseMultiplicity(int start, int end, int mult)
108
                Increases multiplicity of knots up to mult.
109

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>
113
            </Documentation>
114
        </Methode>
115
        <Methode Name="incrementMultiplicity">
116
            <Documentation>
117
                <UserDocu>incrementMultiplicity(int start, int end, int mult)
118
                Raises multiplicity of knots by mult.
119

120
                start, end: index range of knots to modify.</UserDocu>
121
            </Documentation>
122
        </Methode>
123
        <Methode Name="insertKnot">
124
            <Documentation>
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>
128
            </Documentation>
129
        </Methode>
130
        <Methode Name="insertKnots">
131
            <Documentation>
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.
134

135
                For each u = list_of_floats[i], mult = list_of_ints[i]
136

137
                If u is an existing knot the multiplicity is increased by mult if bool_add is
138
                True, otherwise increased to mult.
139

140
                If u is not on the parameter range nothing is done.
141

142
                If the multiplicity is negative or null nothing is done. The new multiplicity
143
                is limited to the degree.
144

145
                The tolerance criterion for knots equality is the max of Epsilon(U) and ParametricTolerance.</UserDocu>
146
            </Documentation>
147
        </Methode>
148
        <Methode Name="removeKnot">
149
            <Documentation>
150
                <UserDocu>removeKnot(Index, M, tol)
151

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.
161

162
                    A low tolerance is used to prevent modification of the curve.
163
                    A high tolerance is used to 'smooth' the curve.</UserDocu>
164
            </Documentation>
165
        </Methode>
166
        <Methode Name="segment">
167
            <Documentation>
168
                <UserDocu>segment(u1,u2)
169
                    Modifies this B-Spline curve by segmenting it.</UserDocu>
170
            </Documentation>
171
        </Methode>
172
        <Methode Name="setKnot">
173
            <Documentation>
174
                <UserDocu>Set a knot of the B-Spline curve.</UserDocu>
175
            </Documentation>
176
        </Methode>
177
        <Methode Name="getKnot">
178
            <Documentation>
179
                <UserDocu>Get a knot of the B-Spline curve.</UserDocu>
180
            </Documentation>
181
        </Methode>
182
        <Methode Name="setKnots">
183
            <Documentation>
184
                <UserDocu>Set knots of the B-Spline curve.</UserDocu>
185
            </Documentation>
186
        </Methode>
187
        <Methode Name="getKnots">
188
            <Documentation>
189
                <UserDocu>Get all knots of the B-Spline curve.</UserDocu>
190
            </Documentation>
191
        </Methode>
192
        <Methode Name="setPole">
193
            <Documentation>
194
                <UserDocu>Modifies this B-Spline curve by assigning P
195
to the pole of index Index in the poles table.</UserDocu>
196
            </Documentation>
197
        </Methode>
198
        <Methode Name="getPole">
199
            <Documentation>
200
                <UserDocu>Get a pole of the B-Spline curve.</UserDocu>
201
            </Documentation>
202
        </Methode>
203
        <Methode Name="getPoles">
204
            <Documentation>
205
                <UserDocu>Get all poles of the B-Spline curve.</UserDocu>
206
            </Documentation>
207
        </Methode>
208
        <Methode Name="setWeight">
209
            <Documentation>
210
                <UserDocu>Set a weight of the B-Spline curve.</UserDocu>
211
            </Documentation>
212
        </Methode>
213
        <Methode Name="getWeight">
214
            <Documentation>
215
                <UserDocu>Get a weight of the B-Spline curve.</UserDocu>
216
            </Documentation>
217
        </Methode>
218
        <Methode Name="getWeights">
219
            <Documentation>
220
                <UserDocu>Get all weights of the B-Spline curve.</UserDocu>
221
            </Documentation>
222
        </Methode>
223
        <Methode Name="getPolesAndWeights">
224
            <Documentation>
225
                <UserDocu>Returns the table of poles and weights in homogeneous coordinates.</UserDocu>
226
            </Documentation>
227
        </Methode>
228
        <Methode Name="getResolution" Const="true">
229
            <Documentation>
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
233
ensures that:
234
|t1-t0| &lt; UTolerance =&quot;&quot;==&gt; |f(t1)-f(t0)| &lt; Tolerance3D</UserDocu>
235
            </Documentation>
236
        </Methode>
237
        <Methode Name="movePoint">
238
            <Documentation>
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.
243

244
Returns: (FirstModifiedPole, LastModifiedPole). They are the indexes of the
245
first and last poles which are effectively modified.</UserDocu>
246
            </Documentation>
247
        </Methode>
248
        <Methode Name="setNotPeriodic">
249
            <Documentation>
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>
252
            </Documentation>
253
        </Methode>
254
        <Methode Name="setPeriodic">
255
            <Documentation>
256
                <UserDocu>Changes this B-Spline curve into a periodic curve.</UserDocu>
257
            </Documentation>
258
        </Methode>
259
        <Methode Name="setOrigin">
260
            <Documentation>
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>
264
            </Documentation>
265
        </Methode>
266
        <Methode Name="getMultiplicity">
267
            <Documentation>
268
                <UserDocu>Returns the multiplicity of the knot of index
269
from the knots table of this B-Spline curve.</UserDocu>
270
            </Documentation>
271
        </Methode>
272
        <Methode Name="getMultiplicities">
273
            <Documentation>
274
                <UserDocu>Returns the multiplicities table M of the knots of this B-Spline curve.</UserDocu>
275
            </Documentation>
276
        </Methode>
277
        <Methode Name="approximate" Keyword="true">
278
            <Documentation>
279
                <UserDocu>Replaces this B-Spline curve by approximating a set of points.
280
                    The function accepts keywords as arguments.
281

282
                    approximate2(Points = list_of_points)
283

284
                    Optional arguments :
285

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'
291

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.
298

299
                    Parameters = list of floats : knot sequence of the approximated points.
300
                    This argument is only used if the weights above are all null.
301

302
                    ParamType = string ('Uniform','Centripetal' or 'ChordLength')
303
                    Parameterization type. Only used if weights and Parameters above aren't specified.
304

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>
307
            </Documentation>
308
        </Methode>
309
        <Methode Name="getCardinalSplineTangents" Keyword="true">
310
            <Documentation>
311
                <UserDocu>Compute the tangents for a Cardinal spline</UserDocu>
312
            </Documentation>
313
        </Methode>
314
        <Methode Name="interpolate" Keyword="true">
315
            <Documentation>
316
                <UserDocu>Replaces this B-Spline curve by interpolating a set of points.
317
                    The function accepts keywords as arguments.
318

319
                    interpolate(Points = list_of_points)
320

321
                    Optional arguments :
322

323
                    PeriodicFlag = bool (False) : Sets the curve closed or opened.
324
                    Tolerance = float (1e-6) : interpolating tolerance
325

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.
329

330
                    EndPoint Tangent constraints :
331

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.
335

336
                    Full Tangent constraints :
337

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.
343

344
                    Note : Continuity of the spline defaults to C2. However, if periodic, or tangents
345
                    are supplied, the continuity will drop to C1.</UserDocu>
346
            </Documentation>
347
        </Methode>
348
        <Methode Name="buildFromPoles">
349
            <Documentation>
350
                <UserDocu>Builds a B-Spline by a list of poles.</UserDocu>
351
            </Documentation>
352
        </Methode>
353
        <Methode Name="buildFromPolesMultsKnots" Keyword="true">
354
            <Documentation>
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]
357

358
                Examples:
359
                from FreeCAD import Base
360
                import Part
361
                V=Base.Vector
362
                poles=[V(-10,-10),V(10,-10),V(10,10),V(-10,10)]
363

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())
368

369
                # periodic spline
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())
373

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>
378
            </Documentation>
379
        </Methode>
380
        <Methode Name="toBezier">
381
            <Documentation>
382
                <UserDocu>Build a list of Bezier splines.</UserDocu>
383
            </Documentation>
384
        </Methode>
385
        <Methode Name="toBiArcs">
386
            <Documentation>
387
                <UserDocu>Build a list of arcs and lines to approximate the B-spline.
388
                    toBiArcs(tolerance) -&gt; list.</UserDocu>
389
            </Documentation>
390
        </Methode>
391
        <Methode Name="join">
392
            <Documentation>
393
                <UserDocu>Build a new spline by joining this and a second spline.</UserDocu>
394
            </Documentation>
395
        </Methode>
396
        <Methode Name="makeC1Continuous">
397
            <Documentation>
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>
405
            </Documentation>
406
        </Methode>
407
    </PythonExport>
408
</GenerateModel>
409

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.