The Mathematics of Urban Morphology