Unit quaternion method for coordinate transformation