added convex hull calculation