ShapeIndex Reversed

Discussion and Support related to the Frost particle mesher
User avatar
oatz
Posts: 388
Joined: Wed Oct 31, 2007 7:27 pm

ShapeIndex Reversed

Postby oatz » Wed May 17, 2017 4:06 pm

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).
ShapeIndex Order.jpg
ShapeIndex Order.jpg (586.63 KiB) Viewed 174 times

User avatar
Bobo
Posts: 5939
Joined: Tue Nov 15, 2005 10:26 am
Location: Vancouver, Canada
Contact:

Re: ShapeIndex Reversed

Postby Bobo » Wed May 17, 2017 6:28 pm

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

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.
Borislav "Bobo" Petrov
Product Specialist
Thinkbox Software Inc.

User avatar
oatz
Posts: 388
Joined: Wed Oct 31, 2007 7:27 pm

Re: ShapeIndex Reversed

Postby oatz » Fri May 19, 2017 10:03 am

Bobo wrote:It is not wrong, it is your value that is wrong :)

IMPOSSIBLE!!

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

Thanks.


Return to “Thinkbox Software - Frost”

Who is online

Users browsing this forum: No registered users and 2 guests