Grasshopper

algorithmic modeling for Rhino

# Move Points in Z with Sine Function but with Specific Crest Point?

Hello all,

I am trying to achieve something quite simple I believe, I need to move the points on a straight line in z with a sine function of one frequency, but controlling where the crest is.

The idea is not to use graph mapper, as each crest point is pre determined for each curve. (So manually moving the crest in graph mapper does not work).

To be clear the end points of the curve should always come down to 0 z.

Like this: (using y direction for simplicity)

Thanks for any insight

Shynn

Views: 691

Attachments:

### Replies to This Discussion

Two equations. The top one just generates the infinite sine wave, the bottom one decides whether or not the current x is within the one wave around the crest. By multiplying the entire wave with either zero or one, you can suppress the other crests.

Attachments:

Hello David, thanks for your time and helping me out.

I see from the image that the sine curve does not end exactly in the end points. I wasn't clear enough but I realize now the wavelength control should be determined by the length of the curve segment.

So actually the curve would be spitted in two and completed with 2 half sine curves with different wavelengths.

Ah, the attached isn't what you asked for either (sorry). Instead of treating the regions to the left and the right as separate, this file applies a power-law to the entire curve parameter space to move the crest to the desired position. It's very smooth across the crest itself, however I suspect you don't like the way the falloff behaves.

Attachments:

Looks like a very simple bit of GH - surprised that it fails so badly?

Fixed, for the rest of us:

How hard would it be to upgrade GH 0.9.0076 with these components to avoid compatibility problems?  The only difference appears to be that they can handle multiple inputs?

P.S.  Sweet bit of code, by the way.

Attachments:

Ah yes, I'm using the GH for Rhino WIP, which has new and improved subtraction and multiplication components. I forgot that they won't load on older versions.

Hello,

I've just found the tutorial by Giulio Piacentino: How to create a Grasshopper component with the Python GHPY compiler. I've been a new user in the McNeel community, so I think some options are locked for me and thus I cannot copy the information and the codes. I tried to contact Giulio via email but still waiting for the reply (his email - giulio@mcneel.com).

This isn't a sine curve, it's a pair of 'BiArc' components.  Gets wacky when the 'Crest' nears either end of the line. (SineCurve_2017Sep17b.gh)

Another approach is to use David Rutten's code/curve as input, 'Shatter' it and replace the second "half" with a 'BiArc': (SineCurve_2017Sep17c.gh)

Attachments:

• View All