Grasshopper

algorithmic modeling for Rhino

Hi all,

After searching through the forum and finding these three discussions on catenary curves, I still have not found something workable for what I am trying to do. Like Michael, I am trying to make a catenary curve based on the sag height of the chain (or height of the arch) as opposed to the chain length that Grasshopper already provides. While the scripts made by Daniel (here) and Lukas (here) were impressive and helpful, I need to be able to input start & end points that aren't necessarily at the same height and still be able to specify the overall maximum height (from the higher point) of the catenary. I couldn't get either of their scripts to work for that. I tried modifying their code (after converting Daniel's C# to VB), but didn't get very far due to not knowing the Rhino SDK very well. Basically, I would like to make a component like one I laid out in the image below.

Inputs: Point A, Point B (not necessarily at the same height), Height (or sag), a Point the specified height is relative to, Direction of gravity (so Height is measured in this direction), and possibly the Number of control points desired for building the curve.

Outputs: the interpolated Curve, maybe the Control Points used to build the Curve, and it might be handy to output the Length of the Curve (chain/arch) as well as the mysterious "a" value in the standard catenary formula since we'll need to calculate those anyway.

Alternatively, a second option (the 2nd VB component with fewer parameters in the image) is much simpler and could potentially replace/upgrade the catenary component already in Grasshopper. "Type" would be the type of parameter we're inputting to get the desired curve: either max height, chain length (which the current component already does), or the "a" value, useful for making an extended curve with a pre-determined "a" value (maybe?). And the "Val" would obviously be that value (length, height, or a). "Grav" is gravity direction/vector. As for the output, the curve is obviously necessary, but maybe outputting the "a" value or the length might be helpful. Seems like this addition to the existing component would be pretty useful, especially for architecture.

I've included the ghx file with the scripts in progress...the first one is a straight conversion of Daniel's. The second, my trying to modify it with the new parameters (which is where I got stuck...seems to be hard-coded to the XZ plane). And the third, just a visual representation of the simplest (and most ideal?) form.

Thanks for any help you can provide!

Cheers,

Will

Views: 6745

Attachments:

Replies to This Discussion

The wolfram links also to http://mathworld.wolfram.com/Roulette.html , awesome.

That first link was super helpful. I was able to convert the C code at the bottom to VB and am currently working on modifying it to work in Grasshopper. It's looking promising!

Cheers

This is what I've done after all... It's not perfect as there it might not be possible to calculate the curve algebraically(?).

So I managed to prune down the whole problem to one variable a (in catenary=cosh(x/a)). 

If you're interested in the math behind it I may just write it down here. I also have a big equation which may be a solution for finding this "a" number, but there are imaginary numbers and this is math going far beyond my comprehence. The current script just starts with "a=0" and increases it slowly looking for a good curve*.

The def with vb script is in the attachment. I will post it later as .gha to milkbox group.

*Actually it looks for horizontal distance between 2 points on catenary curve, but the curve does not need to be constructed.

EDIT: There is a bug with final curve orientation, but the curve is a proper one.

Attachments:

Very nice

...and this is the equation which I'm stuck at. The only unknown here is "a". So what we need is to write it as a=.... .If someone is willing to solve it , I can elaborate more why it looks like that.

8 opening brackets and 10 closing brackets? And what does the x mean?

--

David Rutten

david@mcneel.com

I will correct it and explain all the letters if you really want to solve it. So ?

There's also a squareroot of a negative number in there as far as I can tell, which makes this a complex problem, correct?

--

David Rutten

david@mcneel.com

Sorry, that above equation was a bit more wrong (I have it all on paper, and my handwriting is chaotic).

H = desired catenary height measured from top point

d = vertical distance between 2 points

X = horizontal distance between 2 points

EDIT : So yes, in some cases it may be complex. It's when d>H which means that the resulting catenary minimal point is beyond x1->x2 domain. You can see it happening in my vb script too, when you set catenary height too low (it just does nothing).

I can't get Wolfram Alpha to play ball and there's no way I can solve for a myself. Too bad...

--

David Rutten

david@mcneel.com

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