Added calculatePortalOrientation. (not finished)