Best planar nurbs approximation via arcs and lines

Hi everyone,

I’m trying to fit a spline into a polyarc given a set of points and a tolerance. In particular, my constrains are:

  • Tolerance expressed as the maximum distance between the original curve and the fitted one(which should be an input)
  • The lines that compose the fitted curve should start and end on one of the input points
    -The arches should pass at least for three points of the given set

The optimisation logic in general is to privilege (in this order), the lower number of segments and secondly the higher number of linear segments.
I’ve tried to use the tool given by BullAnt but it doesn’t take into account the point limitation and in my opinion this has to be made via some coded script. Galapagos is not an option (always in my opinion) since this optimisation has to be made on thousands of lines.

I’m also aware of the fact that given all these constrains the solution could not exist. In that case the algorithm should give an error or stick with the best result achieved.

Hope I’ve been clear enough. I attach a Rhino file with an example of the original spline, the list of points (always lying on the curve) and a kind of expected solution (which is probably not the optimised one).

Any help is very appreciated.
Thank you!
Example curve.3dm (38.2 KB)

Indeed: although there’s some stuff available as native components the general case for this requires code - let’s say in a way remotely “similar” to this:

Or the “inverse” of that:

Plus you need a detailed listing of errors - if errors happen. Are you familiar with C#?

Hi Peter, thanks for the quick reply!
Yeah somehow the logic should be similar to the papers you attached even if the constrains are a bit different.
I’m not very good with C#, I can read the code but not quite write it. Actually it is the first time I can’t manage to solve a problem only using Grasshopper

Well … let’s wait for some good Samaritan who could handle this via native GH stuff … and if not coding could save the queen.

Ahaha I’ve tried for the last few days but the only thing I got is a very long definition that goes nowhere.
The code was working until I got the limitation on the arches (the fact that they have to lay at least on three points) which complicates a lot the process in my opinion

Well … you should post the stuff that you have insofar (case: native components) in order to allow people to skip re-inventing the wheel.

Other than that: what’s the purpose? road/bridge/tunnel design? beam design? facade design? truss spine design?

Other than that: is this topology posted representative to your “average” case(s)? Or you have self-intersecting stuff? or not planar? or …well … something else?

So I’m uploading the code so far… it is not very efficient but that’s the best I came up with. Also there are components from BullAnt and Metahopper that I couldn’t manage to replace.

Second question: The purpose is aluminium fabrication, the spline is an architectural line that, in order to be fabricated, must be represented only with arches and lines and the arches must lay at least on three of the upstands(the point array).

The topology I posted is definitely the average one. The splines are always planar and never intersecting. (39.1 KB)

I don’t have these add-ons … but … wait for a second: Is it possible that the problem of yours is the inverse one? I.e. given a nurbs do the best approximation by a collection of arcs (plus maybe some line segments).

If so the thread title is wrong: should be “best planar nurbs approximation via arcs (and cats and dogs)”

If so I have C# stuff that does that (for creating heavy IPE/IPN “spines” for trusses [or structural members in general). The images below indicate just that: get a guide/indicative nurbs and do a collection of “best fit” arcs [cold bending heavy duty profiles etc etc] where N of arc segments is user coltrolled :

1 Like

Yes that is definitely what I meant… sorry if I have not been clear. I’m changing the title

Given a NURBS find the best approximation with arches and lines.

Your tool seems quite similar to the BullAnt component but in both cases it seems to me that the problem is that is not possible to take into account the point limitation. I mean the arches and lines that fit the NURBS should also have fixed control points (and these points are on the NURBS).

Hope I’ve been clear enough, if not feel free to ask again.

Well … the C# captured pays very little attention to absolute accuracy and fixed points since there’s no meaning for doing that (it just “approximates” an indicative guide rail via some heavy stuff - within AEC level of accuracy, so to speak).

On the other hand … the min length of a given arc is the most important real-life constrain : you don’t expect a 5 cm long stand alone alu sheet to be formed in any arc like shape blah, blah. This implicitly leads us towards waste material mamagement matters … and that is the biggest thing of them all.

Indeed the length of the arc is a very important variable to take into account. Maximising the length of the segments would be quite important.
There a lot of constrains in this analysis…

There’s a danger here: metaphorically speaking … get lost in the translation.

You said that the rail is some architectural footprint (facade or other). So unless God designed that one … why are you after so many constains? (I do hope not for satisfying the Architect [nobody cares about him in real-life]).

1 Like