# Misunderstanding sine wave and the graph mapper

When using the graph mapper to control an array of item, sometimes I have issues with the sine wave. For example, sometimes it will just double up items instead of creating a sine pattern. I don’t have the same problem with, for instance the bezier curve.

In this instance, I have an array of lines and would like to adjust their distribution so that they are spaced in a sine pattern. The distance of the array is fixed, but the spacing between items and the number of items are something that I’m trying to play with.

GH Definition:
screen wall.gh (13.2 KB)

Initial Sine Wave:

Adjusted Sine Wave (I was expecting a smooth series of waves here):

I’m sure this is a very basic question, embarrassed to ask since despite looking around I can’t get a handle on this. What am I misunderstanding about this tool?

There is no reason to remap numbers before they are passed into the graph mapper. Just use the range component and determine the amount of numbers in between 0 and 1.

Thanks for responding, I’m still getting this bunched up pattern instead of a series of gradual sine waves

Yes this makes sense. You pass in x values and you get y values in return.

0.0 0.3 0.5 0.8 0.5 0.3 0.0 0.3 0.5 … so you get 5,10, 15, 20, 15, 10 … offsets for your base point.
The move component does not add offsets to the previous point, but always to the reference

OK, I’m kinda understanding. Is there a way for me to intuitively get a pattern that resembles the sine wave in the graph mapper? I was hoping to use it to convert that list of 128 values from 0 to 1, into a series of waves based on the graph mapper.

The idea is that I have a series of fins along a wall and want to adjust their spacing parametrically, a sine wave was one of the ideas I’m toying with.

This is what I usually do:

graph mapper.gh (10.5 KB)

The most simple option:

• You create one single wave length and then you copy and paste n times. You can do this normalized (in between 0 and 1) and just scale 1 dimensional
1 Like

OK @TomTom so your saying I have it kinda backwards. I can’t divide up a set of distances with the sine wave of the graph mapper, I’ll have to build a fraction of the array into a wave and then multiply it. Kinda like this I suppose:

Is there a better way of intuitively dividing up an array into a harmonic pattern that you’d recommend? The sequences aren’t very smooth so I’d like tweak and adjust them, but maybe I’m doing this the wrong/hard way.

2 Likes

Mass Addition! What a facepalm on my part. Thanks very much.

Why? It is not obvious to take the partial results! This is the most unintuitive way you could solve this…

Hey @TomTom yeah I think both methods are pretty unintuitive. I should have tried Mass Addition from the beginning, don’t know why it slipped my mind.

If you have any other ideas I’d gladly try them.

Because Mass Additions does not necessarily have to return the partial results. A mass addition adds all values together in first place. The most intuitive way is a simple for-loop inside a script component. Because its something iterative, and GH sucks in this regard. I’m just saying you shouldn’t be facepalmed

1 Like

Thanks for that. Every time I feel like I’m getting the hang of GH something basic like the graph mapper throws me for a loop. The community is incredible.

Just start scripting as soon as possible. This way you can bypass all these workarounds… Especially data management becomes much easier with that. You could have simply wrote something like: Copy the previous point , move in x direction, add to a list and repeat until no offset value is left…

1 Like

Probably a hot topic, but do you recommend Python or C# for starting simple scripts like that? Just curious about your personal preference.

Both in parallel, probally in the beginning Python is more accessable, but in general talking to a C# library with the same language is better for the overall understanding. So even if you stick to Python, knowing a bit C# helps in the Rhino environment. I personally work with C#.

1 Like