Hi,
You can do it like this:
function int [ ] getPointNeighbours ( int geo; int ptindex; int depth; int accumulate )
{
int pts [ ] = array ( ptindex );
int lastpts [ ] = pts;
for ( int i = 0; i < depth; ++i )
{
int newpts [ ] = { };
foreach ( int pt; lastpts )
{
int connected [ ] = neighbours ( geo, pt );
foreach ( int c; connected )
{
if ( find ( pts, c ) < 0 )
{
append ( pts, c );
append ( newpts, c );
}
}
}
lastpts = newpts;
}
if ( accumulate )
return pts;
else
return lastpts;
}
int pts [ ] = getPointNeighbours ( 0, 42, chi("depth"), chi("accumulate") );
foreach ( int pt; pts )
setpointgroup ( 0, "pts", pt, 1 );