ZLayout EDA Library v1.0.0
Advanced Electronic Design Automation Layout Library with Bilingual Documentation
|
A node in the quadtree structure. More...
#include <quadtree.hpp>
Public Types | |
using | ObjectType = T |
using | BoundingBoxFunc = std::function<geometry::Rectangle(const T&)> |
Public Member Functions | |
QuadTreeNode (const geometry::Rectangle &boundary, size_t capacity=10, size_t max_depth=8, size_t depth=0) | |
Constructor. | |
bool | insert (const T &object, const BoundingBoxFunc &get_bbox) |
Insert object into this node or appropriate child. | |
std::vector< T > | query_range (const geometry::Rectangle &range, const BoundingBoxFunc &get_bbox) const |
Query objects in a rectangular range. | |
std::vector< T > | query_point (const geometry::Point &point, const BoundingBoxFunc &get_bbox) const |
Query objects containing a specific point. | |
size_t | size () const |
Get total number of objects in this subtree. | |
void | clear () |
Clear all objects and children. | |
bool | is_divided () const |
Check if this node has been subdivided. | |
std::vector< T > | get_all_objects () const |
Get all objects in this subtree. | |
__init__ (self, Rectangle boundary, int capacity=10, int max_depth=8) | |
None | subdivide (self) |
bool | insert (self, Any obj, Rectangle bbox) |
List[Any] | query_range (self, Rectangle range_bbox) |
List[Any] | query_point (self, Point point) |
List[Any] | get_all_objects (self) |
int | size (self) |
Public Attributes | |
geometry::Rectangle | boundary |
Spatial boundary of this node. | |
std::vector< T > | objects |
Objects stored in this node. | |
std::unique_ptr< QuadTreeNode > | children [4] |
Child nodes (NW, NE, SW, SE) | |
bool | divided = False |
Whether this node has been subdivided. | |
size_t | capacity |
Maximum objects before subdivision. | |
size_t | max_depth |
Maximum subdivision depth. | |
size_t | depth |
Current depth in tree. | |
boundary = boundary | |
capacity = capacity | |
max_depth = max_depth | |
list | objects = [] |
list | children = [] |
objects |
Protected Member Functions | |
bool | _intersects_boundary (self, Rectangle bbox) |
A node in the quadtree structure.
A node in the quadtree structure.
Represents a single node in the quadtree hierarchy. Each node can contain objects up to a specified capacity before subdividing into four child nodes.
Definition at line 28 of file quadtree.hpp.
using zlayout::spatial::QuadTreeNode< T >::BoundingBoxFunc = std::function<geometry::Rectangle(const T&)> |
Definition at line 31 of file quadtree.hpp.
using zlayout::spatial::QuadTreeNode< T >::ObjectType = T |
Definition at line 30 of file quadtree.hpp.
zlayout::spatial::QuadTreeNode< T >::QuadTreeNode | ( | const geometry::Rectangle & | boundary, |
size_t | capacity = 10, | ||
size_t | max_depth = 8, | ||
size_t | depth = 0 ) |
Constructor.
boundary | Spatial boundary for this node |
capacity | Maximum objects before subdivision |
max_depth | Maximum depth for subdivision |
depth | Current depth (0 for root) |
Definition at line 451 of file quadtree.hpp.
zlayout.spatial.QuadTreeNode< T >.__init__ | ( | self, | |
Rectangle | boundary, | ||
int | capacity = 10, | ||
int | max_depth = 8 ) |
Definition at line 12 of file spatial.py.
|
protected |
Check if bounding box intersects with this node's boundary.
Definition at line 105 of file spatial.py.
void zlayout::spatial::QuadTreeNode< T >::clear | ( | ) |
Clear all objects and children.
Definition at line 590 of file quadtree.hpp.
List[Any] zlayout.spatial.QuadTreeNode< T >.get_all_objects | ( | self | ) |
Get all objects in this subtree.
Definition at line 109 of file spatial.py.
std::vector< T > zlayout::spatial::QuadTreeNode< T >::get_all_objects | ( | ) | const |
Get all objects in this subtree.
Definition at line 601 of file quadtree.hpp.
bool zlayout.spatial.QuadTreeNode< T >.insert | ( | self, | |
Any | obj, | ||
Rectangle | bbox ) |
Insert an object with its bounding box.
Definition at line 37 of file spatial.py.
bool zlayout::spatial::QuadTreeNode< T >::insert | ( | const T & | object, |
const BoundingBoxFunc & | get_bbox ) |
Insert object into this node or appropriate child.
object | Object to insert |
get_bbox | Function to get bounding box from object |
Definition at line 461 of file quadtree.hpp.
|
inline |
Check if this node has been subdivided.
Definition at line 92 of file quadtree.hpp.
List[Any] zlayout.spatial.QuadTreeNode< T >.query_point | ( | self, | |
Point | point ) |
Query all objects that contain the given point.
Definition at line 85 of file spatial.py.
std::vector< T > zlayout::spatial::QuadTreeNode< T >::query_point | ( | const geometry::Point & | point, |
const BoundingBoxFunc & | get_bbox ) const |
Query objects containing a specific point.
point | Query point |
get_bbox | Function to get bounding box from object |
Definition at line 525 of file quadtree.hpp.
List[Any] zlayout.spatial.QuadTreeNode< T >.query_range | ( | self, | |
Rectangle | range_bbox ) |
Query all objects that intersect with the given range.
Definition at line 65 of file spatial.py.
std::vector< T > zlayout::spatial::QuadTreeNode< T >::query_range | ( | const geometry::Rectangle & | range, |
const BoundingBoxFunc & | get_bbox ) const |
Query objects in a rectangular range.
range | Query rectangle |
get_bbox | Function to get bounding box from object |
Definition at line 496 of file quadtree.hpp.
int zlayout.spatial.QuadTreeNode< T >.size | ( | self | ) |
Get total number of objects in this subtree.
Definition at line 119 of file spatial.py.
size_t zlayout::spatial::QuadTreeNode< T >::size | ( | ) | const |
Get total number of objects in this subtree.
Definition at line 579 of file quadtree.hpp.
None zlayout.spatial.QuadTreeNode< T >.subdivide | ( | self | ) |
Divide this node into four quadrants.
Definition at line 20 of file spatial.py.
zlayout.spatial.QuadTreeNode< T >.boundary = boundary |
Definition at line 13 of file spatial.py.
geometry::Rectangle zlayout::spatial::QuadTreeNode< T >::boundary |
Spatial boundary of this node.
Definition at line 33 of file quadtree.hpp.
zlayout.spatial.QuadTreeNode< T >.capacity = capacity |
Definition at line 14 of file spatial.py.
size_t zlayout::spatial::QuadTreeNode< T >::capacity |
Maximum objects before subdivision.
Definition at line 37 of file quadtree.hpp.
list zlayout.spatial.QuadTreeNode< T >.children = [] |
Definition at line 18 of file spatial.py.
std::unique_ptr<QuadTreeNode> zlayout::spatial::QuadTreeNode< T >::children[4] |
Child nodes (NW, NE, SW, SE)
Definition at line 35 of file quadtree.hpp.
size_t zlayout::spatial::QuadTreeNode< T >::depth |
Current depth in tree.
Definition at line 39 of file quadtree.hpp.
bool zlayout::spatial::QuadTreeNode< T >::divided = False |
Whether this node has been subdivided.
Definition at line 36 of file quadtree.hpp.
zlayout.spatial.QuadTreeNode< T >.max_depth = max_depth |
Definition at line 15 of file spatial.py.
size_t zlayout::spatial::QuadTreeNode< T >::max_depth |
Maximum subdivision depth.
Definition at line 38 of file quadtree.hpp.
list zlayout.spatial.QuadTreeNode< T >.objects = [] |
Definition at line 16 of file spatial.py.
zlayout.spatial.QuadTreeNode< T >.objects |
Definition at line 44 of file spatial.py.
std::vector<T> zlayout::spatial::QuadTreeNode< T >::objects |
Objects stored in this node.
Definition at line 34 of file quadtree.hpp.