FreeCAD

Форк
0
/
MatrixPy.xml 
435 строк · 12.9 Кб
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
        Father="PyObjectBase"
5
        Name="MatrixPy"
6
        Twin="Matrix"
7
        TwinPointer="Matrix4D"
8
        Include="Base/Matrix.h"
9
        FatherInclude="Base/PyObjectBase.h"
10
        Namespace="Base"
11
        Constructor="true"
12
        Delete="true"
13
        NumberProtocol="true"
14
        RichCompare="true"
15
        FatherNamespace="Base">
16
    <Documentation>
17
      <Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
18
      <DeveloperDocu>This is the Matrix export class</DeveloperDocu>
19
      <UserDocu>Base.Matrix class.
20

21
A 4x4 Matrix.
22
In particular, this matrix can represent an affine transformation, that is,
23
given a 3D vector `x`, apply the transformation y = M*x + b, where the matrix
24
`M` is a linear map and the vector `b` is a translation.
25
`y` can be obtained using a linear transformation represented by the 4x4 matrix
26
`A` conformed by the augmented 3x4 matrix (M|b), augmented by row with
27
(0,0,0,1), therefore: (y, 1) = A*(x, 1).
28

29
The following constructors are supported:
30

31
Matrix()
32
Empty constructor.
33

34
Matrix(matrix)
35
Copy constructor.
36
matrix : Base.Matrix.
37

38
Matrix(*coef)
39
Define from 16 coefficients of the 4x4 matrix.
40
coef : sequence of float
41
    The sequence can have up to 16 elements which complete the matrix by rows.
42

43
Matrix(vector1, vector2, vector3, vector4)
44
Define from four 3D vectors which represent the columns of the 3x4 submatrix,
45
useful to represent an affine transformation. The fourth row is made up by
46
(0,0,0,1).
47
vector1 : Base.Vector
48
vector2 : Base.Vector
49
vector3 : Base.Vector
50
vector4 : Base.Vector
51
    Default to (0,0,0). Optional.</UserDocu>
52
    </Documentation>
53
    <Methode Name="move">
54
      <Documentation>
55
        <UserDocu>move(vector) -> None
56
move(x, y, z) -> None
57

58
Move the matrix along a vector, equivalent to left multiply the matrix
59
by a pure translation transformation.
60

61
vector : Base.Vector, tuple
62
x : float
63
    `x` translation.
64
y : float
65
    `y` translation.
66
z : float
67
    `z` translation.</UserDocu>
68
      </Documentation>
69
    </Methode>
70
    <Methode Name="scale">
71
      <Documentation>
72
        <UserDocu>scale(vector) -> None
73
scale(x, y, z) -> None
74
scale(factor) -> None
75

76
Scale the first three rows of the matrix.
77

78
vector : Base.Vector
79
x : float
80
    First row factor scale.
81
y : float
82
    Second row factor scale.
83
z : float
84
    Third row factor scale.
85
factor : float
86
    global factor scale.</UserDocu>
87
      </Documentation>
88
    </Methode>
89
    <Methode Name="hasScale" Const="true">
90
      <Documentation>
91
        <UserDocu>hasScale(tol=0) -> ScaleType
92

93
Return an enum value of ScaleType. Possible values are:
94
Uniform, NonUniformLeft, NonUniformRight, NoScaling or Other
95
if it's not a scale matrix.
96

97
tol : float</UserDocu>
98
      </Documentation>
99
    </Methode>
100
    <Methode Name="decompose" Const="true">
101
      <Documentation>
102
        <UserDocu>decompose() -> Base.Matrix, Base.Matrix, Base.Matrix, Base.Matrix\n
103
Return a tuple of matrices representing shear, scale, rotation and move.
104
So that matrix = move * rotation * scale * shear.</UserDocu>
105
      </Documentation>
106
    </Methode>
107
    <Methode Name="nullify" NoArgs="true">
108
      <Documentation>
109
        <UserDocu>nullify() -> None
110

111
Make this the null matrix.</UserDocu>
112
      </Documentation>
113
    </Methode>
114
    <Methode Name="isNull" Const="true" NoArgs="true">
115
      <Documentation>
116
        <UserDocu>isNull() -> bool
117

118
Check if this is the null matrix.</UserDocu>
119
      </Documentation>
120
    </Methode>
121
    <Methode Name="unity" NoArgs="true">
122
      <Documentation>
123
        <UserDocu>unity() -> None
124

125
Make this matrix to unity (4D identity matrix).</UserDocu>
126
      </Documentation>
127
    </Methode>
128
    <Methode Name="isUnity" Const="true">
129
      <Documentation>
130
        <UserDocu>isUnity([tol=0.0]) -> bool
131

132
Check if this is the unit matrix (4D identity matrix).</UserDocu>
133
      </Documentation>
134
    </Methode>
135
    <Methode Name="transform">
136
      <Documentation>
137
        <UserDocu>transform(vector, matrix2) -> None
138

139
Transform the matrix around a given point.
140
Equivalent to left multiply the matrix by T*M*T_inv, where M is `matrix2`, T the
141
translation generated by `vector` and T_inv the inverse translation.
142
For example, if `matrix2` is a rotation, the result is the transformation generated
143
by the current matrix followed by a rotation around the point represented by `vector`.
144

145
vector : Base.Vector
146
matrix2 : Base.Matrix</UserDocu>
147
      </Documentation>
148
    </Methode>
149
    <Methode Name="col" Const="true">
150
      <Documentation>
151
        <UserDocu>col(index) -> Base.Vector
152

153
Return the vector of a column, that is, the vector generated by the three
154
first elements of the specified column.
155

156
index : int
157
    Required column index.</UserDocu>
158
      </Documentation>
159
    </Methode>
160
    <Methode Name="setCol">
161
      <Documentation>
162
        <UserDocu>setCol(index, vector) -> None
163

164
Set the vector of a column, that is, the three first elements of the specified
165
column by index.
166

167
index : int
168
    Required column index.
169
vector : Base.Vector</UserDocu>
170
      </Documentation>
171
    </Methode>
172
    <Methode Name="row" Const="true">
173
      <Documentation>
174
        <UserDocu>row(index) -> Base.Vector
175

176
Return the vector of a row, that is, the vector generated by the three
177
first elements of the specified row.
178

179
index : int
180
    Required row index.</UserDocu>
181
      </Documentation>
182
    </Methode>
183
    <Methode Name="setRow">
184
      <Documentation>
185
        <UserDocu>setRow(index, vector) -> None
186

187
Set the vector of a row, that is, the three first elements of the specified
188
row by index.
189

190
index : int
191
    Required row index.
192
vector : Base.Vector</UserDocu>
193
      </Documentation>
194
    </Methode>
195
    <Methode Name="diagonal" Const="true" NoArgs="true">
196
      <Documentation>
197
        <UserDocu>diagonal() -> Base.Vector
198

199
Return the diagonal of the 3x3 leading principal submatrix as vector.</UserDocu>
200
      </Documentation>
201
    </Methode>
202
    <Methode Name="setDiagonal">
203
      <Documentation>
204
        <UserDocu>setDiagonal(vector) -> None
205

206
Set the diagonal of the 3x3 leading principal submatrix.
207

208
vector : Base.Vector</UserDocu>
209
      </Documentation>
210
    </Methode>
211
    <Methode Name="rotateX">
212
      <Documentation>
213
        <UserDocu>rotateX(angle) -> None
214

215
Rotate around X axis.
216

217
angle : float
218
    Angle in radians.</UserDocu>
219
      </Documentation>
220
    </Methode>
221
    <Methode Name="rotateY">
222
      <Documentation>
223
        <UserDocu>rotateY(angle) -> None
224

225
Rotate around Y axis.
226

227
angle : float
228
    Angle in radians.</UserDocu>
229
      </Documentation>
230
    </Methode>
231
    <Methode Name="rotateZ">
232
      <Documentation>
233
        <UserDocu>rotateZ(angle) -> None
234

235
Rotate around Z axis.
236

237
angle : float
238
    Angle in radians.</UserDocu>
239
      </Documentation>
240
    </Methode>
241
    <Methode Name="multiply" Const="true">
242
      <Documentation>
243
        <UserDocu>multiply(matrix) -> Base.Matrix
244
multiply(vector) -> Base.Vector
245

246
Right multiply the matrix by the given object.
247
If the argument is a vector, this is augmented to the 4D vector (`vector`, 1).
248

249
matrix : Base.Matrix
250
vector : Base.Vector</UserDocu>
251
      </Documentation>
252
    </Methode>
253
    <Methode Name="multVec" Const="true">
254
      <Documentation>
255
        <UserDocu>multVec(vector) -> Base.Vector
256

257
Compute the transformed vector using the matrix.
258

259
vector : Base.Vector</UserDocu>
260
      </Documentation>
261
    </Methode>
262
    <Methode Name="invert" NoArgs="true">
263
      <Documentation>
264
        <UserDocu>invert() -> None
265

266
Compute the inverse matrix in-place, if possible.</UserDocu>
267
      </Documentation>
268
    </Methode>
269
    <Methode Name="inverse" Const="true" NoArgs="true">
270
      <Documentation><UserDocu>inverse() -> Base.Matrix
271

272
Compute the inverse matrix, if possible.</UserDocu>
273
      </Documentation>
274
    </Methode>
275
    <Methode Name="transpose" NoArgs="true">
276
      <Documentation>
277
        <UserDocu>transpose() -> None
278

279
Transpose the matrix in-place.</UserDocu>
280
      </Documentation>
281
    </Methode>
282
    <Methode Name="transposed" Const="true" NoArgs="true">
283
      <Documentation>
284
        <UserDocu>transposed() -> Base.Matrix
285

286
Returns a transposed copy of this matrix.</UserDocu>
287
      </Documentation>
288
    </Methode>
289
    <Methode Name="determinant" Const="true" NoArgs="true">
290
      <Documentation>
291
        <UserDocu>determinant() -> float
292

293
Compute the determinant of the matrix.</UserDocu>
294
      </Documentation>
295
    </Methode>
296
    <Methode Name="isOrthogonal" Const="true">
297
      <Documentation>
298
        <UserDocu>isOrthogonal(tol=1e-6) -> float
299

300
Checks if the matrix is orthogonal, i.e. M * M^T = k*I and returns
301
the multiple of the identity matrix. If it's not orthogonal 0 is returned.
302

303
tol : float
304
    Tolerance used to check orthogonality.</UserDocu>
305
      </Documentation>
306
    </Methode>
307
    <Methode Name="submatrix" Const="true">
308
      <Documentation>
309
        <UserDocu>submatrix(dim) -> Base.Matrix
310

311
Get the leading principal submatrix of the given dimension.
312
The (4 - `dim`) remaining dimensions are completed with the
313
corresponding identity matrix.
314

315
dim : int
316
    Dimension parameter must be in the range [1,4].</UserDocu>
317
      </Documentation>
318
    </Methode>
319
    <Methode Name="analyze" Const="true" NoArgs="true">
320
      <Documentation>
321
        <UserDocu>analyze() -> str
322

323
Analyzes the type of transformation.</UserDocu>
324
      </Documentation>
325
    </Methode>
326
    <Attribute Name="A11" ReadOnly="false">
327
      <Documentation>
328
        <UserDocu>The (1,1) matrix element.</UserDocu>
329
      </Documentation>
330
      <Parameter Name="A11" Type="Float" />
331
    </Attribute>
332
    <Attribute Name="A12" ReadOnly="false">
333
      <Documentation>
334
        <UserDocu>The (1,2) matrix element.</UserDocu>
335
      </Documentation>
336
      <Parameter Name="A12" Type="Float" />
337
    </Attribute>
338
    <Attribute Name="A13" ReadOnly="false">
339
      <Documentation>
340
        <UserDocu>The (1,3) matrix element.</UserDocu>
341
      </Documentation>
342
      <Parameter Name="A13" Type="Float" />
343
    </Attribute>
344
    <Attribute Name="A14" ReadOnly="false">
345
      <Documentation>
346
        <UserDocu>The (1,4) matrix element.</UserDocu>
347
      </Documentation>
348
      <Parameter Name="A14" Type="Float" />
349
    </Attribute>
350
    <Attribute Name="A21" ReadOnly="false">
351
      <Documentation>
352
        <UserDocu>The (2,1) matrix element.</UserDocu>
353
      </Documentation>
354
      <Parameter Name="A21" Type="Float" />
355
    </Attribute>
356
    <Attribute Name="A22" ReadOnly="false">
357
      <Documentation>
358
        <UserDocu>The (2,2) matrix element.</UserDocu>
359
      </Documentation>
360
      <Parameter Name="A22" Type="Float" />
361
    </Attribute>
362
    <Attribute Name="A23" ReadOnly="false">
363
      <Documentation>
364
        <UserDocu>The (2,3) matrix element.</UserDocu>
365
      </Documentation>
366
      <Parameter Name="A23" Type="Float" />
367
    </Attribute>
368
    <Attribute Name="A24" ReadOnly="false">
369
      <Documentation>
370
        <UserDocu>The (2,4) matrix element.</UserDocu>
371
      </Documentation>
372
      <Parameter Name="A24" Type="Float" />
373
    </Attribute>
374
    <Attribute Name="A31" ReadOnly="false">
375
      <Documentation>
376
        <UserDocu>The (3,1) matrix element.</UserDocu>
377
      </Documentation>
378
      <Parameter Name="A31" Type="Float" />
379
    </Attribute>
380
    <Attribute Name="A32" ReadOnly="false">
381
      <Documentation>
382
        <UserDocu>The (3,2) matrix element.</UserDocu>
383
      </Documentation>
384
      <Parameter Name="A32" Type="Float" />
385
    </Attribute>
386
    <Attribute Name="A33" ReadOnly="false">
387
      <Documentation>
388
        <UserDocu>The (3,3) matrix element.</UserDocu>
389
      </Documentation>
390
      <Parameter Name="A33" Type="Float" />
391
    </Attribute>
392
    <Attribute Name="A34" ReadOnly="false">
393
      <Documentation>
394
        <UserDocu>The (3,4) matrix element.</UserDocu>
395
      </Documentation>
396
      <Parameter Name="A34" Type="Float" />
397
    </Attribute>
398
    <Attribute Name="A41" ReadOnly="false">
399
      <Documentation>
400
        <UserDocu>The (4,1) matrix element.</UserDocu>
401
      </Documentation>
402
      <Parameter Name="A41" Type="Float" />
403
    </Attribute>
404
    <Attribute Name="A42" ReadOnly="false">
405
      <Documentation>
406
        <UserDocu>The (4,2) matrix element.</UserDocu>
407
      </Documentation>
408
      <Parameter Name="A42" Type="Float" />
409
    </Attribute>
410
    <Attribute Name="A43" ReadOnly="false">
411
      <Documentation>
412
        <UserDocu>The (4,3) matrix element.</UserDocu>
413
      </Documentation>
414
      <Parameter Name="A43" Type="Float" />
415
    </Attribute>
416
    <Attribute Name="A44" ReadOnly="false">
417
      <Documentation>
418
        <UserDocu>The (4,4) matrix element.</UserDocu>
419
      </Documentation>
420
      <Parameter Name="A44" Type="Float" />
421
    </Attribute>
422
    <Attribute Name="A" ReadOnly="false">
423
      <Documentation>
424
        <UserDocu>The matrix elements.</UserDocu>
425
      </Documentation>
426
      <Parameter Name="A" Type="Sequence" />
427
    </Attribute>
428
    <ClassDeclarations>public:
429
      MatrixPy(const Matrix4D &amp; mat, PyTypeObject *T = &amp;Type)
430
      :PyObjectBase(new Matrix4D(mat),T){}
431
      Matrix4D value() const
432
      { return *(getMatrixPtr()); }
433
    </ClassDeclarations>
434
  </PythonExport>
435
</GenerateModel>
436

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

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

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

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