Using arrays to avoid Repeat


Here’s one of the basic building blocks for avoiding Repeat nodes when you want to loop over the elements of an array. The “trick” is to use an array like [0, 1, 2, 3, 0, 1, 2, 3] as the indices for Select in Array. That way, you get an array that repeats the selected elements over and over. So instead of looping N times over an array of 4 elements, you simply have to process an array of 4 x N elements (in this example, the number of repeats N is = 3).

The above is effectively the equivalent to doing this using a Repeat node:

PS To build an array like [0, 1, 2, 3, 0, 1, 2, 3], you use the Modulo node:

To be continued…

One thought on “Using arrays to avoid Repeat

  1. Pingback: Hexagon tiling with ICE | eX-SI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s