Shape Variation and Optimization: A Geometrical Analysis