1
<?xml version="1.0" encoding="UTF-8"?>
2
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
8
Include="Base/Matrix.h"
9
FatherInclude="Base/PyObjectBase.h"
15
FatherNamespace="Base">
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.
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).
29
The following constructors are supported:
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.
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
51
Default to (0,0,0). Optional.</UserDocu>
55
<UserDocu>move(vector) -> None
58
Move the matrix along a vector, equivalent to left multiply the matrix
59
by a pure translation transformation.
61
vector : Base.Vector, tuple
67
`z` translation.</UserDocu>
70
<Methode Name="scale">
72
<UserDocu>scale(vector) -> None
76
Scale the first three rows of the matrix.
80
First row factor scale.
82
Second row factor scale.
84
Third row factor scale.
86
global factor scale.</UserDocu>
89
<Methode Name="hasScale" Const="true">
91
<UserDocu>hasScale(tol=0) -> ScaleType
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.
100
<Methode Name="decompose" Const="true">
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>
107
<Methode Name="nullify" NoArgs="true">
109
<UserDocu>nullify() -> None
111
Make this the null matrix.</UserDocu>
114
<Methode Name="isNull" Const="true" NoArgs="true">
116
<UserDocu>isNull() -> bool
118
Check if this is the null matrix.</UserDocu>
121
<Methode Name="unity" NoArgs="true">
123
<UserDocu>unity() -> None
125
Make this matrix to unity (4D identity matrix).</UserDocu>
128
<Methode Name="isUnity" Const="true">
130
<UserDocu>isUnity([tol=0.0]) -> bool
132
Check if this is the unit matrix (4D identity matrix).</UserDocu>
135
<Methode Name="transform">
137
<UserDocu>transform(vector, matrix2) -> None
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`.
146
matrix2 : Base.Matrix</UserDocu>
149
<Methode Name="col" Const="true">
151
<UserDocu>col(index) -> Base.Vector
153
Return the vector of a column, that is, the vector generated by the three
154
first elements of the specified column.
157
Required column index.</UserDocu>
160
<Methode Name="setCol">
162
<UserDocu>setCol(index, vector) -> None
164
Set the vector of a column, that is, the three first elements of the specified
168
Required column index.
169
vector : Base.Vector</UserDocu>
172
<Methode Name="row" Const="true">
174
<UserDocu>row(index) -> Base.Vector
176
Return the vector of a row, that is, the vector generated by the three
177
first elements of the specified row.
180
Required row index.</UserDocu>
183
<Methode Name="setRow">
185
<UserDocu>setRow(index, vector) -> None
187
Set the vector of a row, that is, the three first elements of the specified
192
vector : Base.Vector</UserDocu>
195
<Methode Name="diagonal" Const="true" NoArgs="true">
197
<UserDocu>diagonal() -> Base.Vector
199
Return the diagonal of the 3x3 leading principal submatrix as vector.</UserDocu>
202
<Methode Name="setDiagonal">
204
<UserDocu>setDiagonal(vector) -> None
206
Set the diagonal of the 3x3 leading principal submatrix.
208
vector : Base.Vector</UserDocu>
211
<Methode Name="rotateX">
213
<UserDocu>rotateX(angle) -> None
218
Angle in radians.</UserDocu>
221
<Methode Name="rotateY">
223
<UserDocu>rotateY(angle) -> None
228
Angle in radians.</UserDocu>
231
<Methode Name="rotateZ">
233
<UserDocu>rotateZ(angle) -> None
238
Angle in radians.</UserDocu>
241
<Methode Name="multiply" Const="true">
243
<UserDocu>multiply(matrix) -> Base.Matrix
244
multiply(vector) -> Base.Vector
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).
250
vector : Base.Vector</UserDocu>
253
<Methode Name="multVec" Const="true">
255
<UserDocu>multVec(vector) -> Base.Vector
257
Compute the transformed vector using the matrix.
259
vector : Base.Vector</UserDocu>
262
<Methode Name="invert" NoArgs="true">
264
<UserDocu>invert() -> None
266
Compute the inverse matrix in-place, if possible.</UserDocu>
269
<Methode Name="inverse" Const="true" NoArgs="true">
270
<Documentation><UserDocu>inverse() -> Base.Matrix
272
Compute the inverse matrix, if possible.</UserDocu>
275
<Methode Name="transpose" NoArgs="true">
277
<UserDocu>transpose() -> None
279
Transpose the matrix in-place.</UserDocu>
282
<Methode Name="transposed" Const="true" NoArgs="true">
284
<UserDocu>transposed() -> Base.Matrix
286
Returns a transposed copy of this matrix.</UserDocu>
289
<Methode Name="determinant" Const="true" NoArgs="true">
291
<UserDocu>determinant() -> float
293
Compute the determinant of the matrix.</UserDocu>
296
<Methode Name="isOrthogonal" Const="true">
298
<UserDocu>isOrthogonal(tol=1e-6) -> float
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.
304
Tolerance used to check orthogonality.</UserDocu>
307
<Methode Name="submatrix" Const="true">
309
<UserDocu>submatrix(dim) -> Base.Matrix
311
Get the leading principal submatrix of the given dimension.
312
The (4 - `dim`) remaining dimensions are completed with the
313
corresponding identity matrix.
316
Dimension parameter must be in the range [1,4].</UserDocu>
319
<Methode Name="analyze" Const="true" NoArgs="true">
321
<UserDocu>analyze() -> str
323
Analyzes the type of transformation.</UserDocu>
326
<Attribute Name="A11" ReadOnly="false">
328
<UserDocu>The (1,1) matrix element.</UserDocu>
330
<Parameter Name="A11" Type="Float" />
332
<Attribute Name="A12" ReadOnly="false">
334
<UserDocu>The (1,2) matrix element.</UserDocu>
336
<Parameter Name="A12" Type="Float" />
338
<Attribute Name="A13" ReadOnly="false">
340
<UserDocu>The (1,3) matrix element.</UserDocu>
342
<Parameter Name="A13" Type="Float" />
344
<Attribute Name="A14" ReadOnly="false">
346
<UserDocu>The (1,4) matrix element.</UserDocu>
348
<Parameter Name="A14" Type="Float" />
350
<Attribute Name="A21" ReadOnly="false">
352
<UserDocu>The (2,1) matrix element.</UserDocu>
354
<Parameter Name="A21" Type="Float" />
356
<Attribute Name="A22" ReadOnly="false">
358
<UserDocu>The (2,2) matrix element.</UserDocu>
360
<Parameter Name="A22" Type="Float" />
362
<Attribute Name="A23" ReadOnly="false">
364
<UserDocu>The (2,3) matrix element.</UserDocu>
366
<Parameter Name="A23" Type="Float" />
368
<Attribute Name="A24" ReadOnly="false">
370
<UserDocu>The (2,4) matrix element.</UserDocu>
372
<Parameter Name="A24" Type="Float" />
374
<Attribute Name="A31" ReadOnly="false">
376
<UserDocu>The (3,1) matrix element.</UserDocu>
378
<Parameter Name="A31" Type="Float" />
380
<Attribute Name="A32" ReadOnly="false">
382
<UserDocu>The (3,2) matrix element.</UserDocu>
384
<Parameter Name="A32" Type="Float" />
386
<Attribute Name="A33" ReadOnly="false">
388
<UserDocu>The (3,3) matrix element.</UserDocu>
390
<Parameter Name="A33" Type="Float" />
392
<Attribute Name="A34" ReadOnly="false">
394
<UserDocu>The (3,4) matrix element.</UserDocu>
396
<Parameter Name="A34" Type="Float" />
398
<Attribute Name="A41" ReadOnly="false">
400
<UserDocu>The (4,1) matrix element.</UserDocu>
402
<Parameter Name="A41" Type="Float" />
404
<Attribute Name="A42" ReadOnly="false">
406
<UserDocu>The (4,2) matrix element.</UserDocu>
408
<Parameter Name="A42" Type="Float" />
410
<Attribute Name="A43" ReadOnly="false">
412
<UserDocu>The (4,3) matrix element.</UserDocu>
414
<Parameter Name="A43" Type="Float" />
416
<Attribute Name="A44" ReadOnly="false">
418
<UserDocu>The (4,4) matrix element.</UserDocu>
420
<Parameter Name="A44" Type="Float" />
422
<Attribute Name="A" ReadOnly="false">
424
<UserDocu>The matrix elements.</UserDocu>
426
<Parameter Name="A" Type="Sequence" />
428
<ClassDeclarations>public:
429
MatrixPy(const Matrix4D & mat, PyTypeObject *T = &Type)
430
:PyObjectBase(new Matrix4D(mat),T){}
431
Matrix4D value() const
432
{ return *(getMatrixPtr()); }