changed that translation vector and rotation matrix are calculated only once