Пример #1
0
        public void Execute()
        {
            NodesCount.Value  = 1;
            ValuesCount.Value = 0;
            Nodes[0]          = new OctNode(AABB);

            var rootIndex = new IndexToOctNode(0);
            var root      = rootIndex.GetElement(Nodes);

            for (int i = 0; i < ToInsert.Length; i++)
            {
                var point = ToInsert[i];
                if (root.PointOverlaps(point))
                {
                    IndexToOctValue valueIndex = IndexToOctValue.NewElement(Values, ValuesCount, OctValue.CreateTail(point));
                    InsertPointInNodeOrChildren(rootIndex, valueIndex);
                }
                else
                {
                    Debug.LogError("Cannot insert point outside of octree!");
                }
            }
        }