载入中...
搜索中...
未找到
eve::spatial::BSPTree2D类 参考

Binary space partition tree (kd-style AABB splits) for 2D culling. Alternating X/Y splits at node midplanes; spanning items stay on the node. 更多...

#include <BSPTree2D.h>

Public 成员函数

 BSPTree2D (float minX, float minY, float maxX, float maxY, int maxDepth=12, int maxPerNode=8)
 Creates a 2D BSP/kd tree covering the given bounds.
 
 ~BSPTree2D ()=default
 Releases tree nodes.
 
 BSPTree2D (const BSPTree2D &)=delete
 
BSPTree2D & operator= (const BSPTree2D &)=delete
 
void clear ()
 Removes all stored entries.
 
bool insert (int id, float minX, float minY, float maxX, float maxY)
 Inserts an item AABB; false if out of bounds or id already present.
 
bool remove (int id)
 Removes an item by id; false if unknown.
 
bool update (int id, float minX, float minY, float maxX, float maxY)
 Moves an existing item to a new AABB; false if unknown or out of bounds.
 
bool contains (int id) const
 True if the id is currently stored.
 
int getCount () const
 Number of stored ids.
 
int queryPoint (float x, float y)
 Finds items overlapping a point; fills the result buffer.
 
int queryRect (float minX, float minY, float maxX, float maxY)
 Finds items overlapping an AABB; fills the result buffer.
 
int queryCircle (float cx, float cy, float radius)
 Finds items overlapping a circle; fills the result buffer.
 
int getResultCount () const
 Number of hits from the last query*.
 
int getResultId (int index) const
 Hit id at dense index from the last query*, or -1.
 
float getMinX () const
 Root/world minimum X.
 
float getMinY () const
 Root/world minimum Y.
 
float getMaxX () const
 Root/world maximum X.
 
float getMaxY () const
 Root/world maximum Y.
 
int getMaxDepth () const
 Maximum subdivision depth.
 
int getMaxPerNode () const
 Item capacity before a node splits.
 

详细描述

Binary space partition tree (kd-style AABB splits) for 2D culling. Alternating X/Y splits at node midplanes; spanning items stay on the node.

在文件 BSPTree2D.h 第 18 行定义.

构造及析构函数说明

◆ BSPTree2D() [1/2]

eve::spatial::BSPTree2D::BSPTree2D ( float  minX,
float  minY,
float  maxX,
float  maxY,
int  maxDepth = 12,
int  maxPerNode = 8 
)

Creates a 2D BSP/kd tree covering the given bounds.

在文件 BSPTree2D.cpp 第 7 行定义.

引用了 eve::spatial::AABB2::height(), eve::spatial::AABB2::valid() , 以及 eve::spatial::AABB2::width().

◆ ~BSPTree2D()

eve::spatial::BSPTree2D::~BSPTree2D ( )
default

Releases tree nodes.

◆ BSPTree2D() [2/2]

eve::spatial::BSPTree2D::BSPTree2D ( const BSPTree2D &  )
delete

成员函数说明

◆ clear()

void eve::spatial::BSPTree2D::clear ( )

Removes all stored entries.

在文件 BSPTree2D.cpp 第 27 行定义.

引用了 eve::spatial::QueryIds::clear().

◆ contains()

bool eve::spatial::BSPTree2D::contains ( int  id) const

True if the id is currently stored.

在文件 BSPTree2D.cpp 第 34 行定义.

被这些函数引用 insert(), remove() , 以及 update().

◆ getCount()

int eve::spatial::BSPTree2D::getCount ( ) const
inline

Number of stored ids.

在文件 BSPTree2D.h 第 40 行定义.

◆ getMaxDepth()

int eve::spatial::BSPTree2D::getMaxDepth ( ) const
inline

Maximum subdivision depth.

在文件 BSPTree2D.h 第 63 行定义.

◆ getMaxPerNode()

int eve::spatial::BSPTree2D::getMaxPerNode ( ) const
inline

Item capacity before a node splits.

在文件 BSPTree2D.h 第 65 行定义.

◆ getMaxX()

float eve::spatial::BSPTree2D::getMaxX ( ) const
inline

Root/world maximum X.

在文件 BSPTree2D.h 第 59 行定义.

◆ getMaxY()

float eve::spatial::BSPTree2D::getMaxY ( ) const
inline

Root/world maximum Y.

在文件 BSPTree2D.h 第 61 行定义.

◆ getMinX()

float eve::spatial::BSPTree2D::getMinX ( ) const
inline

Root/world minimum X.

在文件 BSPTree2D.h 第 55 行定义.

◆ getMinY()

float eve::spatial::BSPTree2D::getMinY ( ) const
inline

Root/world minimum Y.

在文件 BSPTree2D.h 第 57 行定义.

◆ getResultCount()

int eve::spatial::BSPTree2D::getResultCount ( ) const
inline

Number of hits from the last query*.

在文件 BSPTree2D.h 第 50 行定义.

◆ getResultId()

int eve::spatial::BSPTree2D::getResultId ( int  index) const
inline

Hit id at dense index from the last query*, or -1.

在文件 BSPTree2D.h 第 52 行定义.

引用了 index.

◆ insert()

bool eve::spatial::BSPTree2D::insert ( int  id,
float  minX,
float  minY,
float  maxX,
float  maxY 
)

Inserts an item AABB; false if out of bounds or id already present.

在文件 BSPTree2D.cpp 第 36 行定义.

引用了 b, contains(), id, eve::spatial::makeAABB2() , 以及 remove().

被这些函数引用 update().

◆ operator=()

BSPTree2D & eve::spatial::BSPTree2D::operator= ( const BSPTree2D &  )
delete

◆ queryCircle()

int eve::spatial::BSPTree2D::queryCircle ( float  cx,
float  cy,
float  radius 
)

Finds items overlapping a circle; fills the result buffer.

返回
Hit count.

在文件 BSPTree2D.cpp 第 194 行定义.

引用了 eve::spatial::QueryIds::clear(), cx, cy, eve::spatial::QueryIds::getCount() , 以及 radius.

◆ queryPoint()

int eve::spatial::BSPTree2D::queryPoint ( float  x,
float  y 
)

Finds items overlapping a point; fills the result buffer.

返回
Hit count.

在文件 BSPTree2D.cpp 第 181 行定义.

引用了 eve::spatial::QueryIds::clear(), eve::spatial::QueryIds::getCount(), x , 以及 y.

◆ queryRect()

int eve::spatial::BSPTree2D::queryRect ( float  minX,
float  minY,
float  maxX,
float  maxY 
)

Finds items overlapping an AABB; fills the result buffer.

返回
Hit count.

在文件 BSPTree2D.cpp 第 187 行定义.

引用了 eve::spatial::QueryIds::clear(), eve::spatial::QueryIds::getCount() , 以及 eve::spatial::makeAABB2().

◆ remove()

bool eve::spatial::BSPTree2D::remove ( int  id)

Removes an item by id; false if unknown.

在文件 BSPTree2D.cpp 第 47 行定义.

引用了 contains().

被这些函数引用 insert().

◆ update()

bool eve::spatial::BSPTree2D::update ( int  id,
float  minX,
float  minY,
float  maxX,
float  maxY 
)

Moves an existing item to a new AABB; false if unknown or out of bounds.

在文件 BSPTree2D.cpp 第 54 行定义.

引用了 contains() , 以及 insert().


该类的文档由以下文件生成: