Grasshopper

algorithmic modeling for Rhino

Hi,

I need to extract the relative position of each vertex on a polyline made of straight lines.

In this sense, the start point has an l/L ratio (relative position) of 0 , the end point has an l/L ratio of 1, and I need to get that ratio for all the other points.

To get the parameters of these points on the polyline, I found nothing else than the "Discontinuity" component.

The problem is that if two consecutive segments are aligned, the vertex that they share will be ignored.

I'm sure there is a more robust way to do this, but I can't figure it out :(

Cheers,

Views: 20040

Attachments:

Replies to This Discussion

Hi Olivier,

[explode] will return all the vertices and [Curve closest point] will give you the parameter of each point on the polyline (if you want them in a 0 to 1 domain you will have to reparameterize the polyline).

Alternative without reparameterising (nowhere near as clean, I know...) :

(Graft the geometry input if you're using multiple polylines.)

Updated GH with inset component to include the first vertex value of 0...

Attachments:

Hi Joe,

Thanks a bunch !

I suppose that it works because the list of exploded segments is consistent with their location in the polyline.

I didn't know that the "Mass addition" component had this helpful "Partial results output" ; nice .

Cheers,

Just two more things:

1. You can get the same results if you use [discontinuity] and change the L input to "analytic"

2. The t parameter on polylines is a bit strange. The curve's domain is divided in equal parts between control points. That's why you get equal intervals from 0 to 1 no matter where the points are located. This is actually normal behavior but I think it doesn't give you the result you wanted.

If you want an l/L ratio you will have to do this manually:

edit:

just saw Joe's definition which does the same as mine but much faster... so only thing to keep from my post is that (t) is not l/L.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service