[Bf-python] 3DVec * 4x4Matrix issue

Gilbert, Joseph T. jgilbert at tigr.ORG
Mon Jul 24 10:47:40 CEST 2006


As I remember I applied a fix where 3d vectors would act as 4d vectors
when multiplying vs. a 4D matrix. There may be something in the code to
this respect.

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Campbell
Barton
Sent: Friday, July 21, 2006 11:19 PM
To: Blender Foundation Python list
Subject: [Bf-python] 3DVec * 4x4Matrix issue

Hi, This was mentioned a while ago, but I dont think any conclusion was 
reached..

A problem I come across almost weekly from new scripters is how to get 
the worldspace location of a vector from object data, a vert say 
(through emails end blenderartist python forum)

world_vec= vec*matrix works if the vector  4D but for 3D vectors it 
dosent apply the translation.

Solutions are ...

mtx= ob.matrixWorld
vec_copy= Mathutils.Vector(vec)
vec_copy.resize4D()
vec=vec_copy*mtx
vec.resize3D()
or...

mtx= ob.matrixWorld
vec=vec*mtx
vec= vec+mtx.translationPart()
or..

do the matrix multiplication manually..

Could we just have the matrix multiplication apply transformation to a 
3D vector?

- Cam

_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list