I have encountered this curve which unlike a hundred similar refuses to go through Curve.Simplify method - null is returned for every variation of options I have tried.
When I call Curve.ToArcsAndLines method I get the result in Blue - which is unhelpful as it is clearly wrong to the eye but not to my code.
Of course I can fix this curve manually using Rebuild but I’d really like to know:
What is “wrong” with this curve to cause it to fail. Is there some property I can test for to treat such curves differently?
How come Convert on the Rhino command line successfully converts it to Arcs but Curve.ToArcsAndLines method fails
Anything I can do to more robustly convert to Arcs and Lines in RhinoCommon? Usually Simply is suggested but it is failing.
Any ideas for an efficient check I could add to pick up quiet failures to detect situations when the blue curve clearly isnt a good representation of the green curve?
On the more positive side these methods work fine on tens of thousands of curves per week without any issues - RhinoCommon is very robust - which is why I am keen to know why this curve is so Stubborn!
Thanks Dan, I’ve tried many variations 0.1 0.01 0.001 and 1e-8 and 1 degree and 0.01 degrees (in radians) but no found a variation which succeeds. I’ve also tried the default document tolerances.
as it is a curve I generate, here an GH file with a curve internalized. This curve as some identical control points. So I must make an error somewhere in my tool. The Nurbs curve is made using points from a polyline and polyline is the border of a mesh.
Using my Nautilus tools that uses Rhincommon and others tools, I have the same errors as described. But if duplicate control point is removed there is not the error.
Also if curve is transformed to polyline then transformed to line and arc there is no error!
Good spot with the identical control points, though I’ve had a go with NurbsCurvePointList.ValidateSpacing method and I can see dozens of curves from my test bench which have duplicate (“stacked”) control points which do not cause RhinoCommon to produce strange results.