Helix Curve Equation with Fix Height?

Hello everyone,

I am currently trying to generate a definition that pretty much allows the control over a helix that the Rhino command does:

So far this is what I got:

Def: Helix.gh (5.9 KB)

This equation basically manages to control the radius of the helix., but nothing else.

The thing is that right now the height isnt fixed, and I cannot control the number of turns accurately.

Rhino does this by first asking for an axis, with x height.

So for a height=24.73 I want the helix to have 0.5 turns, this gives a pitch of 49.4652 according to rhino.
And you can alternate if you want to specify pitch or nr of turns, which can be done with a stream gate in gh.

Lastly, Rhino needs one more input, the staring point of the helix, which can be anywhere on the circle of the same radius.

So the equation should allow for: starting point/points, height, nr of turns or pitch, radius.

Anyone care to help me translate this into gh please?

1 Like

I’ll have to do this dry, I’ve broken my Grasshopper build for the day…

The starting point is just a constant angle (in radians) added to the X and Y components:

\{r \cdot cos(t+a), r \cdot sin(t+a), ct\}

The height and the number of turns together make up the c constant. I think it’s easier if you make t always go from zero to 2\pi, and instead add a scaling factor k to the equation which represents the total number of turns you’re looking for:

\{r\cdot cos(kt+a), r \cdot sin(kt+a), t\}

This should give you control over the total number of turns, the radius and the rotation. The height of your spiral however is now always equal to 2\pi. Thus, you need to divide the z-coordinate by this constant (unwanted) height and scale it to the desired height h:

\{r\cdot cos(kt+a), r \cdot sin(kt+a), \frac{h}{2\pi}t \}

I hope that all checks out, can’t test it myself right now.

1 Like

Thank you David, all seems fine but the z coordinate, unless I have input the wrong equation…

Helix2.gh (9.7 KB)

Little doubt, how do I convert division points on a circle into angles coordinates?

1 Like

(h/2*pi) is not the same as h/(2*pi).

The former (what you have now) is \frac{h}{2}\pi which is the same as \frac{h\pi}{2}, whereas what you need is \frac{h}{2\pi}

1 Like

Okay, everything checks out now, thanks.

Just one last thing regarding the startpoint. I have a circle, and I divide it and I want those points to be the starting points.

I converted from cartesian to polar, even using Peter Fotiadis script (same result) but the curves seem off.
Could it be the formula has trouble with negative values?

Helix3.gh (11.3 KB)

1 Like

No, Sine, Cosine and Tangent are perfectly well defined for both positive and negative values. The problem is that you’re using Atan to figure out the angle. Atan isn’t smart enough for this (it cannot be, since it only accepts a single input). You need the Atan2 method, which is available in the Expression language, but also via the To Polar component.

1 Like

Although of course dividing a circle into equal segments is the long way round in this case. You could just generate a series or range of numbers directly for the rotational angle.

1 Like