Quadtree vs Red-Black tree for a game in C++?

后端 未结 6 960
小鲜肉
小鲜肉 2021-02-02 03:33

I have been looking for a quadtree/quadtree node implementation on the net for ages. There is some basic stuff but nothing that I would be able to really use it a game.

6条回答
  •  轮回少年
    2021-02-02 03:54

    The reason to use a quadtree is because you can then split on x- and y-coordinates, an octree on x, y and z, making collision detection trivial.

    Quadtree: if an element is not in the topleft, it wont collide with one in topright, bottomleft or bottomright.

    It is a very basic class, so I don't understand what you are missing in implementations you found.

    I would not write such a class, I'd just borrow it from a project with a suitable license.

提交回复
热议问题