Esempio n. 1
0
        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]));
                    }
                }
            }
        }
Esempio n. 2
0
 public void Push(int levelIndex, int nodeIndex)
 {
     Stack[Count] = new TraversalTarget {
         Level = levelIndex, Node = nodeIndex
     };
     Count++;
 }
Esempio n. 3
0
 public bool Pop(out TraversalTarget target)
 {
     if (Count > 0)
     {
         --Count;
         target = Stack[Count];
         return(true);
     }
     target = new TraversalTarget();
     return(false);
 }