programmed by chatGPT, this function replaces the old concaveHull method with a way simpler approach.