qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ccRasterGrid Struct Reference

Raster grid type. More...

#include <ccRasterGrid.h>

Collaboration diagram for ccRasterGrid:
Collaboration graph
[legend]

Public Types

enum  ExportableFields {
  PER_CELL_HEIGHT , PER_CELL_COUNT , PER_CELL_MIN_HEIGHT , PER_CELL_MAX_HEIGHT ,
  PER_CELL_AVG_HEIGHT , PER_CELL_HEIGHT_STD_DEV , PER_CELL_HEIGHT_RANGE , PER_CELL_MEDIAN_HEIGHT ,
  PER_CELL_INVALID
}
 Exportable fields.
 
enum  ProjectionType {
  PROJ_MINIMUM_VALUE = 0 , PROJ_AVERAGE_VALUE = 1 , PROJ_MAXIMUM_VALUE = 2 , PROJ_MEDIAN_VALUE = 3 ,
  INVALID_PROJECTION_TYPE = 255
}
 Types of projection.
 
enum  EmptyCellFillOption {
  LEAVE_EMPTY = 0 , FILL_MINIMUM_HEIGHT = 1 , FILL_MAXIMUM_HEIGHT = 2 , FILL_CUSTOM_HEIGHT = 3 ,
  FILL_AVERAGE_HEIGHT = 4 , INTERPOLATE = 5
}
 Option for handling empty cells.
 
using Row = std::vector< ccRasterCell >
 Row.
 
using SF = std::vector< double >
 Scalar field.
 

Public Member Functions

 ccRasterGrid ()
 Default constructor.
 
virtual ~ccRasterGrid ()
 Destructor.
 
bool init (unsigned w, unsigned h, double gridStep, const CCVector3d &minCorner)
 Initializes / resets the grid. More...
 
void clear ()
 Clears the grid.
 
void reset ()
 Resets the grid.
 
ccPointCloudconvertToCloud (const std::vector< ExportableFields > &exportedFields, bool interpolateSF, bool interpolateColors, bool resampleInputCloudXY, bool resampleInputCloudZ, ccGenericPointCloud *inputCloud, unsigned char Z, const ccBBox &box, bool fillEmptyCells, double emptyCellsHeight, bool exportToOriginalCS) const
 Converts the grid to a cloud with scalar field(s)
 
bool fillWith (ccGenericPointCloud *cloud, unsigned char projectionDimension, ProjectionType projectionType, bool doInterpolateEmptyCells, double maxEdgeLength, ProjectionType sfInterpolation=INVALID_PROJECTION_TYPE, ccProgressDialog *progressDialog=nullptr)
 Fills the grid with a point cloud. More...
 
void fillEmptyCells (EmptyCellFillOption fillEmptyCellsStrategy, double customCellHeight=0)
 Fills the empty cell (for all strategies but 'INTERPOLATE')
 
unsigned updateNonEmptyCellCount ()
 Updates the number of non-empty cells.
 
void updateCellStats ()
 Updates the statistics about the cells.
 
bool interpolateEmptyCells (double maxSquareEdgeLength)
 Interpolates the empty cells. More...
 
void setValid (bool state)
 Sets valid.
 
bool isValid () const
 Returns whether the grid is 'valid' or not.
 
CCVector2i computeCellPos (const CCVector3 &P, unsigned char dimX, unsigned char dimY) const
 Computes the position of the cell that includes a given point.
 
CCVector2d computeCellCenter (int i, int j, unsigned char dimX, unsigned char dimY) const
 Computes the position of the center of a given cell.
 

Static Public Member Functions

static bool ComputeGridSize (unsigned char Z, const ccBBox &box, double gridStep, unsigned &width, unsigned &height)
 Computes the raster size for a given bounding-box.
 
static QString GetDefaultFieldName (ExportableFields field)
 Returns the default name of a given field.
 

Public Attributes

std::vector< Rowrows
 All cells.
 
std::vector< SFscalarFields
 Associated scalar fields.
 
unsigned width
 Number of columns.
 
unsigned height
 Number of rows.
 
double gridStep
 Grid step ('pixel' size)
 
CCVector3d minCorner
 Min corner (3D)
 
double minHeight
 Min height (computed on the NON-EMPTY or INTERPOLATED cells)
 
double maxHeight
 Max height (computed on the NON-EMPTY or INTERPOLATED cells)
 
double meanHeight
 Average height (computed on the NON-EMPTY or INTERPOLATED cells)
 
unsigned nonEmptyCellCount
 Number of NON-EMPTY cells.
 
unsigned validCellCount
 Number of VALID cells.
 
bool hasColors
 Whether the (average) colors are available or not.
 
bool valid
 Whether the grid is valid/up-to-date.
 

Detailed Description

Raster grid type.

Member Function Documentation

◆ fillWith()

bool ccRasterGrid::fillWith ( ccGenericPointCloud cloud,
unsigned char  projectionDimension,
ProjectionType  projectionType,
bool  doInterpolateEmptyCells,
double  maxEdgeLength,
ProjectionType  sfInterpolation = INVALID_PROJECTION_TYPE,
ccProgressDialog progressDialog = nullptr 
)

Fills the grid with a point cloud.

Since version 2.8, we are using the "PixelIsPoint" convention (contrarily to what was written in the code comments so far!). This means that the height is computed at the center of the grid cell.

◆ init()

bool ccRasterGrid::init ( unsigned  w,
unsigned  h,
double  gridStep,
const CCVector3d &  minCorner 
)

Initializes / resets the grid.

We use the "Pixel-is-area" convention but 'min corner'

corresponds to the lower left cell CENTER.

| | | | | U | V | W |

| | | |

| | | | | X | Y | Z |

| | | |

Here, w=3 and h=2, and minCorner=X

◆ interpolateEmptyCells()

bool ccRasterGrid::interpolateEmptyCells ( double  maxSquareEdgeLength)

Interpolates the empty cells.

Warning
The number of non empty cells must be up-to-date (see updateNonEmptyCellCount)
Parameters
maxSquareEdgeLengthMax (square) edge length to filter large triangles during the interpolation process

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