FusedPointCloud Class Reference

Class representing a fused point cloud and containing the geometric and color data of the scene captured by the spatial mapping module. More...

Types

typedef std::vector< size_t > chunkList
 Vector of chunks id. More...
 

Functions

 FusedPointCloud ()
 Default constructor. More...
 
 ~FusedPointCloud ()
 Default destructor. More...
 
PointCloudChunkoperator[] (int index)
 Defines the [] operator to directly access the desired chunk. More...
 
size_t getNumberOfPoints ()
 Computes the total number of points stored in all chunks. More...
 
void updateFromChunkList (chunkList IDs=chunkList())
 Updates vertices and normals from chunk data pointed by the given sl::Mesh::chunkList. More...
 
bool save (String filename, MESH_FILE_FORMAT type=MESH_FILE_FORMAT::OBJ, chunkList IDs=chunkList())
 Saves the current sl::FusedPointCloud into a file. More...
 
bool load (String filename, bool update_chunk_only=false)
 Loads the fused point cloud from a file. More...
 
void clear ()
 Clears all the data. More...
 

Attributes

std::vector< PointCloudChunkchunks
 List of chunks constituting the sl::FusedPointCloud. More...
 
std::vector< float4 > vertices
 Vector of vertices. More...
 
std::vector< float3 > normals
 Vector of normals. More...
 

Detailed Description

Class representing a fused point cloud and containing the geometric and color data of the scene captured by the spatial mapping module.

By default the fused point cloud is defined as a set of point cloud chunks.
This way we update only the required data, avoiding a time consuming remapping process every time a small part of the sl::FusedPointCloud cloud is changed.

Member Typedef Documentation

◆ chunkList

typedef std::vector<size_t> chunkList

Vector of chunks id.

Constructor and Destructor

◆ FusedPointCloud()

Default constructor.

Creates an empty sl::FusedPointCloud.

◆ ~FusedPointCloud()

Default destructor.

Functions

◆ operator[]()

PointCloudChunk& operator[] ( int  index)

Defines the [] operator to directly access the desired chunk.

◆ getNumberOfPoints()

size_t getNumberOfPoints ( )

Computes the total number of points stored in all chunks.

Returns
The number of points stored in all chunks.

◆ updateFromChunkList()

void updateFromChunkList ( chunkList  IDs = chunkList())

Updates vertices and normals from chunk data pointed by the given sl::Mesh::chunkList.

Parameters
IDs: Indices of chunks which will be concatenated. Default: (empty).
Note
If the given sl::FusedPointCloud::chunkList is empty, all chunks will be used to update the current sl::FusedPointCloud.

◆ save()

bool save ( String  filename,
MESH_FILE_FORMAT  type = MESH_FILE_FORMAT::OBJ,
chunkList  IDs = chunkList() 
)

Saves the current sl::FusedPointCloud into a file.

Parameters
filename: Path of the file to store the fused point cloud in.
type: File extension type. Default: sl::MESH_FILE_FORMAT::OBJ.
IDs: Set of chunks to be saved. Default: (empty) (all chunks are saved)
Returns
True if the file was successfully saved, otherwise false.
Note
This method operates on the sl::FusedPointCloud not on chunks.
This way you can save different parts of your sl::FusedPointCloud by updating it with updateFromChunkList().

◆ load()

bool load ( String  filename,
bool  update_chunk_only = false 
)

Loads the fused point cloud from a file.

Parameters
filename: Path of the file to load the fused point cloud from.
update_chunk_only: Whether to only load data in chunks (and not vertices / normals).
Default: false.
Returns
True if the mesh was successfully loaded, otherwise false.
Note
Updating a sl::FusedPointCloud is time consuming. Consider using only chunks for better performances.

◆ clear()

void clear ( )

Clears all the data.

Variables

◆ chunks

std::vector<PointCloudChunk> chunks

List of chunks constituting the sl::FusedPointCloud.

◆ vertices

std::vector<float4> vertices

Vector of vertices.

Vertices are defined by a colored 3D point {x, y, z, rgba}.

◆ normals

std::vector<float3> normals

Vector of normals.

Normals are defined by three components {nx, ny, nz}.