I am trying to figure out the loop stuff in the new genome.
I thought I would start with a simple relax. However, I can’t figure out how it should go.
Some of the things that are stumping me are: Where inside the vertexloopbyedge do I get the total vert count in the loop? I need this to divide my accumulated position vector when the loop is done. I’m not even sure how I should be accumulating my vectors. I made a new input [0,0,0] and am adding that to the loopchannel position.
The other thing I am finding confusing is the input labeled “output” what is that for?
It is all very confusing and I’d love to see an example.
No, you are not. It is just too new and undocumented.
When you create a GeoLoop like VertexLoopByEdge, there is already an Output socket created. Every Output socket has a matching input socket in [] brackets with the same name. You can use that to initialize the value of the Output. Think of it as of a local variable set to an initial value before the loop and modified by the loop. Basically you feed an initial value into the loop. The value is modified at each iteration and the result is passed back as the input for the next iteration. Once all iterations are performed, the last value becomes the Output of the loop at that socket.
To get the number of neighbor vertices, simply add another Output to the VertexLoopByEdge, initialize it to 0.0 (or select the Output 2, click the [Default >>] button and select “FLOAT Default Value (0.0)”. Then inside the Loop, select the wire from [Output 2] input socket to [Output 2] output socket and press [+] to insert an Add operator. Set the Add’s second socket default to 1.0 and you will accumulate the number of vertices in parallel to the Positions (I assume you are using LoopChannel>Position and Add operator in the first Output’s wire).
Outside the Loop node, divide the Output 1 (accumulated positions) by Output 2 (accumulated neighbors count) and you will get the average position of the neighbor vertices!
A related note - currently, the VertexLoopByEdge visits some vertices too often because it follows all Edges, including the Invisible ones. So a Relax created using Genome right now equals a Relax on an EditableMesh with all Edges set to Visible. We should add an option to deal with this (or better, support N-sided polygons).
The attached scene shows a comparison of Max Relax and Genome Relax including the “Relax Value”, “Iterations”, and “Keep Boundary Pts Fixed” options.