SCENE C++ API  2.0.22
Classes | Functions
Import

Functions and types for the import functionality that are not part of any class. More...

Classes

class  LSPointDataSource
 Interface for the import of unstructured point cloud data. More...
 

Functions

LSResult::Result importPointData (const ref_ptr< LSProject > &project, const LSString &name, const ref_ptr< LSPointDataSource > &source, ref_ptr< LSScan > &scan)
 Import unstructured or structured point data directly from memory into the given project. More...
 

Detailed Description

Functions and types for the import functionality that are not part of any class.

Function Documentation

◆ importPointData()

LSResult::Result SCENE_API::importPointData ( const ref_ptr< LSProject > &  project,
const LSString name,
const ref_ptr< LSPointDataSource > &  source,
ref_ptr< LSScan > &  scan 
)

Import unstructured or structured point data directly from memory into the given project.

This can be used to import point data without writing and reading files from disk. This can be used to write an importer for a proprietary point cloud file format. Currently only color or intensity is supported. This function cannot import both due to an internal limitation. Please keep in mind that the underlying implementation requires all points to fit in the computers memory. Very big data sets should therefore be separated into multiple chunks! The scan will be imported into the default scan folder (the "Scans" folder below the root object). Each successful call to this function will generate a new scan in the project tree. Here is a simple example:

struct MyCylinderSource : public LSPointDataSource
{
const int points = 1000000;
const double rotStep = 0.05;
int currentPoint = 0;
uint64_t getNumberOfPoints() const override { return points; }
bool hasColors() const override { return true; }
bool getNextPoint(
double pos[3], uint32_t& row, uint32_t& col, float normal[3],
uint8_t color[3], float& intensity) override
{
float factor = (float)currentPoint / points;
pos[0] = sin(rotStep * currentPoint);
pos[1] = cos(rotStep * currentPoint);
pos[2] = factor * 3;
color[0] = uint8_t(255 * factor);
color[1] = 0;
color[2] = uint8_t(255 * factor);
return currentPoint++ < points;
}
};
ref_ptr<LSProject> project = ...;
ref_ptr<LSPointDataSource> source = new MyCylinderSource();
ref_ptr<LSScan> scan = nullptr;
importPointData(project, L"my_magenta_cylinder", source, scan);
Parameters
projectThe project that should receive the imported data as a new scan object.
nameThe proposed name for the scan generated from the imported point data. If there is already something with that name, SCENE will generate a unique name by appending numbers. Retrieve the final name of the newly created scan by calling getName() on the objected returned through the scan parameter.
sourceAn instance of a implementation of the LSPointDataSource interface.
scanOutput parameter with a reference to the generated scan. Will stay empty if the import of the point data failed.
Version
SCENE API Version 2.0.21