start porting bezier curve to line segment logic