# Matrix*vector= how to?

i’m trying to multiply a vector by a matrix the problem is that doesn’t
perform any rotation on the vector !

argh… i’m blocked in the creation of my little 3d game ( Space invader 2003)

i’ve this formula to multiply a vector by a matrix
| A B C D | | x1 x2 x3 x4 x5 | | A.x1+B.y1+C.z1+D A.x2+B.y2+C.z2+D … |
| E F G H | . | y1 y2 y3 y4 y5 | = | E.x1+F.y1+G.z1+H E.x2+F.y2+G.z2+H … |
| I J K L | | z1 z2 y3 y4 z5 | | I.x1+J.y1+K.z1+L I.x2+J.y2+K.z2+L … |
| M N O P | | 1 1 1 1 1 | | M.x1+N.y1+O.z1+P M.x2+N.y2+O.z2+P … |

so i’ve created this func

void M4x4multV3(Vector3f *result,Vector3f *in,float *m)
{

result->x=(m*in->x)+(m*in->y)+(m*in->z)+m;
result->y=(m*in->x)+(m*in->y)+(m*in->z)+m;
result->z=(m*in->x)+(m*in->y)+(m*in->z)+m;
}

/*
m is a 4x4 matrix OpenGL order
Vector3f is define like this
typedef struct
{
float x,y,z;
}Vector3f;
*/ i’ll reply to myself
in fact that work the problem was not here

hello

be aware of a potential snafu: you’re not computing the w component of your vector. This may not be a problem for your work, but just keep it in mind if you start using funky psycho matricies!

cheers
John

okay!