The algorithm tends to over-trim when closing more complex curves. It tends to under-trim when the trimmed portion is large and runs tangent to the blend curve.
Both errors occur at random, depending on the geometry. The error rate is roughly 1 in 10 for the examples. In my daily use, this error happens at a similar rate.
Workarounds
I fix gaps with the Match operation plus occasional manual control point editing. I fix untrimmed sections with a Trim operation. When I miss the defects while drawing, I hunt them down during QC, using SelOpenCrv or the ShowEnds tool.
Impact of fix
Fixing the bug would reduce unnecessary operations and make arcblend easier to teach and use for our process. This would make the tool feel significantly more solid and dependable.
I suspect that arcblend uses a point-curve intersection solver that is nondeterministic and rarely freaks out and gives us wrong answers. I also suppose that it might be difficult to solve the instability in the intersection solver. However, the solver works most of the time, and the wrong solutions are very easy to detect.
Perhaps it’s enough to:
Trim the curve
Test that the trimmed endpoints match the blend curve’s endpoints
Hi @max.suica I could not repeat it here with these examples. Both gave me a closed curve after trimming and joining (both in command as well as afterward)
Do you have other examples that you could share?
Hi @Gijs, thank you for your attention to this problem. Here are two simpler examples, using a 3 segment polyline. They are both of the overtrim variety, where the operation cuts too much from one of the input curves.
In the first configuration I move one endpoint to a random point
In the second configuration I move both end points so that the two segments have nearly the same radius.
It should replicate within at most a couple dozen tries. In some configurations it won’t occur at all, in some configurations it will every 3 to10 tries. Please explore a few different configurations - it is pretty easy to run into the issue once you know it’s there.
The arcblend generation is fine. But we incorrectly apply the trim point, based on a code path that triggers at random.
Potential causes:
Maybe we we accidentally re-parameterize the curve before applying the trim point
maybe we give one parameter to the createarcblend function, but give a different parameter to the trim function
Maybe the trim function uses a numerical solver that can underconverge at random.
Possible regression testing plan:
Generate the polyline curve [0,0], [5,0], [5,5], [0,5]
Apply 1000 random blend parameters between the first and last segment of the curve
Assert that createarcblend and trim are called with identical parameters on identical curves
Assert that the results are all closed
Outcomes:
If some curves are open even though we always pass identical parameters, then the trim function is likely the culprit.
If we do not pass the same values, there is a logic error in the arcblend command.
Possible mitigation:
Add a validation step that verifies the curve is closed
Rerun the trim operation from scratch if the curve is open
This mitigation works because the operation will eventually work if you retry it.