Automatic reconstruction of structured three-dimensional models