int main(void)
{
    Matrix4x4 mat;
    const double v[]=
    {
        6.0,1.0,4.0,9.0,
        9.0,8.0,6.0,1.0,
        7.0,2.0,9.0,4.0,
        1.0,7.0,5.0,9.0
    };
    for(int i=0; i<16; ++i)
    {
        const int r=1+i/4;
        const int c=1+i%4;
        mat.Set(r,c,v[i]);
    }
    mat.Print();
    mat.Transpose();
    printf("\n");
    mat.Print();
    // If you go for extra credit, uncomment the following three lines.
    // printf("\n");
    // mat.Invert();
    // mat.Print();
    return 0;
}
Example #2
0
Matrix4x4 Frame::GetTransformationMatrix(const Date& t, const Frame& ref) const
{
	Matrix4x4 transform = Matrix4x4::Zero;

	Vector3 x = AxisX(t, ref);
	Vector3 y = AxisY(t, ref);
	Vector3 z = AxisZ(t, ref);

	for(int row = 0; row < 3; row++)
	{
		transform.Set(row, 0, x[row]);
		transform.Set(row, 1, y[row]);
		transform.Set(row, 2, z[row]);
	}

	transform.Set(3, 3, 1.0);

	return transform;
}