2D and 3D Transformation in c++