ShapeIndex Reversed


Hello, I believe the list of geometry is being evaluated in reverse order than what it appears.

Here I have 3 shapes, RBC (Red Blood Cell), Platelet (spidery looking) and Testosterone. From the list, I would expect that the Shape Index for the top entry would be assigned to 0, Platelets to 1 and Testosterone 2.

However, from the screenshot you can see that the RBCs are placed on the blue particles (ShapeIndex 2).


It is not wrong, it is your value that is wrong :slight_smile:

The ShapeIndex is 1-based. So the RBC has index 1, the Platelet is 2, and the Testosterone is 3.
But in your Magma, where a Mux is 0-based, the MXSInteger produces blue when the value is 1, and green when the value is 2, and red when the value is 0.

But a value of 0 would pick the 3rd shape from the list (the shapes will cycle by modulo if the ShapeIndex is out of range). So a value of 4 or -2 will pick the first shape again, a value of -1 will pick the second shape… You could add a Clamp operator to the Magma to ensure that any values less than 1 and higher than 3 are clamped to 1 and 3, in case the content of MXSInteger is not guaranteed to be in the range from 1 to 3.

In short,

  • If the MXSInteger is zero-based out of Particle Flow, then you need to ADD 1 to it before sending it out to ShapeIndex.
  • If the MXSInteger is one-based out of Particle Flow, then you need to SUBTRACT 1 before sending it into the Mux’ Selector socket.



Oh yeah, I had been living in a 0-based world for a long time and was just going back and forgotten.