Grasshopper

algorithmic modeling for Rhino

I'd like to subdivide a curve into segments with equal chord heights. I know I can divide into equal chord lengths with the Divide Distance tool, but I can't find a height option.

I've written some really dirty code that does it here. Don't judge me, it's inelegant and inefficient, but it does the job.

What I'd really like to hear is that there's no point in going on to make something like a binary search because there's already a feature that does it, but failing that, does anyone have any suggestions on how to do it in a more efficient way?

Views: 1612

Attachments:

Replies to This Discussion

Is it just equal heights or is it division for a specific height? The latter would be easier as you can take it one segment at a time.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

For the moment just a single/list of chord heights would do. I suppose people might like to find a way to make it fit their curve exactly, but I'm not overly fussed about that.

I'm trying to get this done using Curve Deviation SDK functions but it's taking for frikkin' ever. If I do get something that actually works and completes in under a minute for an average curve I'll let you know...

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I asked on stack overflow here:http://stackoverflow.com/questions/15941728/divide-curve-by-chord-h...

And got a pretty hardcore answer that's going me some time to unpack, but if is of any help to you...

Hi Ben,

not sure if this helps, and probably you've found this out already, but if you wanted to just control the maximum chord height there is a built-in method ToPolyline, which is part of the Curve class. The tolerance attribute will control the maximum deviation from the input curve which corresponds to the chord height. So you could do something like this:

Dim _poly As PolylineCurve = C.ToPolyline(0, 1, 0, 0, 0, t, 0, 0, True)

where t is your tolerance value.

Best,

Tobias

Thanks Tobias, I hadn't found that. I'll have to play with it some more to see if I can get more control over it, but at the moment I can't see a way to get a precise chord height. That said, if you just want more subdivisions in curvy bits then it is great; much faster and simpler!

The squares are where the .toPolyline() method chops the curve and the circles are where the search chops it.

If you want to have a play with the file, look here ().

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service