Samples/Math/Matrix.py

Samples/Math/Matrix.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 #
6 # Script description:
7 # Show extended functions for FBMatrix
8 #
9 # Topic: operators and utility functions for FBMatrix
10 #
11 
12 from pyfbsdk import FBMatrix
13 
14 lMatrixA = FBMatrix()
15 lMatrixB = FBMatrix()
16 lMatrixResult = FBMatrix()
17 
18 
19 lDouble = 1.0
20 lDoubleResult = 1.0
21 
22 lEqual = True
23 
24 lMatrixResult = lMatrixA + lMatrixB
25 lMatrixResult = lMatrixA - lMatrixB
26 lMatrixResult = lMatrixA * lMatrixB
27 lMatrixResult = lMatrixA * lDouble
28 
29 lMatrixResult += lMatrixA
30 lMatrixResult -= lMatrixA
31 lMatrixResult *= lMatrixA
32 lMatrixResult *= lDouble
33 
34 lMatrixResult = -lMatrixA
35 
36 lMatrixResult.CopyFrom(lMatrixA)
37 lEqual = lMatrixA.NotEqual(lMatrixB)
38 lEqual = lMatrixA.IsEqual(lMatrixB)
39 lMatrixA.Transpose()
40 lMatrixA.Inverse()
41 lMatrixA.InverseProduct(lMatrixB)
42 lMatrixA.Validate()
43 
44 print lMatrixA
45 print lMatrixB
46 print lMatrixResult
47 print lDouble
48 print lDoubleResult
49 print lEqual
50 
51 
52 
53 
54 
55