Multiply Vector4 and Matrix4 ?
Posted Thursday, 20 November, 2008 - 10:32 by objarni in
I'm trying to multiply a Vector4 and a Matrix4,
Vector4 v;
Matrix4 m;
// what I want to do:
Vector4 result = m*v; // opengl-style linear algebra
Matrix4 m;
// what I want to do:
Vector4 result = m*v; // opengl-style linear algebra
I've looked in v, m, Vector4 and Matrix4 for "Mult" or "Apply" methods, and also operator overloads -- but I can't seem to find this.




Comments
Nov 20
17:27:48Re: Multiply Vector4 and Matrix4 ?
posted by objarniAnyone?
Nov 20
18:16:46Re: Multiply Vector4 and Matrix4 ?
posted by InertiaVector4 result = Vector4.Transform( m, v );
Nov 20
23:03:54Re: Multiply Vector4 and Matrix4 ?
posted by puklaus"Vector4.Transform( m, v );"
I never even thinked, maybe Mul() / Mult() -methods too, even they do the same thing?
Nov 21
07:00:33Re: Multiply Vector4 and Matrix4 ?
posted by objarniThanks!
Actually, the parameters are switched:
Vector4 result = Vector4.Transform(v, m);