Skip to content

assertion failure in Impl::InsertIntoTree #4

@sthalik

Description

@sthalik

Having integrated your loose quadtree implementation into my game project early in development, I'm getting an off-by-one assertion failure during insertion.

This crash happens deterministically so I can provide additional details if you need them.

assertion failed: effective_bounds.Contains(object_bounds) in F:/dev/game/./compat/LooseQuadtree-impl.h:1114
(gdb) bt 5
#0  0x00007ff64c2fc032 in floormat::_fm_abort () at F:/dev/game/./compat/assert.hpp:32
#1  0x00007ff64c30b846 in loose_quadtree::LooseQuadtree<short, loose_quadtree::BoundingBox<short>, loose_quadtree::TrivialBBExtractor<short> >::Impl::InsertIntoTree (this=0x2a975dcf810, object=0x2a975e11380)
    at F:/dev/game/./compat/LooseQuadtree-impl.h:1114
#2  0x00007ff64c30a5d9 in loose_quadtree::LooseQuadtree<short, loose_quadtree::BoundingBox<short>, loose_quadtree::TrivialBBExtractor<short> >::Impl::Insert (this=0x2a975dcf810, object=0x2a975e11380)
    at F:/dev/game/./compat/LooseQuadtree-impl.h:824
#3  0x00007ff64c48f8af in loose_quadtree::LooseQuadtree<short, loose_quadtree::BoundingBox<short>, loose_quadtree::TrivialBBExtractor<short> >::Insert (this=0x2a975dcf810, object=0x2a975e11380)
    at F:/dev/game/./compat/LooseQuadtree-impl.h:1162
#4  0x00007ff64c48e007 in floormat::chunk::ensure_passability (this=0x2a975dd1fe8)
    at F:/dev/game/src/chunk-bbox.cpp:109
(More stack frames follow...)
(gdb) fr 1
#1  0x00007ff64c30b846 in loose_quadtree::LooseQuadtree<short, loose_quadtree::BoundingBox<short>, loose_quadtree::TrivialBBExtractor<short> >::Impl::InsertIntoTree (this=0x2a975dcf810, object=0x2a975e11380)
    at F:/dev/game/./compat/LooseQuadtree-impl.h:1114
1114            assert(effective_bounds.Contains(object_bounds));
(gdb) l
1109                (Number)((typename detail::MakeDistance<Number>::Type)effective_bounds.height / 2);
1110            effective_bounds.width = (Number)(effective_bounds.width * 2);
1111            effective_bounds.height = (Number)(effective_bounds.height * 2);
1112            effective_bounds.left = (Number)(effective_bounds.left - half_width);
1113            effective_bounds.top = (Number)(effective_bounds.top - half_height);
1114            assert(effective_bounds.Contains(object_bounds));
1115    #endif
1116
1117            typename detail::TreeNode<Object>::ObjectContainer& objects =
1118                    trav.GetNode()->objects;
(gdb) p effective_bounds
$1 = {left = 671, top = 353, width = 128, height = 126}
(gdb) p object_bounds
$2 = {left = 672, top = 352, width = 64, height = 64}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions