Houdini VEX - Looping
A few variables are available for referencing in a Wrangle:
@ptnum
– current point number up to@numpt
@elemnum
– current index of this element up to@numelem
Their equivalents are @primnum
, @numprim
etc.
To loop over every point:
vector positions[] = {};
for (int i = 0; i < @numpt; i++) {
vector p = point(geoself(), "P", i);
push( positions, p);
}
Using foreach
:
foreach(vector position; positions) {
// Do something;
}