PointCloud2BIM Library  1.0
Library to facilitate the transpormation of point clouds into digital BIM representation
Public Member Functions | List of all members
BitGrid Class Reference

Public Member Functions

 BitGrid (int dimensions, struct BoundingBoxInfo &bbox, double step)
 Creates bitgrid with given dimensions. More...
 
void reset ()
 Reset vector of points and resize it to current size.
 
const std::vector< bool > & getPoints ()
 Get the points object. More...
 
void getActiveCellsIndex (std::vector< int > &res)
 Put active index ids into a vector. More...
 
BoundingBoxInfogetBBox ()
 Get the bounding box struct. More...
 
bool get (int i)
 Get grid item by coordinate index (1d or nth point in vector). More...
 
bool get (int x, int y)
 Get grid item by coordinate indexes (2d). More...
 
bool get (int x, int y, int z)
 Get grid item by coordinate indexes (3d). More...
 
int getX (int i)
 Get x index coordinate from single vector index. More...
 
int getY (int i)
 Get y index coordinate from single vector index. More...
 
bool pointExists (PointXYZ &p)
 Check if points exists in our bit grid and if it is set true. More...
 
PointXYZ getPoint (int i)
 Return a point from vector index. More...
 
double getArea ()
 Get the area of our grid. Only works for 2d grids. More...
 
int getActiveCells ()
 Get the number of active cells (marked as true). More...
 
int getDimensions ()
 Get grid dimensions. More...
 
int getSize ()
 Get the size of our grid (length of vector). More...
 
int getSizeX ()
 Get grid size in x direction. More...
 
int getSizeY ()
 Get grid size in y direction. More...
 
int getSizeZ ()
 Get grid size in z direction. More...
 
double getStepX ()
 Get size of grid step in the x direction. More...
 
double getStepY ()
 Get size of grid step in the y direction. More...
 
double getStepZ ()
 Get size of grid step in the z direction. More...
 
void invert ()
 Activate deactivated cells and deactivate activated. Used in backfill algorithm.
 
void backfill ()
 Backfill holes in the activated grid. Useful for found rooms not to miss some inner points.
 
bool add (PointXYZNormal &p)
 Activate grid cell. Cell coordinates are computed for the given point. More...
 
bool add (PointXYZ &p)
 Activate grid cell. Cell coordinates are computed for the given point. More...
 
void add (int i)
 Activate grid cell by 1d index. More...
 
void add (int x, int y)
 Activate grid by integer x,y coordinates. More...
 
void remove (int i)
 Deactivate grid cell by 1d index. More...
 
std::vector< PointXYZgetBoundingPolygon ()
 Returns bounding polygon. More...
 
svg::Document toSVG (std::filesystem::path path)
 Saves BitGrid to SVG format. More...
 

Constructor & Destructor Documentation

BitGrid::BitGrid ( int  dimensions,
struct BoundingBoxInfo bbox,
double  step 
)

Creates bitgrid with given dimensions.

Parameters
dimensionsNumber of dimensions
bboxBounding box of BitGrid to be created
stepCell size

Member Function Documentation

bool BitGrid::add ( PointXYZNormal p)

Activate grid cell. Cell coordinates are computed for the given point.

Parameters
pPoint with X,Y,Z coordinates
Returns
True if cell was activated (index within grid bounds)
False if calculated grid index is out of bounds
bool BitGrid::add ( PointXYZ p)

Activate grid cell. Cell coordinates are computed for the given point.

Parameters
pPoint with X,Y,Z coordinates
Returns
True if cell was activated (index within grid bounds)
False if calculated grid index is out of bounds
void BitGrid::add ( int  i)

Activate grid cell by 1d index.

Parameters
iIndex of a cell to be activated
void BitGrid::add ( int  x,
int  y 
)

Activate grid by integer x,y coordinates.

Parameters
xX grid coordinate
yY grid coordinate
bool BitGrid::get ( int  i)

Get grid item by coordinate index (1d or nth point in vector).

Parameters
iIndex in vector
Returns
True if index exists and is marked true
False if index doesnt exist or is marked false
bool BitGrid::get ( int  x,
int  y 
)

Get grid item by coordinate indexes (2d).

Parameters
xX index
yY index
Returns
True if index exists and is marked true
False if index doesnt exist or is marked false
bool BitGrid::get ( int  x,
int  y,
int  z 
)

Get grid item by coordinate indexes (3d).

Parameters
xX index
yY index
zZ index
Returns
True if indexes exist and are marked true
False if indexes do not exist or are marked false
int BitGrid::getActiveCells ( )

Get the number of active cells (marked as true).

Returns
Number of active cells
void BitGrid::getActiveCellsIndex ( std::vector< int > &  res)

Put active index ids into a vector.

Parameters
resReturn parametr storing active cell indexes
double BitGrid::getArea ( )

Get the area of our grid. Only works for 2d grids.

Returns
Area in units squared
BoundingBoxInfo & BitGrid::getBBox ( )

Get the bounding box struct.

Returns
BoundingBoxInfo
std::vector< PointXYZ > BitGrid::getBoundingPolygon ( )

Returns bounding polygon.

Returns
Bounding polygon
int BitGrid::getDimensions ( )

Get grid dimensions.

Returns
1 for 1d, 2 for 2d, 3 for 3d
PointXYZ BitGrid::getPoint ( int  i)

Return a point from vector index.

Parameters
iIndex of a cell
Returns
PointXYZ
const std::vector< bool > & BitGrid::getPoints ( )

Get the points object.

Returns
Points object
int BitGrid::getSize ( )

Get the size of our grid (length of vector).

Returns
Number of cells
int BitGrid::getSizeX ( )

Get grid size in x direction.

Returns
Number of cells in the x direction
int BitGrid::getSizeY ( )

Get grid size in y direction.

Returns
Number of cells in the y direction
int BitGrid::getSizeZ ( )

Get grid size in z direction.

Returns
Number of cells in the z direction
double BitGrid::getStepX ( )

Get size of grid step in the x direction.

Returns
Size of the x step
double BitGrid::getStepY ( )

Get size of grid step in the y direction.

Returns
Size of the y step
double BitGrid::getStepZ ( )

Get size of grid step in the z direction.

Returns
Size of the z step
int BitGrid::getX ( int  i)

Get x index coordinate from single vector index.

Parameters
iIndex of the cell
Returns
X coordinate
int BitGrid::getY ( int  i)

Get y index coordinate from single vector index.

Parameters
iIndex of the cell
Returns
Y coordinate
bool BitGrid::pointExists ( PointXYZ p)

Check if points exists in our bit grid and if it is set true.

Parameters
pPoint to check
Returns
True if point is within grid bounds and flag is set to true
False if point doesn't exist in the grid or flag is se to false
void BitGrid::remove ( int  i)

Deactivate grid cell by 1d index.

Parameters
iIndex of a cell to be deactivated
svg::Document BitGrid::toSVG ( std::filesystem::path  path)

Saves BitGrid to SVG format.

Parameters
pathPath to file where to save the SVG
Returns
SVG Document

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