[Bf-python] 3DVec * 4x4Matrix issue

McCracken, Andrew ajm87 at waikato.ac.nz
Mon Jul 24 01:28:22 CEST 2006


Hi,

overloading * sounds a bit drastic to me.

I would go for an object.vec3dtoworldspace3d(vec)

or just object.toWorldspace3d(vec)

I know very little about the BPY api tho.

Cheers


-----Original Message-----
From: bf-python-bounces at projects.blender.org on behalf of Campbell Barton
Sent: Sat 7/22/2006 3:18 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



-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3208 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20060724/6aaab862/attachment.bin>


More information about the Bf-python mailing list