Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#24665] mathutils.Matrix initialization is counter-intuitive and generates bugs

Date:
2010-11-11 17:26
Priority:
3
State:
Closed
Submitted by:
Dominique Lorre (dlorre)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
 
Summary:
mathutils.Matrix initialization is counter-intuitive and generates bugs
Detailed description
Given the following code:
mat = mathutils.Matrix((1,2,3,4),(5,6,7,8),(9,10,11,12),(13,14,15,16))
print(str(mat))

The result is:

Matrix((1.000000, 5.000000, 9.000000, 13.000000), (2.000000, 6.000000, 10.000000
, 14.000000), (3.000000, 7.000000, 11.000000, 15.000000), (4.000000, 8.000000, 1
2.000000, 16.000000))

Wether or not this is intended or a bug, it is what causes the 3DS import bug reported earlier since the values are not initialized in the right order.

Followup

Message
  • Date: 2010-11-11 18:26
  • Sender: Tom Edwards
  • As a workaround, you can transpose() it.
  • Date: 2010-11-11 19:16
  • Sender: Ton Roosendaal
  • Campbell: shouldn't python code print out matrices in same row-collumn order as you define it?
  • Date: 2010-11-11 19:31
  • Sender: Dominique Lorre
  • @Tom Edwards: You are correct.
    using transpose() at line 609 of import_3ds.py instead of invert() fixes the issue reported earlier.

    #contextMatrix_rot.resize4x4()
    #print "MTX"
    #print contextMatrix_rot
    contextMatrix_rot.transpose()
    #print contextMatrix_rot
    #contextMatrix_tx = mathutils.Matrix.Translation(0.5 * Blender.mathutils.Vector(data[9:]))
    #contextMatrix_tx.invert()

 

Attached Files:

No Files Currently Attached

Changes:

Field Old Value Date By
close_date2010-11-12 05:142010-11-12 05:14campbellbarton
ResolutionApproved2010-11-12 04:08campbellbarton
close_date2010-11-12 04:082010-11-12 04:08campbellbarton
status_idOpen2010-11-12 04:08campbellbarton
CategoryNone2010-11-11 19:16ton
ResolutionNone2010-11-11 19:16ton
assigned_tonone2010-11-11 19:16ton