FitCrv degree 1 curves?

Any reason why fitCrv can’t work on degree 1 curves? I’ve taken a section through a rather rough mesh, and would like to somewhat smartly clean it up. FitCrv seems like it would be a decent tool to do this within my tolerance. Or am I missing something that would work better? SimplifyCrv doesn’t quite have the destructive power I need here.

Thanks,
Sam

Hi Sam - CurveThroughPolyline may help - note the command line options for Interpolate or ControlPoint, and degree.

-Pascal

1 Like

FitCrv does not work on polyline type objects unfortunately. What does work is either a Python script (my implementation attached below) or the Grasshopper “Reduce” component (which access the same RhinoCommon method as far as I know). You input a tolerance and the noise below the tolerance level is removed. What it does not do is change any polyline vertices, it just eliminates any that are within tolerance, thus reducing the number of segments. The curve remains a polyline.

(this is the theory behind the reduction algorithm)

ReducePolylines.py (2.0 KB)

Otherwise, the only thing I know is RebuildCrvNonUniform…

–Mitch

1 Like

I always use RebuildCrv for this.

So - I just noticed rebuildcrvnonuniform doesn’t have a degree option?

I was trying to simplify something like the below into something degree 1ish without needing to redraw them all. Perhaps there’s a way of checking certain angles at breakpoints to create point objects, and doing a closed polyline through them, with Grasshopper.

Yep, it only gives you degree 3 curves. Maybe _FitCrv can help here, it has an angle break option…

But unfortunately no degree 1 refit. Maybe it’s a silly thing to ask for, I’m not sure.

Hello - what does SimplifyCrv get you here?

-Pascal

hmm - not much of a result. Fitcrv does okay. I mean, so long as the break points are in the right place (fortunately they were), I can explode, rebuild at 2,d1 and I have a polyline. Would be interesting to see something which handles a more tricky case though, like the OP I guess.


simplify-that.3dm (54.2 KB)

Convert does a reasonable job- there are a couple of ugly curvature spikes in the original that makes it harder to fully clean up:

-Pascal

1 Like

Any reason why fitCrv can’t work on degree 1 curves?

My understanding of fitCrv is that it establishes control points based on curvature. Deg 1 has no curvature.

Thanks Michael - yeah, so I guess any ‘FitCrv’ tool that worked with degree one, would no longer be using the same technique as it does for other degrees.