You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library seems to handle 'search' by detecting intersections for given bounds. There is also a notion of 'containment', i.e return results of nodes that are contained within the given bounds.
Can this be made to work. Tried a fork - changing the 'intersection' calls with 'contain' calls. Doesn't see to work. Should the logic of enclosed envelop be changed as well ? Currently, intermediate nodes (of 9 ) are created with a 'union' envelope of the children. How should be to changed to support the containment paradigm ? My search logic fails at these intermediate nodes.
The parameter ContainmentType is either Contains or Intersects
private List<T> DoSearch(
in RectangleF boundingBox,
ContainmentType ctype = ContainmentType.Intersects,
int maxLevel = int.MaxValue)
{
if (ctype == ContainmentType.Intersects)
{
if (!boundingBox.Containment(Root.Envelope, ctype) || maxLevel < 1)
return [];
}
var intersections = new List<T>();
var queue = new Queue<Node>();
queue.Enqueue(Root);
while (queue.Count != 0)
{
var item = queue.Dequeue();
if (item.IsLeaf)
{
foreach (var i in item.Items)
{
if (boundingBox.Containment(i.Envelope, ctype))
intersections.Add((T)i);
}
}
else
{
if (maxLevel-- > 0)
{
foreach (var i in item.Items)
{
if (boundingBox.Containment(i.Envelope, ctype))
queue.Enqueue((Node)i);
}
}
}
}
return intersections;
}
The text was updated successfully, but these errors were encountered:
This library seems to handle 'search' by detecting intersections for given bounds. There is also a notion of 'containment', i.e return results of nodes that are contained within the given bounds.
Can this be made to work. Tried a fork - changing the 'intersection' calls with 'contain' calls. Doesn't see to work. Should the logic of enclosed envelop be changed as well ? Currently, intermediate nodes (of 9 ) are created with a 'union' envelope of the children. How should be to changed to support the containment paradigm ? My search logic fails at these intermediate nodes.
The parameter ContainmentType is either Contains or Intersects
The text was updated successfully, but these errors were encountered: