Can we get support for python Vector4 class?

[url]http://www.derivative.ca/wiki099/index.php?title=Vector_Class[/url]

Love the new vector class! ^^ been doing matrix mathematics however there are some equations that require multiplying a 4x4 transform matrix by a vector4, and I’m ending up needing to do it by hand.

Not a big deal but would be neat to have that option!

Hey,
Can you give an example of what kind of operation you are looking to do?

Hi Malcom,

I was using this workflow to convert screenspace to worldspace, which does work for me.

It has the user multiplying a matrix 4 from the camera by a vector 4.

The 4th item in the vector isn’t used, however doesn’t the multiplication still require the format of everything to be in 4’s?

Thanks,
Lucas

I’ll update the documentation a bit, but internally the vectors and position classes behave as they should when being matrix multiplied. The W coordinate will be 0 for vectors and 1 for positions. If you multiply a position by a projection matrix, the position class will automatically do the W divide to make the coordinates homogeneous again.

I did this since setting the W to the wrong value (1 for a vector for example) is a common error I see in GL code, so I wanted to make things a little more wrapped and automatic for the users.

Ah! That’s great to hear, thank you for the extra info.
I’m also pretty novice still to matricies so that wasn’t something I thought to try.

Thanks!