Can the direction be determined and then just flip it?
If a point is supposed be below another point and the calculations would move the point to the other side, can the code just put it on the proper side?
If a point is supposed be below another point and the calculations would move the point to the other side, can the code just put it on the proper side?