PCD

Class for import and export to PCD.
The functions/classes available to the user are described in the PCD.cs file.

Public class fields

string version

PCD file version.

uint points

Total number of points.

uint width

Width of the dataset.

uint height

Height of the dataset.

DataFormat format

Data Type. Ascii or Binary.

PointCloud pc

Point cloud data. Vertex, normal, and color arrays.

public class PointCloud
{
    [SerializeField] public Vector3[] vertices;
    [SerializeField] public Vector3[] normals;
    [SerializeField] public Color32[] colors;
}

Vector3 viewportTransform

Location of the data acquisition perspective.

Quaternion viewportRotation

Rotation of data acquisition perspective


Static method

PCD LoadFromFile( path, option )

Import PCD from a file(path).

Argument
Argument Description
string path Path of file to be imported.
Option option Import Options.

PCD LoadFromStream( stream, option )

Import PCD from the stream.

Argument
Argument Description
Stream stream Streams to read data from.
Option option Import Options.

IEnumerator LoadFromFileRoutine( onFinished, path, option, monitor )

Generates a coroutine to import PCD from a file.
onFinished() is called when loading is complete or fails.
Argument
Argument Description
System.Action<LoadResult> onFinished Callback to be called on completion of loading.
string path Path of file to be imported.
Option option = Option.ColorBGR Import Options.
ProgressMonitor monitor = null Variables to monitor the status of loading.

IEnumerator LoadFromStreamRoutine( onFinished, stream, option, monitor )

Generates a coroutine to import PCD from a stream.
onFinished() is called when loading is complete or fails.
Argument
Argument Description
System.Action<LoadResult> onFinished Callback to be called on completion of loading.
Stream stream Streams to read data from.
Option option = Option.ColorBGR Import Options.
ProgressMonitor monitor = null Variables to monitor the status of loading.

void WriteToFile( pcd, path, option, writeColor )

Export PCD to stream.

Argument
Argument Description
PCD pcd Target PCD.
string path Path of file to be exported.
Option option = Option.None Export Options.
bool? writeColor = null Whether or not to write a color. If null, it depends on whether or not PCD has a color.

void WriteToStream( pcd, stream, option, writeColor )

Export PCD to stream.

Argument
Argument Description
PCD pcd Target PCD.
Stream stream Streams to export.
Option option = Option.None Export Options.
bool? writeColor = null Whether or not to write a color. If null, it depends on whether or not PCD has a color.

PCD Generate( vertices, normals, colors )

Generate PCD from arguments.

Argument
Argument Description
Vector3[] vertices Vertex of point cloud.
Vector3[] normals = null Normal of point cloud. Length of array must match the vertices.
Color32[] colors = null Color of point cloud. Length of array must match the vertices.

Enum

Option

Values Description
None Import the point cloud as is.
SwapYZ Swaps the Y and Z axes of the point cloud.
ColorBGR Import a color sequence as a BGR. This is set as the default value.
ColorRGB Import a color sequence as a RGB.