summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ix2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ix2.c b/src/ix2.c
index fcdeb79..28c4c11 100644
--- a/src/ix2.c
+++ b/src/ix2.c
@@ -368,12 +368,17 @@ _fail:
}
-/* Create a new ix2 index with bounds aabb, splitting nodes > max_per_node until max_depth */
+/* Create a new ix2 index with bounds aabb, splitting nodes > max_per_node until max_depth
+ * If the supplied aabb is NULL, a default one of -1,-1...1,1 is used.
+ * Returns NULL on failure.
+ */
ix2_t * ix2_new(aabb_t *aabb, unsigned max_per_node, unsigned max_depth)
{
+ aabb_t default_aabb = {{-1.f, -1.f}, {1.f, 1.f}};
ix2_t *ix2;
- assert(aabb);
+ if (!aabb)
+ aabb = &default_aabb;
ix2 = calloc(1, sizeof(ix2_t));
if (!ix2)
© All Rights Reserved