A geometric approach to dislocation densities in semiconductors