In this demo composition Getting the next item in a list in a process list cycle v 1.1.vuo I'm not getting the Process List node to cycle the list as I think it should.

But beyond that I can't even get it repeat the same item from the list with a constant value to the "Which" input of Get Item From List.

This is an attempt to find a way in Vuo to reference other values in a list while working on each item in the list.

EDIT The desired result of this composition if you hover over the output port of the Process List node:

  1. {a, b, c, d, e, f, g, h, I}

  2. {b, c, d, e, f, g, h, i, a}

  3. {c, d, e, f, g, h, i, a, b}

  4. {d, e, f, g, h, i, a, b, c}

etc

EDIT Updated comp with Hold List node so now Count Within Range node fires at least once per process list iteration.

This comp if it worked would cycle the letters in the list each time the Fire Periodically node fires. I know there are probably other ways to do this simple example, but I'm not after cycling of a list, I'm after a way to reference the next item in a list in a calculation in the same or another list.

In pseudo code it would look like this

List A :: a list of letters e.g. {a, b, c, … I}

for all items of list A, List A [car #n] = List A [car #n+1]. -- noting that n+1 wraps from the last car in list to first car in list wait 1 second repeat

Phoning a friend here!

Comments

Okay I put a Hold List node

useful design's picture
Submitted by

Okay I put a Hold List node in and now the Count Within Range seems to fire.

I put show events on but there's no way of seeing the 9 events within the Process List iteration, it only blinks once each second when that node fires. I guess that is how VUO is wired to show events? individual Prices Item firings don't get their own blink? maybe they should get a different type of blink so we know where they are going?

The list is still not cycling in the Process List node.

Or for a more complex example

useful design's picture
Submitted by

Or for a more complex example more related to what I'm making this simple construct for…

List A :: list of 3D points (X, Y, Z) where (X,Y) is the position of a car on a circular track in polar geometry (r, φ) i.e X= r and Y = φ and Z is the speed (angular velocity) of the car around the track. All values except for X (r), which is a constant for all cars, are to be recalculated every frame. List B :: list of real values of each car's acceleration.

List A values can be recalculated iterating List A based on it's own current values List A [#n] and the value of it's acceleration List B [#n]. I think this is achivable with a Process List node and perhaps a Cycle Through List for the List B inside the loop as per the Wobble Eggs Example comp. I haven't managed to do something like this yet.

List B values will be subject to some logic tests based on the values for car n in List A and values for car n+1 in List A. It's the n+1 which is doing my head in trying to find a neat way to do this in VUO. Calculate List is ruled out for several reasons, can only accept one dimensional lists being the first, but even if I split the data into four lists A, B, C and D and operated on each, I can't reference the index outside the node, and inside the node I can't reference the index plus one. So that's a no go in two ways.

Alastair (@usefuldesign), you

jstrecker's picture
Submitted by

Alastair (@usefuldesign), you might have gotten your problem solved on another thread, but for anyone else with a similar question…

In this demo composition Getting the next item in a list in a process list cycle v 1.1.vuo I'm not getting the Process List node to cycle the list as I think it should.

To cycle the way you described, I would actually recommend using Take from List and Add List:

But as a mental exercise, here is how you could do it with Build List:

All values except for X (r), which is a constant for all cars, are to be recalculated every frame.

You may want to take a look at Magneson (@MartinusMagneson)'s PetriDish.vuo on this thread.

Thanks Jaymie (@jstrecker)

useful design's picture
Submitted by

Thanks Jaymie (@jstrecker) your first solution is elegant.

The purpose of this exercise wasn't so much to find the optimal way to do this item shuffling task, but for me to generalise solutions for referencing any item in a list at any given time in a loop, or in secondary list, while looping through a list of point data.

I actually have two lists to solve for. The reason for dividing my data into two lists was to do with the composition I'm making explained in the third post, the data is position, speed and acceleration values for a group of cars going around a circulate track. Cars are to autonomously adjust their acceleration based on a set of rules. Position and velocity need to be calculated per frame, but acculturation doesn't and adds some realism too I thought to do twice a second (avoids me working out how to put a time stamp and test that before I change acceleration too). I guess I'm not really saving much CPU energy, but seemed smart to seperate the calculation for acceleration.

Here's my build list solution, it's pretty simple in the end, but had to learn about extra events sneaking into Build and Process loops and how to keep them under control with extra Hold Value/List nodes.