diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-04-15 15:15:39 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-04-15 15:15:39 -0400 |
commit | 1b1f00e70564d6acb2b1e09b0a5f430da4e4b8a3 (patch) | |
tree | ccf2628596a9ac7a1d2fed71f048d7427576a737 /libdimension/bvst.c | |
parent | 3037c067f2937b68bfd0c7f906f7e7ecadd4b8d5 (diff) | |
download | dimension-1b1f00e70564d6acb2b1e09b0a5f430da4e4b8a3.tar.xz |
Support infinitely large bounding boxes.
Diffstat (limited to 'libdimension/bvst.c')
-rw-r--r-- | libdimension/bvst.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libdimension/bvst.c b/libdimension/bvst.c index c0888bb..7a57c76 100644 --- a/libdimension/bvst.c +++ b/libdimension/bvst.c @@ -105,12 +105,10 @@ dmnsn_bvst_insert(dmnsn_bvst *tree, dmnsn_object *object) dmnsn_bvst_node *node = dmnsn_new_bvst_node(), *parent = tree->root; - node->contains = NULL; - node->container = NULL; - node->parent = NULL; - node->object = object; - - /* Calculate the new bounding box */ + node->contains = NULL; + node->container = NULL; + node->parent = NULL; + node->object = object; node->bounding_box = object->bounding_box; /* Now insert the node */ @@ -122,9 +120,9 @@ dmnsn_bvst_insert(dmnsn_bvst *tree, dmnsn_object *object) node->bounding_box.max)) { /* parent fully contains node */ - if (parent->contains) + if (parent->contains) { parent = parent->contains; - else { + } else { /* We found our parent; insert node into the tree */ parent->contains = node; node->parent = parent; @@ -135,9 +133,9 @@ dmnsn_bvst_insert(dmnsn_bvst *tree, dmnsn_object *object) already */ dmnsn_bvst_node_swallow(node, parent->bounding_box); /* node now fully contains parent */ - if (parent->container) + if (parent->container) { parent = parent->container; - else { + } else { /* We found our parent; insert node into the tree */ parent->container = node; node->parent = parent; |