Rebuild w/ free ends - How?


(David Cockey) #1

I need to rebuild polylines with hundreds of points into degree 3 NURBS with 5 to 20 points. Rebuild always forces the resulting NURBS to start and end at the starting and ending points of the polylines. My problem is the polylines are “noisy”, particularly close to the ends. Away from the ends the results from Rebuild do a nice job of interpolating through the noise. Any suggestions on how to have it do the same thing at the ends?


#2

Try rebuildcrvnonuniform


#3

Hi david, another way for multiple curves might be to shorten the polylines both sides to get rid of the noise near the ends. Then do the rebuild and extend the curves both sides.

Below script shortens or extends curves. Use a negative value to shorten or positive to extend. It will always be bothsides.

ExtendCurvesBothSides.rvb

To load the script, make shure the example path below points to the correct folder eg. make a new button to load and run it:

! _-LoadScript "C:\MyScriptFolder\ExendCurveBothSides.rvb"

@Ncik thanks, never used RebuildCrvNonUniform !

c.


(David Cockey) #4

RebuildCrvNonUniform and FitCrv behave the same, preserving the end points. And fair does the same when I start with wiggly degree 3 NURBS.


(David Cockey) #5

If I trim the polylines back I lose too much. What I need is an equivalent of LineThroughPt except which generates a degree 3 NURB rather than just a line. Essentially Patch for curves rather than surfaces.

Thanks for the suggestions.


#6

but isn`t a line always linear ? From your quote it sounds that extracting the points from the polylines and using LineThroughPt gets you lines which can be used to change the degree afterwards. Can you post one of these polylines ?

c.


#7

Maybe try creating some points on the curve, group select then fit a crv to the points.


(David Cockey) #8

I’m currently getting points from the polyline using Divide with a small length between points, then using CurveThroughPt to fit a degree 3 NURB to the points. However the number of points of the resulting NURB is the same as the number of points I start with, and the NURB goes through every input point. Then I “smooth” the NURB and reduce the number of control points using Rebuild, RebuildCrvNonUniform, FitCrv or Fair. This works well except near the ends where the smoothed curve goes to the first and last points I started with.

A line from LineThroughPt does not have to go through the first and last input points. A surface from Patch does not have to go throught the outer points and curves. I need the same functionality for degree 3 curves.


(David Cockey) #9

Another example is Circle with the FitPoints option. The resulting circle does not necessarily go through the end points


#10

Here is one other approach - I now use Grasshopper to smooth polylines for working with topographic data. Maybe the attached GH definition is useful…

Parameters:
Reduce tolerance - reduce the polyline segment count by removing extraneous segments within tolerance
Smooth factor and iterations - smooth the polyline if desired
Distance between points: an approximate distance between control points along the curve.
Curve degree - 1 to 5

I also have scripts to do similar things, but what I like about GH is that it’s WYSIWYG so you can adjust the stuff to taste then bake.

–Mitch

FixPolylines.gh(16.8 KB)

–Mitch