ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
ReUseX::vision::osd::FlatUniformGrid Class Reference

Compact spatial hash-grid for fast overlap queries during layout. More...

#include <labelLayoutSolver.hpp>

Collaboration diagram for ReUseX::vision::osd::FlatUniformGrid:

Classes

struct  Node

Public Member Functions

 FlatUniformGrid ()
void resize (int w, int h, int gridSize)
 Resize the grid to cover a canvas of w×h pixels using cells of gridSize.
void clear ()
 Reset all cells, keeping allocated memory.
void insert (int id, const LayoutBox &box)
 Insert item id with the given box into the grid.
template<typename Visitor>
void query (const LayoutBox &box, std::vector< int > &visitedToken, int cookie, Visitor &&visitor)
 Invoke visitor for each unique item overlapping box.

Public Attributes

int rows = 0
int cols = 0
float cellW = 100.0f
float cellH = 100.0f
float invCellW = 0.01f
float invCellH = 0.01f
std::vector< int > gridHead
std::vector< Nodenodes

Detailed Description

Compact spatial hash-grid for fast overlap queries during layout.

All object and label boxes are inserted into a uniform grid so that candidate overlap checks only need to visit a small neighbourhood rather than the full item list.

Definition at line 103 of file labelLayoutSolver.hpp.

Constructor & Destructor Documentation

◆ FlatUniformGrid()

ReUseX::vision::osd::FlatUniformGrid::FlatUniformGrid ( )
inline

Definition at line 116 of file labelLayoutSolver.hpp.

References nodes.

Member Function Documentation

◆ clear()

void ReUseX::vision::osd::FlatUniformGrid::clear ( )
inline

Reset all cells, keeping allocated memory.

Definition at line 138 of file labelLayoutSolver.hpp.

References cols, gridHead, nodes, and rows.

◆ insert()

void ReUseX::vision::osd::FlatUniformGrid::insert ( int id,
const LayoutBox & box )
inline

◆ query()

template<typename Visitor>
void ReUseX::vision::osd::FlatUniformGrid::query ( const LayoutBox & box,
std::vector< int > & visitedToken,
int cookie,
Visitor && visitor )
inline

Invoke visitor for each unique item overlapping box.

visitedToken and cookie are used to avoid visiting the same item twice per query.

Definition at line 166 of file labelLayoutSolver.hpp.

References ReUseX::vision::osd::LayoutBox::bottom, cols, gridHead, invCellH, invCellW, ReUseX::vision::osd::LayoutBox::left, nodes, ReUseX::vision::osd::LayoutBox::right, rows, and ReUseX::vision::osd::LayoutBox::top.

◆ resize()

void ReUseX::vision::osd::FlatUniformGrid::resize ( int w,
int h,
int gridSize )
inline

Resize the grid to cover a canvas of w×h pixels using cells of gridSize.

Definition at line 120 of file labelLayoutSolver.hpp.

References cellH, cellW, cols, gridHead, invCellH, invCellW, and rows.

Member Data Documentation

◆ cellH

float ReUseX::vision::osd::FlatUniformGrid::cellH = 100.0f

Definition at line 106 of file labelLayoutSolver.hpp.

Referenced by resize().

◆ cellW

float ReUseX::vision::osd::FlatUniformGrid::cellW = 100.0f

Definition at line 106 of file labelLayoutSolver.hpp.

Referenced by resize().

◆ cols

int ReUseX::vision::osd::FlatUniformGrid::cols = 0

Definition at line 105 of file labelLayoutSolver.hpp.

Referenced by clear(), insert(), query(), and resize().

◆ gridHead

std::vector<int> ReUseX::vision::osd::FlatUniformGrid::gridHead

Definition at line 109 of file labelLayoutSolver.hpp.

Referenced by clear(), insert(), query(), and resize().

◆ invCellH

float ReUseX::vision::osd::FlatUniformGrid::invCellH = 0.01f

Definition at line 107 of file labelLayoutSolver.hpp.

Referenced by insert(), query(), and resize().

◆ invCellW

float ReUseX::vision::osd::FlatUniformGrid::invCellW = 0.01f

Definition at line 107 of file labelLayoutSolver.hpp.

Referenced by insert(), query(), and resize().

◆ nodes

std::vector<Node> ReUseX::vision::osd::FlatUniformGrid::nodes

Definition at line 114 of file labelLayoutSolver.hpp.

Referenced by clear(), FlatUniformGrid(), insert(), and query().

◆ rows

int ReUseX::vision::osd::FlatUniformGrid::rows = 0

Definition at line 105 of file labelLayoutSolver.hpp.

Referenced by clear(), insert(), query(), and resize().


The documentation for this class was generated from the following file: