Index is getting reordered at output

(Me) #1

Hello, I’ve noticed the index of the input points seems to reorder at output. Is there a reason for this?
Kangaroo2IndexShift.gh (10.7 KB)

(Daniel Piker) #2

Particles get added to Kangaroo according to the order of the goals, so the order of the V output of the solver won’t necessarily correspond to some upstream ordering of points before the goals were created.
If you want to explicitly control the order of a list of points, you can connect that list to a show component, and retrieve them in the same order from the output like this:
pointorder.gh (13.3 KB)

1 Like
(Me) #3

Thank you for your quick reply! Unfortunately, when implementing the show component the output does not maintain the same tree structure as the input, though your example does. Any ideas?

Kangaroo2IndexReorder.gh (13.9 KB)

Also, out of curiosity, what does the V output from the solver correspond to?

(Daniel Piker) #4

Only the standard solver maintains the tree structure. In the next release the other solver options will also allow this, but in the meantime you can achieve the same thing with an unflatten component:

Also - the ‘StepSolver’ component is really only intended to make it easier to produce slider animations with Kangaroo, but for most purposes I recommend using the standard one just called ‘Solver’. Or if you really want to see the bouncing you can use the ‘BouncySolver’ (which converges more slowly).With both of these there is no need to connect a Grasshopper Timer component.
(also, when using the Step or Bouncy solver, the damping input should be a value between 0 and 1. Using 100 here could cause some strange behaviour)

Oh, and the V output is the list of all the particles in the simulation. This will usually differ from the points of the goals, because duplicates are removed (for instance, if you have a pair of lines where the end of one coincides with the start of the other, Kangaroo automatically combines these into a single particle).

(Me) #5

Great, thanks for your help!