public bool Set(T leaf, Vector3f pos) { if (!bounds.Contains(pos)) { return(false); } var subBounds = bounds; VONode node = root; VONode subNode; for (int i = 1; i <= _maxDepth; ++i) { subNode = node.GetAt(pos, subBounds.center); if (subNode == null) { if (i == _maxDepth) { subNode = new VOLeafNode(); } else { subNode = new VOInternalNode(); } node.SetAt(subNode, pos, subBounds.center); } subBounds = GetOctant(subBounds, pos); node = subNode; } node.data = leaf; return(true); }
public void SetAt(VONode node, Vector3f pos, Vector3f reference) { if (children == null) { return; } children.SetAt(node, pos, reference); }
public bool Get(Vector3f pos, out T leaf) { leaf = default(T); if (!bounds.Contains(pos)) { return(false); } var subBounds = bounds; VONode subNode = root; for (int i = 1; i <= _maxDepth; ++i) { subNode = subNode.GetAt(pos, subBounds.center); if (subNode == null) { return(false); } subBounds = GetOctant(subBounds, pos); } leaf = subNode.data; return(true); }
public VOBoundsDepthNode(VONode node, Bounds bounds, int depth, int octantIndex) { this.node = node; this.bounds = bounds; this.depth = depth; this.octantIndex = octantIndex; }
public VOBoundsDepthNode(VONode node, Bounds bounds, int depth) : this(node, bounds, depth, -1) { }
public VOBoundsDepthNode(VONode node, Bounds bounds) : this(node, bounds, -1) { }
public VODepthNode(VONode node, int depth) { this.node = node; this.depth = depth; }
public VoxelOctree(int _maxDepth, Bounds bounds) { this._maxDepth = _maxDepth; this.bounds = bounds; root = new VOInternalNode(); }