Polygon Islands : Getting the Lowest Point Index Part 2

Warning : This is not really a step by step tutorial on how to build this compound but rather an attempt to show how you can translate an idea in “ICE language” .

_____

So now that we can easily get our point index, it is time to see the concept of “Location” :

From a location you can get all the attributes of the context (of this location). The attributes will be interpolated between the context attributes around the location. …well, lets take a more explicit example.
In real life, a location is more than just a position. For example, if I’m located in Paris, I can see the Eiffel tower, I can hear people speaking french, I can also know my latitude/longitude position and so one. If you think of the ability to see the Eiffel tower or to hear french as the values of  “monument” and “language” attributes for this location, then you get the picture. Location in ICE is a  very similar concept ( so you can easily know if your point is near the Eiffel tower…), but instead of being on earth, an ICE location is on the surface of your geometry (so I could be wrong as you probably can’t see Eiffel tower from your geometry …).

From the doc, we can read that the “PointNeighbors” attribute  is “an array containing the locations of the vertices that are connected to a vertex by edges.If you get this attribute at a surface location, it returns the neighbors of the vertex closest to the location.”.
As those location are in per point context (a vertice is a polymesh point in Softimage) we can get our “__LowestPointIndexInIsland” (see previous post) without problem from those locations. Now we just need to find the lowest value in the array and compare it to the current point value. I won’t go into detail here as you just need to look at the ICE graph of the “Get Lowest Point Index By Islands” compound :P .

So now that we know if our point index is smaller or not than its neighbors, we need to repeat this operation several time to get the very lowest index in the island. If you remember my little “doodle graph” from the first post (or if you just look below) : We see that for those 3 points, we need to repeat the neighbor comparison two times.  A basic approach would be to use a repeat node with a rather large number of repeat iterations. In fact you should built such setup. This way you would see that increasing the iteration slider would give you better and better result (using the “show value” feature of the ICE graph) until all the points would be set to the lowest index. But the Repeat node … repeat the same amount of time the comparison for all the poly islands. If an island is made of only one triangle and the Repeat node is set to 100 (for example), the poor little triangle’s points would be compared too many time (and it couldn’t be tolerated !). So we need to know if all the points of this triangle are still updating their lowest index attribute at each iteration. Using a While node with the condition “is my index still changed” is a better option. It will give us the opportunity to see how we can initialize an attribute in ICE !

“Initializing Data” :

ICE handle very well undefined custom data. It will always try to guess the data type from upstream or downstream connected nodes. In the example below, to create the “__IndexIsNotChanged” attribute, we don’t need to first use a Set Data. Once familiar with this workflow, you will discover that it speed up your graph construction. If your data need to be create with a default value like 0.0 or false or 0.0, 0.0, 0.0 (for a vector) then you don’t need to set it :) . It will find its type latter in the graph !

We can see that first, the “__IndexIsNotChanged” attribute is a value but ICE doesn’t know its type. Then we ask for the minimum in the set for this unknown attribute and ICE is still confortable with this abstraction :) .
As soon as we plug the Get Minimum in Set in the Not node (a node always returning a boolean value), our attribute is set as a boolean attribute. It will be a per object context attribute until we start to use it in an other context.

I’m stopping here for tonight. Stay tuned, in the next post we will have fun with ICE array.

Cheers !

 

Advertisement

One Response to Polygon Islands : Getting the Lowest Point Index Part 2

  1. Pingback: Polygon Islands : Using Arrays « Frenchdog’s Weblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s