completed math preliminaries and quaternions in 3d part