[Bf-python] 3DVec * 4x4Matrix issue

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


KK. I remember that someone else complained about this along time ago
that you had to call resize4D() on a 3d vector everytime you wanted to
multiply vs. a transformation matrix. This is annoying and unnecessary.
So there was a commit applied that allowed a implied resize of 3d
vectors (just adding a 1 to w position I think) when multiplying vs. 4D
matrices.

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Campbell
Barton
Sent: Monday, July 24, 2006 4:53 AM
Cc: Blender Foundation Python list
Subject: Re: [Bf-python] 3DVec * 4x4Matrix issue

perhaps the change got revoked or dosent work for some reason, bucause 
at the moment its not doing that
Ill take a look at this when I do the other Mathutils stuff.

Gilbert, Joseph T. wrote:
> 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
>
>   


-- 
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
_______________________________________________
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