Optimization techniques for segmenting 3D shapes