euv_engine/spatial/type.rs
1use super::*;
2
3/// A grid cell key for 2D spatial partitioning, combining x and y indices.
4pub type CellKey2D = (i32, i32);
5
6/// A grid cell key for 3D spatial partitioning, combining x, y, and z indices.
7pub type CellKey3D = (i32, i32, i32);
8
9/// A list of body indices stored within a single grid cell.
10pub type CellEntries = Vec<usize>;
11
12/// A hash map from 2D cell keys to lists of body indices.
13pub type SpatialCellMap2D = HashMap<CellKey2D, CellEntries>;
14
15/// A hash map from 3D cell keys to lists of body indices.
16pub type SpatialCellMap3D = HashMap<CellKey3D, CellEntries>;
17
18/// The four child node handles of a subdivided 2D quadtree node, ordered
19/// low-x/low-y, high-x/low-y, low-x/high-y, high-x/high-y.
20pub type QuadTreeChildren2D = [usize; 4];
21
22/// The list of body entries stored directly inside one 2D quadtree node.
23pub type QuadTreeEntryList2D = Vec<QuadTreeEntry2D>;
24
25/// The flat node arena backing a 2D quadtree, addressed by node handle.
26pub type QuadTreeNodeList2D = Vec<QuadTreeNode2D>;
27
28/// The explicit traversal stack used by 2D quadtree queries, so no recursion
29/// is needed and no `Box`-linked child borrows are required.
30pub type QuadTreeNodeStack2D = Vec<usize>;