Shape Diameter Function and Its Applications in Mesh Processing