On Wed, Jul 20, 2011 at 3:37 PM, Scott Giese <[email protected]> wrote:
> Hi Gang,
>
>
>
> FYI. I submitted 3 patches for your review.  I'm new to the list and I
> wanted to give back to the Blender community.
>
>
>
> 28030  SCONS Build: Build Date reflects
> <http://projects.blender.org/tracker/index.php?func=detail&aid=28030&group_i
> d=9&atid=127> "1" instead of actual date of build
>
> 28031  Minor typo in Blenlib
> <http://projects.blender.org/tracker/index.php?func=detail&aid=28031&group_i
> d=9&atid=127>
>
> 28032  Python Mathutils: Matrix Multiplication Error
> <http://projects.blender.org/tracker/index.php?func=detail&aid=28032&group_i
> d=9&atid=127>
>
>
>
> Great work guys!  Appreciate the great product.
>
>
>
> Scott

Thanks for the fixes, committed all patches however you're changes to
mathutils effectively only change the order of multiplication,

http://projects.blender.org/tracker/index.php?func=detail&aid=28032&group_id=9&atid=127

In you're example
>>> print (m1 * m2)

Change to...
>>> print (m2 * m1)

This is a bit confusing because in C we have
mul_m4_m4m4(m1, m2);
 which is the equivalent to "m2 * m1" in python.

A while back Benoit Bolsee was concerned our matrix multiplication
order was wrong so we switched it (between 2.4x and 2.5x)

What makes you think the order in blender is wrong? what's you're reference?

Just checked and we're currently doing matrix multiplication
differently to numpy which doesn't bode well :S - test:

# --- snip
m1 = ((0.0, 0.0, 1.0, 0.0), (-1.0, 0.0, 0.0, 0.0), (0.0, -1.0, 0.0,
0.0), (0.6, 0.0, -0.05, 1.0))
m2 = ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0,
0.0), (0.0, -0.02, -0.1, 1.0))

from numpy import matrix
n_m1 = matrix(m1)
n_m2 = matrix(m2)
print("\nnumpy\n%r" % (n_m1 * n_m2))

from mathutils import Matrix
b_m1 = Matrix(m1)
b_m2 = Matrix(m2)
print("\nmathutils\n%r" % (b_m1 * b_m2))

# --- output

numpy
matrix([[ 0.  ,  0.  ,  1.  ,  0.  ],
        [-1.  ,  0.  ,  0.  ,  0.  ],
        [ 0.  , -1.  ,  0.  ,  0.  ],
        [ 0.6 , -0.02, -0.15,  1.  ]])

mathutils
Matrix((0.0, 0.0, 1.0, 0.0),
       (-1.0, 0.0, 0.0, 0.0),
       (0.0, -1.0, 0.0, 0.0),
       (0.62, 0.1, -0.05, 1.0))


# --- switch m1/m2 order for both mathutils and numpy. re-run

numpy
matrix([[ 0.  ,  0.  ,  1.  ,  0.  ],
        [-1.  ,  0.  ,  0.  ,  0.  ],
        [ 0.  , -1.  ,  0.  ,  0.  ],
        [ 0.62,  0.1 , -0.05,  1.  ]])

mathutils
Matrix((0.0, 0.0, 1.0, 0.0),
       (-1.0, 0.0, 0.0, 0.0),
       (0.0, -1.0, 0.0, 0.0),
       (0.6, -0.0, -0.15, 1.0))
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to