Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Bug #681: Matrix Multiplication
Product:
TV3D SDK 6.5
Language:
C++
Current State:
Closed
Resolution:
Fixed
Created On:
March 27th, 2007
Last Modified:
March 27th, 2007
Reported By:
Norb
In tv_types.h I believe that you need to memset the resulting vec to 0. Otherwise the += gives you garbage.

cTV_3DMATRIX
cTV_3DMATRIX::operator * ( const cTV_3DMATRIX& mat ) const
{
cTV_3DMATRIX res;

memset( &res, 0, sizeof res );

for(int i = 0; i 4; i++)
{
for(int j = 0; j 4; j++)
{
for(int k = 0; k 4; k++)
{
res.mij += mik * mat.mkj;
}

}
}
return res;
}

Comments:

Posted by Norb on March 27th, 2007 at 6:02 AM
Actually I see the you always init your structs to 0 and I suggest setting it to 0 in the constructor. Not sure why you took it out.