space_partitioning/quadtree/
node_info.rs

1use crate::quadtree::node::NodeElementCountType;
2use crate::quadtree::node_data::NodeData;
3use crate::quadtree::AABB;
4
5#[derive(Debug)]
6pub struct NodeInfo {
7    /// The node data.
8    pub(crate) nd: NodeData,
9    /// Gets the number of elements in this node.
10    pub element_count: u32,
11}
12
13impl NodeInfo {
14    #[inline]
15    pub(crate) fn from(nd: NodeData, element_count: NodeElementCountType) -> Self {
16        Self { nd, element_count }
17    }
18
19    /// Gets the depth of this node.
20    pub fn depth(&self) -> u8 {
21        self.nd.depth
22    }
23
24    #[inline]
25    pub fn get_aabb(&self) -> AABB {
26        self.nd.crect.get_aabb()
27    }
28}