BPS states from geometry and geometry from BPS states