public List <QuadTreeNode <T> > Contains(Vector2 point) { return(_root.Contains(point)); }
public List <QuadTreeNode <T> > Contains(Vector2 point) { if (!this.bounds.Contains(point)) { return(null); } List <QuadTreeNode <T> > output = null; if (nodes != null && nodes.Count > 0) { output = new List <QuadTreeNode <T> >(); for (int i = 0; i < nodes.Count; i++) { if (nodes [i].bounds.Contains(point)) { output.Add(nodes [i]); } } if (output.Count == 0) { output = null; } } if (topLeft != null) { List <QuadTreeNode <T> > cellOutput = topLeft.Contains(point); if (cellOutput != null) { if (output == null) { output = new List <QuadTreeNode <T> >(); } output.AddRange(cellOutput); } } if (topRight != null) { List <QuadTreeNode <T> > cellOutput = topRight.Contains(point); if (cellOutput != null) { if (output == null) { output = new List <QuadTreeNode <T> >(); } output.AddRange(cellOutput); } } if (bottomLeft != null) { List <QuadTreeNode <T> > cellOutput = bottomLeft.Contains(point); if (cellOutput != null) { if (output == null) { output = new List <QuadTreeNode <T> >(); } output.AddRange(cellOutput); } } if (bottomRight != null) { List <QuadTreeNode <T> > cellOutput = bottomRight.Contains(point); if (cellOutput != null) { if (output == null) { output = new List <QuadTreeNode <T> >(); } output.AddRange(cellOutput); } } return(output); }