Skip to content

Update errors and fixes #6

@tunghack

Description

@tunghack
  1. When updating an object, you might want to remove and add it back to the tree when it is out of the node's boundary. The conditions you check to do this need to be fixed. In specific, in the update function, (orig.x > node.x + node.w || orig.y > node.y + node.h || orig.x + orig.w < node.x || orig.y + orig.h < node.y ) should be (orig.x >= node.x + node.w || orig.y >= node.y + node.h || orig.x + orig.w <= node.x || orig.y + orig.h <= node.y ). I came across this issue when the new updated object is supposed to be in a node leaf, but the conditions keep it in a node child, which prevents you from updating or removing the object in the future.
  2. Please fix the missing parameter 'updatedcoords' in the recursive call of update function as someone already pointed out.

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