Fit Curve Opens Curve

Odd issue with Fit Crv.3dm (170.9 KB)

I came across this closed polyline curve - when I apply FitCrv I am given a nicely smooth curve which is somehow open? It is as if the final corner (just before the seam) is ignored?

I would use _RebuildCrvNonUniform instead of _FitCrv since _FitCrv doesn’t really lead to a smooth curve with the inputs you mentioned. At least on the “arc” segment shown on my screenshot it adds points on the line segments.

Odd issue with Fit Crv.3dm (167.6 KB)

Thanks Martin, _RebuildCrvNonUniform does indeed keep the curve closed - however it does not keep the sharp corners sharp.

I suspect this is a goldilocks thing as there is no perfect curve fitting!

I was quite surprised to find a closed curve becoming open however.

If you want sharp corners, you’r probably have to split the curve at the corners.

I’d do this in Grasshopper. It’s simple to quickly explore different solutions…

Odd issue with Fit Crv.3dm (167.9 KB) (8.6 KB)

Hi David - so far I do not get the gap, here, at those settings in the latest build here, nor the hard corner to the right.


@pascal I get the same results as the OP using Version 7 SR21 (7.21.22208.13001, 2022-07-27).

Odd issue with Fit Crv DC01.3dm (2.7 MB)

Yeah - you’re right, sorry . Intereresting, or maybe not, that the polyline segments in the corners are just about fitting tolerance long.

Hm- as soon as the tolerance hits that segment length (.092) or above, the gap shows up. If the tolerance is set to the length of the segments in the lower corners, ‘resolution’ is lost there as well.


If the input curve is a valid closed curve then FitCrv should always output a closed curve. Looks like FitCrv needs a tune-up or the algorithm needs revising. This should go on the heap as a bug which needs fixing.

1 Like

Thank you all for looking at this, intriguing to see there might be a bug!

Thank you @martinsiegrist for the grasshopper script, I found this component in Kangeroo2 which does the splitting at the corners - which means I can preserve the corners accurately Split At Corners - Kangaroo 2 - Component for Grasshopper | Grasshopper Docs

1 Like