matrix transformation of vertex

Hi,

i have a transformation matrix made with quaternions. i multiplicate the matrix and my object is rotated perfectly.

but now i want to have the numbers of a direction vector also tranformed by the matrix.

So multiplicate matrix with vector and you have the transformed vector. NOT FOR ME. It don´t work.

I think i have some problem in my matrix-vecotr multiplication.

Here is the Code:

vector vektMatMulti(vector v)
{
	vector C;
	C.x=(matx[0]*v.x)+(matx[1]*v.y)+(matx[2]*v.z);
	C.y=(matx[4]*v.x)+(matx[5]*v.y)+(matx[6]*v.z);
	C.z=(matx[8]*v.x)+(matx[9]*v.y)+(matx[10]*v.z);
	return(C);
}  

When i draw the vector, it´s rotating. but it´s not rotating like the object i draw. the object is rotating around his own axis. the vector is rotating around the normal axis. But it´s the same transformation-matrix. what am i doing wrong?

ps. matx is the opengl transformation matrix.

The opengl transformation matrix is the transpose of the standard (there is a name - I forget) linear algebra matrix. Try:

vector vektMatMulti(vector v)
{
	vector C;
	C.x=(matx[0]*v.x)+(matx[4]*v.y)+(matx[8]*v.z);
	C.y=(matx[1]*v.x)+(matx[5]*v.y)+(matx[9]*v.z);
	C.z=(matx[2]*v.x)+(matx[6]*v.y)+(matx[10]*v.z);
	return(C);
}  

No, thats not the problem. My matrix-model is correct. It is rotating correct, exept the point that my model is rotating around his own axis and my vector not with the same transformation-matrix. ???

There has to be something very strange in my code!

You can see the code at:
http://www.roebbeling.de/3dstuff/main.c

It´s a complete desaster, because it´s not finished. (Don´t know if there is any diffrence if it´s finished)

Since you are dropping the final column of the matrix (i.e. not including it in the transformation) you are eliminating the translation transformation.

If you add vec.w*matrix[3,7,11,15] to each line of the matrix multiplication and then a C.w=… line, I think you may solve your problem.

Or it may do nothing it all, I might be misinterpreting your issue.