add quaternion mean function