Here's the function I'm using to grab all nodes within the radius of center point x0,z0
int r2 = radius * radius;
nodeCount = 0;
for (int x = 0; x <= radius; x++)
{
for (int z = 0; z <= radius; z++)
{
if (x * x + z * z <= r2)
{
_nodes[nodeCount] = nodes[centerX - x, centerZ + z]; //top left
nodeCount++;
_nodes[nodeCount] = nodes[centerX + x, centerZ + z]; //top right
nodeCount++;
_nodes[nodeCount] = nodes[centerX - x, centerZ - z]; //bottom left
nodeCount++;
_nodes[nodeCount] = nodes[centerX + x, centerZ - z]; //bottom right
nodeCount++;
}
}
}
This finds nodes in one corner of the circle and flips x,z values to get the symmetrical nodes, it will produce this:
http://puu.sh/sGK1I/9f772e3d53.jpg
Is there another algorithm that can start in the center and stop progressing in a direction if a rule is met? For instance, if one of the nodes is tagged as Wall, ideally the returned node collection would then look like this: