[Bf-python] 3DVec * 4x4Matrix issue
Campbell Barton
cbarton at metavr.com
Mon Jul 24 05:50:30 CEST 2006
Correct me if Im wrong, but this isnt overloading..
Its just how a vector and a matrix multiply together
vec3d * mat3x3 is obvious
vec3d * mat4x4 - in unclear whats best. apply transformation or not?
From my experience its best to apply the translation, the are so many
more cases when you want it applied, then not.
McCracken, Andrew wrote:
> 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
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-python
mailing list