protected override bool DoesDataFallWithinNodeAABB(Vector3 data, OctreeNode node) { return(node.AABB.ContainsPoint(data)); }
protected override List <int> GatherIndicesOfDataWhichFallsWithinNodeAABB(List <int> dataIndices, OctreeNode node) { if (dataIndices.Count == 0) { return(new List <int>()); } var indicesOfPointsInsideAABB = new List <int>(dataIndices.Count); foreach (int index in dataIndices) { Vector3 point = _data[index]; if (DoesDataFallWithinNodeAABB(point, node)) { indicesOfPointsInsideAABB.Add(index); } } return(indicesOfPointsInsideAABB); }
protected abstract bool DoesDataFallWithinNodeAABB(T data, OctreeNode node);
private void CollectDataIndicesInLeavesAABBrecurse(Box aabb, List <int> dataIndices, OctreeNode root) { if (!root.AABB.IntersectsBox(aabb)) { return; } if (root.IsLeaf) { dataIndices.AddRange(root.DataIndices); } else { List <OctreeNode> children = root.Children; foreach (var child in children) { CollectDataIndicesInLeavesAABBrecurse(aabb, dataIndices, child); } } }
protected abstract List <int> GatherIndicesOfDataWhichFallsWithinNodeAABB(List <int> dataIndices, OctreeNode node);