Grasshopper

algorithmic modeling for Rhino

help with equation in function component - catenary from two points - where is arcsinh function?

I want to calculate these equation in a function component:
sinh^(-1)[h/sqrt(s^2 - h^2)] - L/(2a) but it's not working...
Can someone help me with the correct syntax for the "expression editor" in grasshopper?

PD: "h", "L" and "a" are inputs variables.


I'm trying to do a catenary from two points like in these video: http://www.grasshopper3d.com/video/catenaria-1


The equation it's suppose to be the "A" constant in the catenary equation: y(x) = a cosh(x/a + A) + B
The "B" constant is B = -a cosh A

Views: 13112

Replies to This Discussion

Sinh(h/sqrt(a² - h²))^(-1)- L/(2*a)
Hi, thanks for answering.

What you write it's something like this:

1/Sinh(h/sqrt(a² - h²)) - L/(2*a)

but it think that it's not correct.

The original equation mean something like this: ArcSinh(h/sqrt(a² - h²)) - L/(2*a)
but the expression editor doesnt have a Arcsinh function. I try with Asinh, but it doesnt work either...

any solutions?
Wikipedia says it's "y = a*cosh(x/a)"
I just tried it and it works fine. At least it looks just like the graph:
http://en.wikipedia.org/wiki/Catenary#Mathematical_description
Hi Manuel, here are some inverses of hyperbolic functions:

Inverse Hyperbolic Sine: ArcSinH(X) = Math.Log(X + Math.Sqrt(X * X + 1));
Inverse Hyperbolic Cosine: ArcCosH(X) = Math.Log(X + Math.Sqrt(X * X - 1));
Inverse Hyperbolic Tangent: ArcTanH(X) = Math.Log((1 + X) / (1 - X)) * 0.5;

I remember the list being on the VBScript help, which can also be found here.

A sample in VB.net and C# scripts that should help you in your task is attached.
Attachments:
Hi Manuel,
Did you manage to make the catenary expression work?
All i managed to do from the wikipedia formula is this i have no clue how to make an arch from it

catenary.ghx:
VB.net is not case sensitive. So having two different inputs called 'A' and 'a' will not help.
Draw a straight line in rhino, reference it in GH, divide the line into multiple points, extract the position (length of curve) at each point, use that as the 'x' input in the formula. It will calculate a 'y' value for every 'x' value you input. Connect these 'y' values to a z-axis vector, use the resulting list of vectors to move the points, create an interpolated curve through the resulting points.... wait, that will probably give you half a catenary. Try subtracting half the length of the curve to every 'x' value.

You have the 'x' variable as an output, it should be an input. You can do all this using an expression component, no need for scripting.
So here is a quick study of what you proposed. I don't think its getting there. Doesn't quite look like a catenary.

My question has to do with defining the two launch points of the catenary. With Grasshopper for example, could you define the end points of a line as launch points of the catenary?
Hi Andrew and Manuel,

I was also playing with this some time ago and it actually turned out to be mostly a math challenge in the end. Luckily there is a number of math forums around, and this thread had a very useful discussion, with MatLab code by elbarto. .NET can do the same as the MatLab code with anonymous methods and delegates, so I just wrote a similar C# script and it works fine. You are free to change and improve it,

Giulio
________________________________________________________________
Giulio Piacentino - giulio@mcneel.com
McNeel Europe - Barcelona

Attachments:
Just inverting the z coordinate one can have the same graph for arches ("à la Gaudí"). See this definition.
Attachments:
Thanks again Giulio for posting this

the code looks simple, clean and nice...

I have worked a little with the catenary function, but had some problems dealing with catenaries that are not simetrical (diferent points) and also when the values were bigger that -1 ||| 1.

I attached the file, just to for... I don't know, might be usefull for somebody. My problem was coming from the function I used, the mathematical one with cosh, were I got the problems of.

Thanks again.
Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service