Cant have matrix multiplication work properly : <p>I have been trying to use homogeneous transformations on C++ but i cant get the matrix multiplication to work. Am I doing something wrong in the code?</p>

<p>I checked doing it by hand and it doesnt seem to be wrong. Did i miss something?</p>

<pre><code>#include "stdafx.h"
using namespace std;

float point[3][1];
float point_trans[3][1] = {0,0,0};
float rot[3][3] = { {1,2,3},{4,5,6},{7,8,9} };
float d[3][1] = {0,0,0};
float x,y,z;

float transform (float x1, float y1, float z1)
{
    point[0][0] = x1; 
    point[1][0] = y1;
    point[2][0] = z1;

    for(int i=0; i&lt;3; ++i)
    {
        for(int j=0; j&lt;1; ++j)
        {
            for(int k=0; k&lt;3; ++k)
            {
                point_trans[i][j]+=rot[i][k]*point[k][j];
            }
        }
    }

    x1 = point_trans[0][0] + d[0][0];
    y1 = point_trans[1][0] + d[1][0];
    z1 = point_trans[2][0] + d[2][0];

    return(x1,y1,z1);
}

int main()
{
    x = 6; y = 7; z = 8;

for(int i=0;i&lt;3;i++)
{
    for(int j=0;j&lt;3;j++)
    {
        cout &lt;&lt; rot[i][j] &lt;&lt; " ";
    }
    cout &lt;&lt; endl;
}


    (x,y,z) = transform(x,y,z);
    cout &lt;&lt; "X:" &lt;&lt; x &lt;&lt; " " &lt;&lt; "Y:"&lt;&lt;y&lt;&lt;" "&lt;&lt;"Z:"&lt;&lt;z&lt;&lt;endl;
    system("pause");
    return 0;

}
</code></pre>
