Drawings SDK Developer Guide > Working with Point Clouds > Working with Point Clouds with PointCloud SDK > Convert Unstructured Point Cloud Formats to .rcs Files
Convert Unstructured Point Cloud Formats to .rcs Files

PointCloud SDK provides you a set of interfaces you may use to convert other point cloud formats to .rcs file. Current implementation of PointCloud SDK supports conversion from unstructured (unorganized) point cloud formats only.

PointCloud SDK provides a special converter object used to perform the conversion and represented by OdPointCloudConverter class.

To convert any unstructured point cloud to .rcs file using OdPointCloudConverter you should implement several abstract interfaces declared in the following header file: Kernel/Include/RcsFileServices/OdPointCloudConverter.h

You should implement successor of OdPointCloudDataSource and also OdSourcePointIterator.

OdPointCloudDataSource interface defines how the converter interacts with the original point cloud format.

Successor of OdPointCloudDataSource must contain the following methods implemented:

Method Brief Description
virtual OdUInt64 pointsCount() const = 0; Returns the total number of points in the source point cloud.
virtual Units getUnits() const = 0; Gets the measurement unit used in the source point cloud.
virtual OdSourcePointIteratorPtr newSourcePointIterator() const = 0; Creates a new source point iterator to iterate through all points of the source point cloud.

Successor of OdSourcePointIterator must provide the following methods implemented:

Method Brief Description
virtual void start() = 0; Moves the current iterator position to the beginning of the point data within the data source.
virtual bool done() const = 0; Indicates whether the traversal by this iterator object is complete.
virtual bool getPoint(OdSourcePoint& point) = 0; Gets the source point that is currently pointed at by the source point data iterator. The iterator object steps forward after getting the point.

Conversion between the source point format and a corresponding instance of OdSourcePoint class defined in SDK is a task of OdSourcePointIterator’s successor.

Right after successors are implemented you should get the converter using the following method of RcsFileServices module:

virtual OdPointCloudConverterPtr getPointCloudConverter(OdPointCloudDataSourcePtr pDataSource, OdPointCloudConverterParamsPtr pParams = NULL) const = 0

And then you may start the conversion procedure using the corresponding method of the OdPointCloudConverter object:

virtual void convertToRcsFormat(const OdString& rcsFilePath, bool bMTMode = true) = 0

This method takes a full path to the result .rcs file ans also a flag that determines wether conversion should be performed using multi-threaded mode.

The complete conversion procedure might look as follows:


OdRxRcsFileServicesPtr pModule = odrxDynamicLinker()->loadModule("RcsFileServices");
OdPointCloudDataSourcePtr pDataSource = new OdPointCloudPtsDataSource(sourceFilePath);
OdPointCloudConverterPtr pConverter = pModule->getPointCloudConverter(pDataSource);
pConverter->convertToRcsFormat(outFilePath);
    

You may also customize the behavior of the converter to filter points out by intensity value during the conversion. For these purposes you should pass an instance of OdPointCloudConverterParams class to the method getPointCloudConverter() while obtaining the converter from the RcsFileServices module.

For more information, see also the PointCloudConverterSample sample application. This sample application demonstrates the approach to point cloud conversion. The sample contains an example of successors implementation for OdPointCloudDataSource and OdSourcePointIterator to use while converting .pts format to .rcs.

An implementation of the reverse conversion (from .rcs to other formats) is not presented in the current version of the PoinCloud SDK. It can be implemented by the user independently based on knowledge of the specific format and using the RcsPointCloudReadEx sample.

See Also

Basic Concept and List of Supported Point Cloud Formats

Read .rcs Files

Read .rcp Files

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.