modified to handle 3D viewing space and inserted two triangles rotating in 3D space