+
+
+ // make sure the entity is fully inside the volume
+ if (!(entity->getAabb().max[0] < node->getAabb().max[0] &&
+ entity->getAabb().min[0] > node->getAabb().min[0] &&
+ entity->getAabb().max[1] < node->getAabb().max[1] &&
+ entity->getAabb().min[1] > node->getAabb().min[1] &&
+ entity->getAabb().max[2] < node->getAabb().max[2] &&
+ entity->getAabb().min[2] > node->getAabb().min[2]))
+ {
+ // TODO this check is only needed for the root node, if we're inside the
+ // volume of the root node, we'll be fully inside the child as
+ // determined by trying to insert the parent node
+ goto done;
+ }
+
+ halfspace = xy.intersects(entity->getSphere());