better algo and precision control for converting curves to arc