From the last post, our points now own the “__LowestPointIndexInIsland” attribute set to the exactly lowest point index in the polygon island.

"__LowestPointIndexInIsland" per point attribute
Our goal now is to build a polygon island index attribute like this :
Once again, we need to think in which context we can see our data. If we stay in the “per point context”, we will only see one point at a time. It would be harder to build an algorithm to get our polygon island index this way.
But if we could build just an array (in per object context) of all our “__LowestPointIndexInIsland” attribute it would be easier to deal with (we will see latter how).
“Build Array from Per Point Data” :
In Softimage 2011, you just need to use a “Build Array from Per Point Data” compound. But you can easily build a similar one in any versions (and it will be an other excuse to learn something new !).

Build array from per point data
First we create an array with the same size as the number of points in our object.
Then we build an other array from the first one using its sub indices. Here is an example :
- Index : 0 . Array A data : a value > Array B data is Index 0.
- Index : 1 . Array A data : a value > Array B data is Index 1.
- …
- Index : n. Array A data : a value > Array B data is Index n.
If we feed an “ID to Location” node with this array, it will return an array of locations.
From this array, we can get all our “__LowestPointIndexInIsland” attributes in one go !

The “zipped” array :
Or how to create an array B [n, n+3, n+6] from an array A [n, n, n, n+3, n+3, n+3, n+6, n+6, n+6].
We need to iterate through array A values and push the value to array B only if it doesn’t exist in Array B.
The way you iterate along an array in ICE is using a Repeat node with the number of repeats set to the array size. We will need to build a repeat counter attribute to be able to select the “current value” in our Array A inside the repeat execution. As it is a common setup in ICE, I built my own compound some time ago to deal with this kind of executions.

zipped array graph
I usually name the iterator attribute “__ITERATOR_my_name”. This way it is easy to know from a get data that we are dealing with this kind of variable. It is always nice to be able to figure out a graph without zooming on each nodes. From the “zipped array graph” with can easily read that we get four attributes from the object istself (blue nodes) and that we set one attribute (the light blue one). In fact we also set the itterator attribute at each repeat execution but we already know that from its name. I’m hiding the iterator attributes from the explorer using “__” (as in ICE there is only one global name space).
Once you are comfortable with the Repeat node workflow, if your are using Softimage 2011, you can directly use the “Repeat with Counter” compound !
The index array :
Now from the array B [n, n+3, n+6] we can build an array C[n, n+1, n+2]. We will use again a Repeat node, an itterator and some Array nodes.

We are doing a very similar graph and finally get our Polygon Islands Index. If you haven’t download those compound from the first Polygon Islands post, here is the link again. Once the addon installed, you could dive inside the “Create Polygon Island Index” compound and figure out how it works.
Cheers !