Curve To Polyline Problem

Hello,

I have a question about how the Curve to Polyline function works. In particular, when I set a minimum segment length (MinEdge) it is not respected. From what I understand, MinEdge guarantees you that the segments of the polyline are all of minimum length equal to the imposed MinEdge, correct? Below I attach a screenshot.

I’d like to understand the reason for this behavior. Even using a larger distance tolerance (or angular tolerance) does not guarantee MinEdge. Am I missing something?

Most probably your deviation tolerance overrides the minimum edge length.

Hard to tell when no GH file is posted, eh? :wink:

1 Like

I thought it wasn’t necessary as my doubt is related only to one function. Anyway, I post the file.

ctp.gh (17.8 KB)

I think you are right. But there is a problem. By imposing a maximum length, even a linear segment will be divided into sub-segments because a MaxEdge is imposed. If instead you use a very large MaxEdge, without tolerance, the polyline will not approximate well the original curve. I attach a screenshot.

By the way, one of my segment is still below the MinEdge.

Both min and max settings seem to be behaving erratically.
The only way I could make it stay within the boundaries was recreating the curve. (Which might be a problem since you have to raise it to the hundreds of control points if you want to be precise).
To me it looks like a bug.


erase.gh (15.8 KB)

Hello,

It seems to work. But the problem remains that even using a distance tolerance parameter, MinEdge is not respected. This problem does not appear when using angular tolerance.

It is strange :smiley:

Hi @Jacopo_Lettori,

How about this?

ctp.gh (6.6 KB)

– Dale

Hi @dale,

Thank you so much for the code,

However, with your solution I can’t check the tolerance, right?

I would need to guarantee a minimum length, which respects the tolerance I impose as much as possible

Hi @Jacopo_Lettori,

The function used by my my sample and by GH’s ToPoly component is Curve.ToPolyline, which returns a polyline approximation of a curve. There are several flavors of this method, which can make it easy get the solver into a position of compromise.

Why? What problem are you trying to solve?

In general, using the document’s default model absolute and angle tolerances work well. The link I provided (above) gives a good description of that each of these tolerances does. The help for Rhino’s Convert command, which uses the same function, does too.

If the resulting polyline points must reside on the input curve, then consider using GH’s Divide Length component and constructing a polyline from the results.

– Dale

Hello @dale,

Thank you so much for your help,

I would like to find the best polyline approximating the input curve for my applications. However, I have to guarantee a minimum segment length. So, if I use only MinEdge and MaxEdge, the resulting polyline will not be optimal because a linear curve will be divided according to MaxEdge. For my cases, there is no limit for MaxEdge (see the figure).

As noted from my example and the example of @anikolo, the MinEdge is not always respected. I read the documentation, and I think that the Curve to Polyline function should work as follow:
Create a polyline according to the imposed tolerance (distance/angular), respecting the MinEdge and MaxEdge.

Am I right? But it doesn’t work like that:

If we rebuild the initial curve, the function seems to respect the MinEdge (only with angular tolerance). However, the result depends on the number of control points.

If I understood correctly, your function in C# is the same as the block function on the Grasshopper canvas, right?

example_ctp.gh (23.8 KB)

I can use the Divide By Distance function, but I will obtain a redundant number of points to describe the initial curve.

Thank you so much,

Jacopo