|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Each
box needs to know
|
|
|
|
– |
The
total mass of all the
|
|
|
|
particles
that it contains
|
|
|
|
– |
The
center-of-mass of all
|
|
|
|
the
particles it contains
|
|
|
|
– |
This
can be computed
|
|
|
|
recursively
(i.e., we can
|
|
|
|
compute
the values for box
|
|
|
B
if we know the values for
|
|
|
|
each
of B’s subboxes)
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Building
the octree must be
|
|
|
|
efficient
|
|
|
|
– |
The
tree is rebuilt after
|
|
|
|
every
time step
|
|
|
|
– |
It is
possible for the tree to
|
|
|
|
be
badly balanced, requiring
|
|
|
O(n2)
time to build
|
|
|
|
– |
In
practice, tree has height
|
|
|
|
of
about O(log n)
|
|
|
|
– |
Thus,
tree building takes
|
|
|
|
time
O(n log n)
|
|
|
|