Is the domain of a polyline linear?

Hi all!

While i was trying to get a subcurve from 2 different open polylines I encountered the following situation.
I thought that the domain of a curve was constant as long as there weren’t areas of different curvature, and i thought the curvature of a polyline was zero, so trying to get a subcurve with the gh subcurve component and substracting the same number from the beginning and end of a normalized curve domain would get me the same distance trimmed in both sides.

But it seems that it doesn’t happen. If someone was kind enough to explain it to me, that would be great as i cannot find anything related in google or in the forum.

It seems to have something to do with the acute kinks of one of the curves

I have attached a file explaining what i mean, in case i dont make sense.

Thanks in advance
Gh Domain not constant in polyline.gh (27.4 KB)

Short answer is the math doesn’t work like you want it to.

First a bit about terminology to avoid confusion. Each point along a NURBS line or curve is associated with a parameter. The parameter of a line or a curve has a domain which is how much “space” the parameter covers. So if the parameter in a line goes from 0.27 to 1.73 the domain is 0.27 to 1.73.

In a single span of a degree 1 line the parameter is linear with the distance along the curve.

Across multiple spans of a single degree 1 line or a polyline (multiple lines joined into a single object) the parameter usually is not linear with distance. The relationship between the parameter and distance is usually different in each span or segment. It is possible to create new multiple span lines and polylines with the relationship between the parameter and distance is constant. But if a control point is moved that relationship will change and not remain constant.

Bottom line - don’t count on equal increments of the parameter / changes in domain size to correspond to equal lengths.

1 Like

Thanks David!

I always thought that as along as there is no change in curvature i could make the assumption of increments of the parameter / changes in domain size to correspond to equal lengths.

Seems i have to dust off some books!

Hi, @julove_93,
Maybe the examples below help to clarify the distinction between curve length and curve domain, and how you can use the Evaluate Length component to trim curve ends.


Same length trim segments for each curve, but different lengths between the curves.


Same length trim segments for each curve, the same length for both curves.

Best,
Gh Domain not constant in polyline_L.gh (19.0 KB)

1 Like

Just to answer the topic question, which appears unaddressed. The parameter space of a polyline goes from zero to the segment count, where “the integer part of the parameter indicates the index of the segment” and the float part is the linear interpolation along the segment line. Here’s a quick example demonstrating this:


220824_EvalutePolyline_00.gh (11.9 KB)

7 Likes

Update to my previous comments:

A polyline when created will have the parameter corresponding to the distance along the curve. However If a vertex is moved the length of curve segments will generally change but the parameter will stay the same. In that case the parameter will no long match the distance along the curve.

It is usually preferable to shorten a polyline using a method which works directly with length, not one which uses the parameter.

2 Likes

Thank you all for your responses. But it is not clicking in me, because if i reparameterize both curves and evaluate those crvs at a length of lets say 1m, then with the t that i get from evalcrv i construct a domain from “t” to “1-t” and use it to get a subcrv, shouldnt i get a crv with length = Original less 2m since i reparameterized the crv?

I uploaded a new file explaining each step


V2 Gh Domain not constant in polyline.gh (15.7 KB)

It has something to do with what David says and a missinterpretation of “reparameterizing” by myself.
First because if I create a new polyline with several curves my last gh file shows what i would expect, but when i drag one vertex of the polyline it starts deviating.

Second, I thought that after you reparameterized a polyline you ended with a parameterization with a linear behaviour (or something like this) in which an increment in parameterization meant an increment in length in any given point of the curve. Then an increment of 0.02t would mean 1m in length at any t value. Is this true with polylines or not?

Thanks in advance

Hi, @julove_93, I have rebuilt your polylines from segments in Grasshopper and managed to make your logic work (in Rhino7).

But it is unclear to me why you persist in using this method, the definition attached earlier (image below) would be more reliable for trimming the ends.

To see the -t- distribution on a specific curve, you could simply create a short definition for analysis, using a range of -t- values.

To sum up, reparameterization changes the bounds (start and end values, i.e. the domain) not the distribution of -t- parameters. Skewing segments by moving the control points, affect the parameter distribution, not the domain. So, if I understand you correctly, the “reparameterization” is irrelevant to what you’re trying to achieve here with the Evaluate Length component. Where it might seem relevant, it’s only because of how you construct the domains in your definition.

Hope this helps, I recommend creating a definition for analysis and investigating this.

Best.

V2 Gh Domain not constant in polyline_Lina.gh (20.0 KB)

WOW thank you very much Lina!

It was not about offsetting the endpoints on a curve but about learning about that internal distribution of -t- parameters that you are talking about in your last paragraph! I could not understand the variation or what was happening, but with that last definition it becomes very visual!
Thank you very much!

P.D.: The file you attached is not the file shown in the pics, so i recreated it and posted so anyone can have a look. Thanks again!

V2 Gh Domain not constant in polyline_LinaSolution.gh (20.0 KB)

1 Like