Region quadtree for 2D AABB broad-phase / map culling. Items are stored in the smallest node that fully contains them; spanning items stay at the parent. Scripts use insert/remove/query* + getResult*. 更多...
#include <QuadTree.h>
Public 成员函数 | |
| QuadTree (float minX, float minY, float maxX, float maxY, int maxDepth=8, int maxPerNode=8) | |
| ~QuadTree ()=default | |
| QuadTree (const QuadTree &)=delete | |
| QuadTree & | operator= (const QuadTree &)=delete |
| void | clear () |
| bool | insert (int id, float minX, float minY, float maxX, float maxY) |
| bool | remove (int id) |
| bool | update (int id, float minX, float minY, float maxX, float maxY) |
| bool | contains (int id) const |
| int | getCount () const |
| int | queryPoint (float x, float y) |
| int | queryRect (float minX, float minY, float maxX, float maxY) |
| int | queryCircle (float cx, float cy, float radius) |
| int | getResultCount () const |
| int | getResultId (int index) const |
| float | getMinX () const |
| float | getMinY () const |
| float | getMaxX () const |
| float | getMaxY () const |
| int | getMaxDepth () const |
| int | getMaxPerNode () const |
详细描述
Region quadtree for 2D AABB broad-phase / map culling. Items are stored in the smallest node that fully contains them; spanning items stay at the parent. Scripts use insert/remove/query* + getResult*.
在文件 QuadTree.h 第 17 行定义.
构造及析构函数说明
◆ QuadTree() [1/2]
| eve::spatial::QuadTree::QuadTree | ( | float | minX, |
| float | minY, | ||
| float | maxX, | ||
| float | maxY, | ||
| int | maxDepth = 8, |
||
| int | maxPerNode = 8 |
||
| ) |
在文件 QuadTree.cpp 第 7 行定义.
引用了 eve::spatial::AABB2::height(), eve::spatial::AABB2::valid() , 以及 eve::spatial::AABB2::width().
◆ ~QuadTree()
|
default |
◆ QuadTree() [2/2]
|
delete |
成员函数说明
◆ clear()
| void eve::spatial::QuadTree::clear | ( | ) |
在文件 QuadTree.cpp 第 26 行定义.
◆ contains()
| bool eve::spatial::QuadTree::contains | ( | int | id | ) | const |
在文件 QuadTree.cpp 第 33 行定义.
◆ getCount()
|
inline |
在文件 QuadTree.h 第 31 行定义.
◆ getMaxDepth()
|
inline |
在文件 QuadTree.h 第 44 行定义.
◆ getMaxPerNode()
|
inline |
在文件 QuadTree.h 第 45 行定义.
◆ getMaxX()
|
inline |
在文件 QuadTree.h 第 42 行定义.
◆ getMaxY()
|
inline |
在文件 QuadTree.h 第 43 行定义.
◆ getMinX()
|
inline |
在文件 QuadTree.h 第 40 行定义.
◆ getMinY()
|
inline |
在文件 QuadTree.h 第 41 行定义.
◆ getResultCount()
|
inline |
在文件 QuadTree.h 第 37 行定义.
◆ getResultId()
|
inline |
在文件 QuadTree.h 第 38 行定义.
◆ insert()
| bool eve::spatial::QuadTree::insert | ( | int | id, |
| float | minX, | ||
| float | minY, | ||
| float | maxX, | ||
| float | maxY | ||
| ) |
在文件 QuadTree.cpp 第 35 行定义.
引用了 b, contains(), id, eve::spatial::makeAABB2() , 以及 remove().
被这些函数引用 update().
◆ operator=()
◆ queryCircle()
| int eve::spatial::QuadTree::queryCircle | ( | float | cx, |
| float | cy, | ||
| float | radius | ||
| ) |
在文件 QuadTree.cpp 第 170 行定义.
引用了 eve::spatial::QueryIds::clear(), cx, cy , 以及 eve::spatial::QueryIds::getCount().
◆ queryPoint()
| int eve::spatial::QuadTree::queryPoint | ( | float | x, |
| float | y | ||
| ) |
在文件 QuadTree.cpp 第 157 行定义.
引用了 eve::spatial::QueryIds::clear(), eve::spatial::QueryIds::getCount(), x , 以及 y.
◆ queryRect()
| int eve::spatial::QuadTree::queryRect | ( | float | minX, |
| float | minY, | ||
| float | maxX, | ||
| float | maxY | ||
| ) |
◆ remove()
| bool eve::spatial::QuadTree::remove | ( | int | id | ) |
◆ update()
| bool eve::spatial::QuadTree::update | ( | int | id, |
| float | minX, | ||
| float | minY, | ||
| float | maxX, | ||
| float | maxY | ||
| ) |
在文件 QuadTree.cpp 第 56 行定义.
引用了 contains() , 以及 insert().
该类的文档由以下文件生成:
- src/modules/spatial/QuadTree.h
- src/modules/spatial/QuadTree.cpp