Which command to best fit a smooth curve through a scattering of points?

Hi
V5

I have a gentle arcing scattering of points, some of which are almost one above the other, using CurveThroughPoints creates a curve which is not smooth but a bit wriggly as it tries to acomodate these points.

I need a command that places a gentle arcing curve through such a distribution of points.

Attached the points in question. blue curve was the result, magenta is drawn by hand and is not the result of a points command as such and is indicative of what I seek.

What command is best here ?

curve smooth through points.3dm (44.3 KB)

Steve

Hi Steve,

How about this:
After you run _CurveThroughPoints to get the result like the blue curve; _Rebuild the blue curve with a low point count (say lower than 9 points), this will get a smooth curve “averaging through” the points.

-Willem

Dunno, in this particular case I might use Curve>FitToPoints, and then rebuild that curve with very few points (say 4 or 5). I would also make sure that each end has a unique start/end point, on one end you have a cluster of 4 points. --Mitch

For _CurveThroughPt I would also use Knots=SqrtChord (instead of Uniform).

1 Like

If you want a true arc, Circle > FitPoints is a good one.

-Pascal

Already made a script for that one for Steve last summer… Here is a revised version with a couple more fixes/options…

–Mitch

AverageArcThruPoints3.py (3.2 KB)

1 Like

Hi,

That is I think Curve>Freeform>Fit to points am I right ?

It would seem to give the same as Curve through points.

I then used the suggested rebuild and tried values from 9 to 4, curvature graph for 4 looked best though 5 or 6 might have done. 4 gave a very regular graph so I ran with that.

I tried just altering this but still got a curve trying to join up every point.

The curve was not an arc as such, thanks for the reminders and suggestions.

I think there is a need here to add an icon to our toolset showing a curve through a lot of scattered points and a command that after using CurveThroughPoints gives next step as rebuild choice of points.

Maybe otherwise have an option to show such icons with the two stage commands as text instructions in a searchable library of extras.

It would take Spock to remember all the extra plugins and command stages we have extra to what exists in V5.

I would never have found Curve>Free form >fit to points

Steve

Just make a macro something like this:

! _CurveThroughPt _Pause _Degree=3 _CurveType=_Interpolated _Knots=_Uniform _Closed=_No _Enter _SelLast _Rebuild

Then make a toolbar button and your own icon for it. --Mitch

Going on 5 years, but would love to try this script!

Yeah, looks like that one got lost in the shuffle, here it is again…

AverageArcThruPoints3.py (3.2 KB)

1 Like

In case it helps, I have some related tools lying around in this plug-in. I think they mostly work:

3PtArcFromPoints
3PtArcFromPolyline
ArcFitToCurve
ArcFitToPoints
ArcFitToPolyline
RadiusFrom3Pts
SetArcDegrees
SetArcRadians
SetCurveLength
SubCrvFromMid

CurveAndArcUtilities.rhp (52 KB)

-Pascal

Hi
V5
Helvetosaur…AverageArcThruPoints3.py script

Is that creating an arc of single radius through a scattering of points or varying radii as I am yet again finding myself needing, just a best fit curve with a decent curvature graph result, all radiating out on one side only, except for base where it curves the other way. Its the edge trace of a propeller blade starting at root, ending at a damaged tip with some minor damage along the sides.

Cheers
Steve

Yes, that creates a circular arc - therefore of a single, uniform radius.

Hi,
V5.

Surely there is an ‘auto fit curve outwards to best fit points’ method ? such a fundamental basic need.
This below is not acceptable as a curve where it should all be curving outwards except at its base. Alter the point count and the tip loses its shape.
Not sure if altering point count causes curve only outwards though anyway.

Note the kinky curvature this was using the macro script below and 31 pts not original 51.


I am needing to create a best fit curve ‘outwards’ of varying radii through or near the points, an edge of propeller blade shape, so what command or whatever should I use? I have made a button for this macro from Helvetosaur
! _CurveThroughPt _Pause _Degree=3 _CurveType=_Interpolated _Knots=_Uniform _Closed=_No _Enter _SelLast _Rebuild

I have run it and I find it loses the tighter curve at top completely., I have to use 31 to acquire that curve but its wandering inwards and outwards and has kinks.

There has to be a best fit to guidance points method somewhere. Surely such a basic thing exists ? I use the term guidance as I don’t expect the curve to target the points and wriggle its way through(hitting) them, they are guidance for a curve to make a lovely curve maybe or maybe not hitting them, but getting as close as possible.

I am wondering how to use the Python Script, does one also make a button for that and how ?

I have never used Python Script.

However that is for an arc.

I need a curve.

attached the points. they start and end tangent to the first three points which are blade root ‘cylinder shape’
Propeller blade trace v1.3dm (48.6 KB)

Pascal, I placed three points and chose arcFitToPoints and nothing happened.
3ptarcfromPoints drew an arc between them

None of the commands in the plugin do my ‘best fit curve outwards’ though.
Hours spent trying to get a simple curve :frowning:
Cheers
Steve

ArcFitToPoints does a decent job on these it seems to me. You’ll want to tune up with properly tangent arcs, but if arcs is what you are after this seems at least reasonable.

-Pascal

Hi @Steve1,

I don’t know enough about propellers to fill in the missing points near the tip realistically, but here’s a curve using standard Rhino 5 commands that seems to smooth out the approximations of the points pretty well:

Is that good enough? If so, I’ll explain the steps I took.

Regards
Jeremy

Hi Jeremy,
very nice, that will do me, please do explain.

Pascal, thanks, the edge of a propeller blade will not be based on an arc as far as I know, a french curve is a curve with varying radii curves throughout, its more like that I think, if it is a series of joined up arcs, then as each arc departs the line e.g Jeremy has , heading inwards, it would need a curve to make up the gap tangential to the arcs, not sure how to do so, blendCrv I guess.
I have curves other than this that are not a series of differing radii arcs but certainly more of a French curve. To know how to place a best fit curve through points scattered along a french curve type of path is a vital tool for me.

Steve

There isn’t, as trying to get a “best” fit at some point becomes more art than science, it’s what “fairing” is all about. For one thing, there’s no way your input points are actually accurate enough–as in not enough accuracy is possible on a digital computer, nevermind any measuring tool–for any sort of automated fitting to be both super-smooth and consistently accurate to the input, YOU have to judge what looks right.

I’m aiming to get to some simple, lowish point count curves, but it’ll be easier if I handle the long straightish edges and the tightly curved tip seperately. So I created a split line roughly where the radius tightens.

Then I selected all the points on the left hand edge, up to one beyond the split and ran _CurveThroughPt with Closed=No. I did the same with the right side. Then with the tip, including a point below the split line on each side.

I used the split line to trim off the overlaps I’d created, then ran _Match to curvature match the tip curve to each side curve. Then I ran _Fair twice on each curve with a tolerance of 3, before running _Match on the tip again.

Next I used _Rebuild on each curve to reduce it to nine points. For each of the two sides I manually added a couple of control points near the bottom so I could follow the short straight section and the kick out. I adjusted the control points as necessary to get the curve visually closer to the original points.

Finally I adjusted the tip control points to get what seemed a reasonable profile (you’ll have a better idea what that is) followed by curvature matching the tip curve to the side curves again. I iterated over these steps a couple of times until I was satisfied, before joining the three curves.

Propeller blade trace v1_J.3dm (70.2 KB)

HTH
Jeremy