unsafe void Test <TResultList>(TraversalTarget *stack, ref int count, int stackCapacity, int level, ref BoundingBoxWide query, ref Node node, ref TResultList results) where TResultList : IList <int> { Vector <int> intersectionMask; BoundingBoxWide.Intersects(ref node.BoundingBoxes, ref query, out intersectionMask); //Console.WriteLine($"Intersection mask: {intersectionMask}"); //Console.WriteLine(node.BoundingBoxes); for (int i = 0; i < Vector <int> .Count; ++i) { if (intersectionMask[i] < 0) { if (node.Children[i] >= 0) { Debug.Assert(count < stackCapacity); stack[count++] = new TraversalTarget { Level = level + 1, Node = node.Children[i] }; } else if (node.Children[i] < -1) { results.Add(Encode(node.Children[i])); } } } }
public void Push(int levelIndex, int nodeIndex) { Stack[Count] = new TraversalTarget { Level = levelIndex, Node = nodeIndex }; Count++; }
public bool Pop(out TraversalTarget target) { if (Count > 0) { --Count; target = Stack[Count]; return(true); } target = new TraversalTarget(); return(false); }