Let there be
total (unsplit) points,
voxels,
and
triangles per voxel.
Since the number of voxels can be large, and triangles
should be distributed among voxels relatively evenly,
is
normally much larger than
.
The brute-force solution- for each point, check
to see if any relevant triangle references it- is
clearly
. Since the
process will be repeated once for every voxel, the
brute force approach is
.
We of course can do better by first marking the points used by
each triangle, then collecting all the marked points.
If we mark points using a table, this approach is
for each voxel, because it takes
time
to clear all the marks initially,
time to mark
some of the points, and then
again to collect the marked
points. Repeating for every voxel gives
overall.
Theoretically, we could eliminate the factor of
by
marking each voxel's
referenced points with a hashtable.
In practice, the large constant factor associated with a
hashtable accessA.3 makes this approach unattractive.
A much better solution is to mark all referenced points
in a linked array structure. Each entry of this array
indicates whether the corresponding point has been marked,
and if so, links to the next marked point.
Then marking a new point takes (a very small) constant time;
and all referenced points can be collected by following the
links, in
time.
We can also clear all the marks by following the links.
Thus the only
operation needed is initialization,
for a total run time across all voxels of
.
Since both
and
can be large, this is a substantial
improvement.