Given objects in $k$-dimensional space, answer geometric questions
Given objects in $k$-dimensional space, answer geometric questions
Given objects in $k$-dimensional space, answer geometric questions
Construction:
for each object $O$:
for each cell $(x, y, z)$ overlapping with $O$:
append $O$ to $\mathrm{grid}(x, y, z)$
Search:
for each cell $(x, y, z)$ overlapping with query $Q$:
for each object $O$ in $\mathrm{grid}(x, y, z)$:
output $O$
$\mathrm{Build}$(objects, depth):
if objects contains only one object:
return a leaf node
else:
$i \gets \mathrm{depth} \mod k$
$m \gets$ the median of the $i$th coordinate
$a \gets \mathrm{Build}$(objects below the plane $\mathbf{x}_i = k$, depth $ + 1$)
$b \gets \mathrm{Build}$(objects above the plane $\mathbf{x}_i = k$, depth $ + 1$)
return $\mathrm{Node}(\mathbf{x}_i = k, a, b)$
$\mathrm{Search}(n, Q)$:
if $n$ is a leaf in $Q$
output $n$
else:
if $Q$ contains part of the half-space $\mathbf{x}_i \le k$:
$\mathrm{Search}$(left child of $n$, $Q$)
if $Q$ contains part of the half-space $\mathbf{x}_i \ge k$:
$\mathrm{Search}$(right child of $n$, $Q$)
$r \gets \infty$
$\mathrm{Search}(n, \mathbf{q})$:
if $n$ is a leaf in $Q$
if $d(n, \mathbf{q}) \le r$
$r \gets d(n, \mathbf{q})$
else:
$\mathrm{Search}$(child of $n$ containing $\mathbf{q}$, $\mathbf{q}$)
if other child of $n$ intersects with sphere of radius $r$ centered at $\mathbf{q}$:
$\mathrm{Search}$(other child of $n$, $\mathbf{q}$)
$\mathrm{Search}(x, Q)$:
if $x$ is a leaf in region $Q$:
output $x$
else:
for each child $k$ of $x$ intersecting $\mathrm{Q}$:
$\mathrm{Search}(k, Q)$
$d \gets \infty$
$\mathrm{Search}(x, \mathrm{ray})$:
if $x$ is a leaf:
$t \gets$ distance from $\mathrm{ray}$ to $x$:
if $t \le d$:
$d \gets t$
else:
for each child $k$ of $x$ intersecting $\mathrm{ray}$:
if $d \ge$ distance to front of box:
$\mathrm{Search}(k, \mathrm{ray})$
$\mathrm{Refit}$(node, box):
while box not included in node:
bounding volume of node $\gets $ bounding volume of subchildren $\cup$ box
node $\gets$ parent of node