Gravitational lensing by ellipsoidal mass distributions