new code for mapping 2d to 3d