What is a Marshal in C#?? and where can i find the copy.Marshal

Refresh

6 days ago

Views

28 time

0

I want to capture point clouds from the Meta 2 example MetaGetPointClouds and save them in to a PCD file. The code ends like this:

private void MarshalMetaPointCloud()
{
    _pointCloud.num_points = _metaPointCloud.num_points;

    int point_cloud_size = 3 * _pointCloud.num_points;

    Marshal.Copy(_metaPointCloud.points,
                  _pointCloud.points,
                  0, point_cloud_size);
}

can someone explain me what is Marshal.Copy, where the pointCloud.points are been saved and how to pass them in to a PCD file ?

This is for Unity Engine using META SDK

1 answers

1

Here is the related documentation

Marshall class

System.Runtime.InteropServices.Marshall Class documentation.

Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks, and converting managed to unmanaged types, as well as other miscellaneous methods used when interacting with unmanaged code.

Copy method

Documentation

Copies data from a managed array to an unmanaged memory pointer, or from an unmanaged memory pointer to a managed array.