#Re quad tree implementation I was

1 messages · Page 1 of 1 (latest)

mossy sage
#

I ported to c# the query method and it looks like this:

public List<QuadTreeLeaf<LEAF>> Query(List<QuadTreeLeaf<LEAF>> list, RectL bounds)
{
    if (Nodes[0] != null)
    {
        int index = GetIndex(bounds);
        if (index == -1)
        {
            foreach(var node in Nodes)
            {
                node.Query(list, bounds);
            }
        }
        else
        { 
            Nodes[index].Query(list, bounds);
        }
    }
    list.AddRange(Items);
    return list;
}```
#

the block where index == -1 is the code I added