implementing automatic plane segmentation