Open lorenzncode opened 2 years ago
Yup that can happen - we are using a numerical solver. I'm not sure that I understand your proposal. I'd be against arbitrarily changing the starting point.
Would you be against changing angle_cost
to address this?
https://github.com/CadQuery/cadquery/blob/4fcada66e9fb5d8cebfdf78376154b7b253df991/cadquery/occ_impl/sketch_solver.py#L136
Say by rotating the tangent vector v1 by TOL based on the IsOpposite check?
if v1.IsOpposite(v2,TOL/2):
v1 = v1.Rotated(TOL)
Example of "bad" or problematic starting point:
Another example with segment-arc when tangents are opposite:
Starting point before solve:
I'm testing a fix for this issue by checking if the tangent vectors are opposite, then rotating one of the vectors to push the optimizer in one direction (maybe need to check parallel for other cases):
So far this appears to be working in my testing.