  We combine the physics of the ellipsoidal collapse model with the excursion
set theory to study the shapes of dark matter halos. In particular, we develop
an analytic approximation to the nonlinear evolution that is more accurate than
the Zeldovich approximation; we introduce a planar representation of halo axis
ratios, which allows a concise and intuitive description of the dynamics of
collapsing regions and allows one to relate the final shape of a halo to its
initial shape; we provide simple physical explanations for some empirical
fitting formulae obtained from numerical studies. Comparison with simulations
is challenging, as there is no agreement about how to define a non-spherical
gravitationally bound object. Nevertheless, we find that our model matches the
conditional minor-to-intermediate axis ratio distribution rather well, although
it disagrees with the numerical results in reproducing the minor-to-major axis
ratio distribution. In particular, the mass dependence of the minor-to-major
axis distribution appears to be the opposite to what is found in many previous
numerical studies, where low-mass halos are preferentially more spherical than
high-mass halos. In our model, the high-mass halos are predicted to be more
spherical, consistent with results based on a more recent and elaborate halo
finding algorithm, and with observations of the mass dependence of the shapes
of early-type galaxies. We suggest that some of the disagreement with some
previous numerical studies may be alleviated if we consider only isolated
halos.
