Class cwipc_pointcloud

Class Documentation

class cwipc_pointcloud

Abstract interface to a single pointcloud.

This structure wraps a single pointcloud, and is suitable for passing around without caring about the details of point data (and without having to include all of the PCL headers and such). The object can be passed between different shared libraries, different languages, etc.

When used from C (as opposed to C++) this is an opaque struct _cwipc pointer.

Public Functions

inline virtual ~cwipc_pointcloud()

Destructor. Does not free underlying pointcloud data.

You must call free() before calling the destructor (unless you have passed the cwipc object across an implementation language boundary and a reference may still be held there).

virtual void free() = 0

Deallocate the pointcloud data.

The internal implementation of the pointcloud data may be refcounted, but an explicit free method must be called to ensure the refcounting does not inadvertantly free the pointcloud when dereferenced from a different DLL or implementation language.

Whoever created the cwipc object in the first place is responsible for calling free, and the correct DLL will be invoked to actually free the data.

virtual cwipc_pointcloud *_shallowcopy() = 0

Create a shallow copy of this point cloud For internal use only: returns a new cwipc_pointcloud that shares the underlying (refcounted) data.

virtual uint64_t timestamp() = 0

Time this pointcloud was captured.

Returns:

Time in milliseconds, since some unspecified origin.

virtual float cellsize() = 0

Returns the grid cell size at which this pointcloud was created, if known.

If the pointcloud is to be displayed the number returned by this call is a good guess for a pointsize to use to show an obect that does not have any holes in it.

Returns:

Either a size (in the same coordinates as x, y and z) or 0 if unknown.

virtual void _set_cellsize(float cellsize) = 0

Semi-private method to initialize the cellsize. Not for general use. Passing a negative number will use a heuristic to determine a reasonable value for the cellsize.

virtual void _set_timestamp(uint64_t timestamp) = 0

Semi-private method to initialize the timestamp. Not for general use.

virtual int count() = 0

Returns the number of points in the pointcloud.

Returns:

the point count

virtual size_t get_uncompressed_size() = 0

Returns size (in bytes) an external representation of this pointcloud needs.

Returns:

The number of bytes needed (or zero in case the format does not match or no points are available).

virtual int copy_uncompressed(struct cwipc_point *pointbuf, size_t size) = 0

Get points from pointcloud in external representation format.

The caller is responsible for first calling get_uncompressed_size() and then allocating the data. This is to ensure that the memory is allocated in a way that is compatible with the caller (for example if the caller is implemented in another language like C# or Python and needs a special allocator).

Parameters:
  • pointbuf – A databuffer pointer.

  • size – The size of the databuffer (in bytes).

Returns:

The number of points.

virtual size_t copy_packet(uint8_t *packet, size_t size) = 0

Get pointcloud in external representation format.

Call with packet=NULL to obtain packet buffer size. Then allocate a buffer and call with buffer and size to copy the packet data.

Parameters:
  • packet – A databuffer pointer.

  • size – The size of the databuffer (in bytes).

Returns:

The size of the databuffer

virtual cwipc_pcl_pointcloud access_pcl_pointcloud() = 0

Access PCL pointcloud.

Note that this function returns a borrowed reference, it is not guaranteed that the reference remains valid after free() is called.

Returns:

A reference to the PCL pointcloud.

virtual cwipc_metadata *access_metadata() = 0

Access metadata collection.

Note that this function returns a borrowed reference (and that the collection consists of more borrowed references). These references become invalid when free() is called.

Returns:

A reference to the metadata collection.