Workspace 6.21.5
Classes | Public Types | Public Member Functions | List of all members
SplitAndLodPointCloud Class Reference

A functor that splits a point cloud into multiple sub-regions (patches) and computes multiple levels of detail (LODs) for each. More...

#include <Rendering/SceneComponents/splitandlodpointcloud.h>

Classes

class  LodSettings
 Settings for computing LOD for each patch. More...
 
struct  PatchIndex
 An index referring to a specific patch. The index corresponds to the patch's coordinates in 3 dimensions (x, y and z). More...
 
class  PatchList
 Represents a list of patches; sub-regions of a point cloud. More...
 
class  SplitSettings
 Settings that control how a point cloud is split into patches. More...
 

Public Types

using MeshList = QList< Mesh::MeshModelInterface * >
 
enum  PatchCountSpecification { Auto , Manual }
 Defines how the number of patches is determined - manually by the user or automatically based on the number of points in the model. More...
 
using QuadtreePlane = LinearSpatialPartitioningTree::QuadtreePlane
 
using TreeLayout = LinearSpatialPartitioningTree::TreeLayout
 

Public Member Functions

 SplitAndLodPointCloud (const SplitSettings &splitSettings, const LodSettings &lodSettings, std::function< void()> preCellProcessFunc=[] {}, std::function< void()> postCellProcessFunc=[] {})
 
 SplitAndLodPointCloud (std::function< void()> preCellProcessFunc=[] {}, std::function< void()> postCellProcessFunc=[] {})
 
 ~SplitAndLodPointCloud ()
 
QList< PatchIndexcreatePatches ()
 
const SplitSettingsgetSplitSettings () const
 
bool initSettings (const QString &baseId, Mesh::MeshModelInterface &pointCloud, PatchList &patchesOut)
 
bool lodPatchCloud (const PatchIndex &patchIndex, DataExecution::ObjectDictionary &diagnostics)
 
bool operator() (const QString &baseId, Mesh::MeshModelInterface &pointCloud, PatchList &patchesOut, DataExecution::ObjectDictionary &diagnosticsOut)
 
void setLodSettings (const LodSettings &lodSettings)
 
void setSplitSettings (const SplitSettings &splitSettings)
 

Detailed Description

The number and size of patches can be controlled through input parameters, as can the maximum and base levels of detail. Levels of detail are specified as LOD number 0 (zero) being the most detailed, and LOD N (dependent on the number of points and their density) being the least detailed.

The algorithm uses a sparse linear octree (or quad-tree if requested - useful for long, thin clouds) to sub-divide each patch into cells. For each cell at each level in the tree, the node closest to the cell's centroid is added to the LOD cloud associated with that level in the tree, along with all of the nodes associated with the previous LOD level. In order to ensure that calling code is always interacting with real point cloud data, no synthetic nodes are created.

Example: we have a patch containing 100 nodes spread out in an equally spaced 10 x 10 grid. Our algorithm will yield the following LODs for this patch:

LOD 0 - 100 points (full detail) LOD 1 - 85 points (1 for each of the 64 sub-cells, plus 21 from the previous level) LOD 2 - 21 points (1 for each of the 16 sub-cells, plus 5 from the previous level) LOD 3 - 5 points (1 for each of the 4 sub-cells, plus 1 from the previous level) LOD 4 - 1 point (least detail)

All LOD data is created by referencing points at LOD 0, so memory utilisation is minimised and state data is preserved on all individual points. Because no synthetic nodes are generated, no averaging of state data occurs.

Member Typedef Documentation

◆ MeshList

◆ QuadtreePlane

◆ TreeLayout

Member Enumeration Documentation

◆ PatchCountSpecification

Enumerator
Auto 
Manual 

Constructor & Destructor Documentation

◆ SplitAndLodPointCloud() [1/2]

SplitAndLodPointCloud ( std::function< void()>  preCellProcessFunc = [] {},
std::function< void()>  postCellProcessFunc = [] {} 
)

◆ SplitAndLodPointCloud() [2/2]

SplitAndLodPointCloud ( const SplitSettings splitSettings,
const LodSettings lodSettings,
std::function< void()>  preCellProcessFunc = [] {},
std::function< void()>  postCellProcessFunc = [] {} 
)

◆ ~SplitAndLodPointCloud()

~SplitAndLodPointCloud ( )
default

Member Function Documentation

◆ createPatches()

QList< SplitAndLodPointCloud::PatchIndex > createPatches ( )

◆ getSplitSettings()

const SplitAndLodPointCloud::SplitSettings & getSplitSettings ( ) const

◆ initSettings()

bool initSettings ( const QString &  baseId,
Mesh::MeshModelInterface pointCloud,
PatchList patchesOut 
)

◆ lodPatchCloud()

bool lodPatchCloud ( const PatchIndex patchIndex,
DataExecution::ObjectDictionary diagnostics 
)

◆ operator()()

bool operator() ( const QString &  baseId,
Mesh::MeshModelInterface pointCloud,
PatchList patchesOut,
DataExecution::ObjectDictionary diagnosticsOut 
)
Parameters
baseIdThe unique base identifier to associated with all output patches.
pointCloudPoint cloud to split into patches, each with multiple LODs (levels of detail).
patchesOut(out) The output patches produced by executing the functor.
diagnosticsOut(out) Diagnostic information computed during this execution.

Executes the SplitAndLodPointCloud functor on the target pointCloud, returning a list of patches in patchesOut. Each output patch is a MeshModelInstance with multiple LOD levels, each with a distance associated with them.

Returns
True if the split-and-lod was performed successfully, false if an error occurred.

◆ setLodSettings()

void setLodSettings ( const LodSettings lodSettings)

◆ setSplitSettings()

void setSplitSettings ( const SplitSettings splitSettings)