iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

#include <nrt/PointCloud2/PointCloud2.H>

A class for representing point clouds.

PointClouds are collections of data associated with geometrically defined points. This class allows for arbitrary data to be associated with a point cloud in addition to the basic geometry.

A CMAKE compilation flag, POINTCLOUD_DOUBLE, determines whether the base type of the point cloud will use single or double precision floating point numbers for the geometry. The geometry fields will define a three dimensional homogenous point (XYZ + W) that is the core of a pointcloud.

Additional fields can be added onto a point cloud allowing each geometrical point to be associated with additional data. These fields can be dense or sparse but will always be tied to an existing geometrical point in the point cloud. Point clouds cannot store information that does not directly relate to their geometry.

Dense fields will have a 1:1 correspondence with geometry while sparse fields do not need to obey this; you are allowed to have a geometrical entry without having an associated sparse entry.

Sparse fields are denoted as sparse when they are created by wrapping a type in the SparseField<> template, but apart from that point operate without the need for an explicit demarcation. Point clouds have the restriction that any field added, regardless of whether it is dense or sparse, must be unique when judged on an std::is_same basis.

In general sparse data will be slower to access or insert and should only be used when the tradeoff between size and decreased performance makes sense.

It should be noted that regardless of the data type accessed in a Point Cloud, if it is specified as a specific dense or sparse field as a template parameter, there is a small cost associated with an implementation specific lookup that must occur. This means that code that relies on calling functionality that specifies explicit fields should be be avoided in loops if possible. For example, the creation of iterator objects incurs this lookup cost, but the actual use of iterators does not - thus for maximum performance if the size/order of a point cloud will not change during iteration, it is best to avoid calculating end iterators at each iteration. The cost of this lookup is small in isolation, but used incorrectly in looping situations can result in degraded performance.

PointClouds are reference counted and utilize a copy-on-write mechanism similar to nrt::Array. This means that any function of PointCloud2 that can modify its contents in any fashion may perform a deep copy to obtain unique ownership of the underlying data. Constant accessors will never perform a deep copy. If you are the sole owner of the data, a deep copy will not occur.

Since PointClouds use reference counting to manage their memory, you should follow sensible conventions in multi-threaded environments regarding passing by value or by reference: if it is not known whether a stable reference to a cloud exists, pass by value: it will increment the reference count and keep the memory safe until it has been used. Otherwise, if it is known that a stable reference to a cloud will exist throughout the lifetime of a function where it has been passed by reference, then there is no need to pass by value. Passing by value incurs a slightly higher overhead due to an atomic lookup that must occur. This information only applies to clouds that are passed as const. Non const clouds will always incur a deep copy as soon as they are modified.

Examples:
tests/test-PointCloud2.C, tests/test-PointCloud2Common.C, tests/test-PointCloud2Filter.C, tests/test-PointCloud2Normals.C, tests/test-PointCloud2OpenNI.C, tests/test-PointCloud2Registration.C, tests/test-PointCloud2Search.C, and tests/test-PointCloud2Speed.C.

Definition at line 127 of file PointCloud2.H.

Classes

class  ConstIterator
 A constant iterator over geometry and other fields. More...
 
class  ConstIterator< FirstT, OtherT...>
 Template specialization for ConstIterator with variadic template parameters. More...
 
class  ConstIterator<>
 Template specialization for ConstIterator with no template parameters. More...
 
class  Iterator
 An iterator over geometry and other fields. More...
 
class  Iterator< FirstT, OtherT...>
 Template specialization for Iteartor with variadic templates. More...
 
class  Iterator<>
 Template specialization for Iterator with no parameters. More...
 

Public Types

typedef Geometrygeometry_iterator
 An iterator for going over only geometry.
 
typedef Geometry const * geometry_const_iterator
 An iterator for going over only constant geometry.
 
Convenience typedefs

The following typedefs allow easy access of related structures that depend upon the point cloud base type

typedef POINTCLOUD2_BASE_TYPE BaseType
 
typedef PointSSE
< POINTCLOUD2_BASE_TYPE > 
Geometry
 The type of the underlying geometry.
 
typedef Eigen::Matrix
< POINTCLOUD2_BASE_TYPE, 3, 1 > 
Vector3
 A 3x1 vector.
 
typedef Eigen::Matrix
< POINTCLOUD2_BASE_TYPE, 4, 1 > 
Vector4
 A 4x1 vector.
 
typedef Eigen::Matrix
< POINTCLOUD2_BASE_TYPE,
Eigen::Dynamic, 1 > 
VectorX
 An Nx1 vector.
 
typedef Eigen::Matrix
< POINTCLOUD2_BASE_TYPE, 3, 3 > 
Matrix3
 A 3x3 matrix.
 
typedef Eigen::Matrix
< POINTCLOUD2_BASE_TYPE, 4, 4 > 
Matrix4
 A 4x4 matrix.
 
typedef Eigen::Matrix
< POINTCLOUD2_BASE_TYPE,
Eigen::Dynamic, Eigen::Dynamic > 
MatrixX
 An NxN matrix.
 
typedef Eigen::Transform
< POINTCLOUD2_BASE_TYPE,
3, Eigen::Affine > 
AffineTransform
 An affine transformation matrix.
 

Public Member Functions

Constructors and assignment operators
 PointCloud2 (size_t initialSize=0)
 Create an empty point cloud with no fields. More...
 
 PointCloud2 (PointCloud2 const &other)
 Create from an already existing cloud. More...
 
 PointCloud2 (PointCloud2 &&other)
 Move from an already existing cloud. More...
 
 ~PointCloud2 ()
 Destructor.
 
PointCloud2operator= (PointCloud2 const &other)
 Assignment operator. More...
 
PointCloud2operator= (PointCloud2 &&other)
 R value move assignment operator. More...
 
Field operations

Functionality concerned with inserting, deleting, or otherwise querying the dense or sparse fields of a point cloud.

template<class... Fields>
void addField ()
 Adds fields to this point cloud. More...
 
template<class... Fields>
void removeField ()
 Removes fields from the point cloud. More...
 
template<class T >
bool hasField () const
 Checks if the point cloud contains a specific field, dense or sparse. More...
 
template<class T >
bool hasDenseField () const
 Checks if the point cloud contains a specific dense field.
 
template<class T >
bool hasSparseField () const
 Checks if the point cloud contains a specific sparse field. More...
 
template<class T >
bool hasSparseData (size_t const index) const
 Checks whether a specific index in the point cloud contains data of a particular sparse type. More...
 
template<class T >
Indices getSparseIndices () const
 Assuming the requested field is sparse, retrieves all indices that contain the field. More...
 
bool hasSameFields (PointCloud2 const other) const
 Checks if a point cloud has the same fields as another.
 
size_t size () const
 Gets the number of dense entries in the point cloud.
 
template<class T >
size_t size () const
 Gets the number of entries for a particular field. More...
 
bool empty () const
 Gets whether the cloud is completely empty (no dense entries)
 
Individual element access

Functions to query individual elements from a point cloud. In general, this will be slower than using iterators to access multiple elements

Geometryoperator[] (size_t index)
 Returns a reference to the geometry at the specified index.
 
Geometry const & operator[] (size_t index) const
 Returns a const reference to the geometry at the specified index.
 
PointCloud2DataRef get (size_t index)
 Returns a reference to the geometry at the specified index. More...
 
template<class... Fields>
PointCloud2DataRef< typename
StripSparse< Fields >::type...> 
get (size_t index)
 Returns a reference to fields at the requested index. More...
 
PointCloud2ConstDataRef at (size_t index) const
 Returns a constant reference to the geometry at the specified index.
 
template<class... Fields>
PointCloud2ConstDataRef
< typename StripSparse< Fields >
::type...> 
at (size_t index) const
 Returns a constant reference to fields at the requested index. More...
 
Iterators

The following iterators provide efficient access to the contents of a point cloud

Iterator begin ()
 Get a basic iterator (includes geometry) to the beginning of the data. More...
 
ConstIterator begin () const
 Get a basic iterator (includes geometry) to the beginning of the data.
 
ConstIterator const_begin () const
 Get a basic iterator (includes geometry) to the beginning of the data.
 
template<class T , class... OtherT>
Iterator< typename StripSparse
< T >::type, typename
StripSparse< OtherT >::type...> 
begin ()
 Get an iterator to the requested fields, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
begin () const
 Get a constant iterator to the requested fields, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
const_begin () const
 Get a constant iterator to the requested fields, including geometry. More...
 
Iterator end ()
 Get a basic iterator (includes geometry) to one past the end of the data. More...
 
ConstIterator end () const
 Get a basic iterator (includes geometry) to one past the end of the data.
 
ConstIterator const_end () const
 Get a basic iterator (includes geometry) to one past the end of the data.
 
template<class T , class... OtherT>
Iterator< typename StripSparse
< T >::type, typename
StripSparse< OtherT >::type...> 
end ()
 Get an iterator to the requested fields, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
end () const
 Get a constant iterator to the requested fields, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
const_end () const
 Get a constant iterator to the requested fields, including geometry. More...
 
geometry_iterator geometry_begin ()
 Gets an iterator to only geometrical data (first entry)
 
geometry_const_iterator geometry_begin () const
 Gets an iterator to only geometrical data (first entry)
 
geometry_const_iterator geometry_const_begin () const
 Gets an iterator to only geometrical data (first entry)
 
geometry_iterator geometry_end ()
 Gets an iterator to only geometrical data (past the last entry)
 
geometry_const_iterator geometry_end () const
 Gets an iterator to only geometrical data (past the last entry)
 
geometry_const_iterator geometry_const_end () const
 Gets an iterator to only geometrical data (past the last entry)
 
Subset iterators

The following subset iterators provide access to only specified indices of a point cloud

Iterator subset_begin (Indices const indices)
 Get a basic iterator (includes geometry) to the beginning of the subset. More...
 
ConstIterator subset_begin (Indices const indices) const
 Get a basic iterator (includes geometry) to the beginning of the subset. More...
 
ConstIterator subset_const_begin (Indices const indices) const
 Get a basic iterator (includes geometry) to the beginning of the subset. More...
 
template<class T , class... OtherT>
Iterator< typename StripSparse
< T >::type, typename
StripSparse< OtherT >::type...> 
subset_begin (Indices const indices)
 Get an iterator to the requested fields in a subset, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
subset_begin (Indices const indices) const
 Get an constant iterator to the requested fields in a subset, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
subset_const_begin (Indices const indices) const
 Get an constant iterator to the requested fields in a subset, including geometry. More...
 
Iterator subset_end (Indices const indices)
 Get a basic iterator (includes geometry) to one past the end of the subset. More...
 
ConstIterator subset_end (Indices const indices) const
 Get a basic iterator (includes geometry) to one past the end of the subset. More...
 
ConstIterator subset_const_end (Indices const indices) const
 Get a basic iterator (includes geometry) to one past the end of the subset. More...
 
template<class T , class... OtherT>
Iterator< typename StripSparse
< T >::type, typename
StripSparse< OtherT >::type...> 
subset_end (Indices const indices)
 Get an iterator to one past the end of the requested fields in a subset, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
subset_end (Indices const indices) const
 Get an constant iterator to one past the end of the requested fields in a subset, including geometry. More...
 
template<class T , class... OtherT>
ConstIterator< typename
StripSparse< T >::type,
typename StripSparse< OtherT >
::type...> 
subset_const_end (Indices const indices) const
 Get an constant iterator to one past the end of the requested fields in a subset, including geometry. More...
 
Ranges

The following classes provide a lightweight range access to the contents of a point cloud

Creating a range may cause a deep copy of the underlying data to occur if not the sole owner of the data while requesting a non constant range. Ranges wrap up a begin and end iterator and give a convenient way to access point cloud data using mechanisms such as a range based for loop.

Ranges will always include a reference to the geometry and this needs not be specified during their creation.

IteratorRange< geometry_iteratorgeometry_range ()
 Gets a range that only includes raw geometry over the entire point cloud. More...
 
IteratorRange
< geometry_const_iterator
geometry_range () const
 Gets a range that only includes raw constant geometry over the entire point cloud.
 
IteratorRange
< geometry_const_iterator
geometry_const_range () const
 Gets a range that only includes raw constant geometry over the entire point cloud.
 
IteratorRange< Iterator<> > range ()
 Gets a range that only includes geometry over the entire point cloud. More...
 
IteratorRange< ConstIterator<> > range () const
 Gets a range that only includes constant geometry over the entire point cloud.
 
IteratorRange< ConstIterator<> > const_range () const
 Gets a range that only includes constant geometry over the entire point cloud.
 
IteratorRange< Iterator<> > subset_range (Indices const indices)
 Gets a range that only includes geometry over a subset of the cloud. More...
 
IteratorRange< ConstIterator<> > subset_range (Indices const indices) const
 Gets a range that only includes constant geometry over a subset of the cloud.
 
IteratorRange< ConstIterator<> > subset_const_range (Indices const indices) const
 Gets a range that only includes constant geometry over a subset of the cloud.
 
template<class T , class... OtherT>
IteratorRange< Iterator
< typename StripSparse< T >
::type, typename StripSparse
< OtherT >::type...> > 
range ()
 Gets a range over the requested fields for the entire point cloud. More...
 
template<class T , class... OtherT>
IteratorRange< ConstIterator
< typename StripSparse< T >
::type, typename StripSparse
< OtherT >::type...> > 
range () const
 Gets a range over the requested fields for the entire point cloud. More...
 
template<class T , class... OtherT>
IteratorRange< ConstIterator
< typename StripSparse< T >
::type, typename StripSparse
< OtherT >::type...> > 
const_range () const
 Gets a range over the requested fields for the entire point cloud. More...
 
template<class T , class... OtherT>
IteratorRange< Iterator
< typename StripSparse< T >
::type, typename StripSparse
< OtherT >::type...> > 
subset_range (Indices const indices)
 Gets a range over the requested fields for some subset. More...
 
template<class T , class... OtherT>
IteratorRange< ConstIterator
< typename StripSparse< T >
::type, typename StripSparse
< OtherT >::type...> > 
subset_range (Indices const indices) const
 Gets a range over the requested fields for the entire point cloud. More...
 
template<class T , class... OtherT>
IteratorRange< ConstIterator
< typename StripSparse< T >
::type, typename StripSparse
< OtherT >::type...> > 
subset_const_range (Indices const indices) const
 Gets a range over the requested fields for the entire point cloud. More...
 
Cloud insertion and deletion

Functionality for inserting elements, resizing the point cloud, and clearing elements or the entire cloud

void resize (size_t size)
 Resizes the point cloud. More...
 
void clear ()
 Removes all data in every field (but does not remove fields) including geometry.
 
void insert (Geometry const &geo)
 Inserts a single geometrical point at the end of the cloud. More...
 
template<class... Fields>
void insert (PointCloud2Data< Fields...> const &point)
 Inserts a single point at the end of the cloud. More...
 
template<class... Fields>
void insertSparse (size_t const index, StreamableGenericBag< Fields...> const &data)
 Adds sparse data to a point. More...
 
PointCloud2append (PointCloud2 const other)
 Appends all data from another point cloud to this one. More...
 
void remove (size_t index)
 Remove all data (from every field) associated with a specific index.
 
template<class Field >
void remove (size_t index)
 Remove the sparse data of a specific field associated with a point. More...
 
void quickRemove (size_t index)
 
void quickRemove (Indices const indices, bool sort=false)
 
Memory manipulation and reference counting

Functionality for comparing and manipulating the actual reference counted memory of the point cloud

void deepCopy ()
 Performs a deep copy of the underlying data. More...
 
bool operator== (PointCloud2 const &other) const
 Check whether this cloud is equal (same internal data) as some other.
 
bool operator!= (PointCloud2 const &other) const
 Check whether this cloud is not equal (not same internal data) as some other.
 

Static Public Member Functions

template<class... Fields>
static PointCloud2 create (size_t initialSize=0)
 Create an empty point cloud with a set of fields. More...
 

Friends

template<class... Fields>
class Iterator
 
template<class... Fields>
class ConstIterator
 
template<class... Fields>
struct subsetHelper
 Used for iterators.
 
template<class... Fields>
struct addFieldHelper
 
template<class... Fields>
struct removeFieldHelper
 
template<size_t Index>
struct insertDataHelper
 
template<class... T>
struct insertionChecker
 
template<class RetT , class... T>
struct lookupHelper
 
template<class RetT , class... T>
struct pointerHelper
 
template<class... T>
struct sparseExistHelper
 
template<class... T>
struct sparseOnlyExistHelper
 
template<class... T>
struct sparseInsertHelper
 
class cereal::access
 
template<class... T>
struct subsetHelper
 

Member Typedef Documentation

typedef POINTCLOUD2_BASE_TYPE nrt::PointCloud2::BaseType

The base type for a point cloud, determined by a CMAKE compilation flag

Definition at line 136 of file PointCloud2.H.

Constructor & Destructor Documentation

nrt::PointCloud2::PointCloud2 ( size_t  initialSize = 0)

Create an empty point cloud with no fields.

The created point cloud will have geometrical data (as all point clouds do), but no additional dense or sparse fields

Parameters
initialSizeThe initial size for the point cloud. Note that any geometry allocated here will be completely zero valued and thus not a valid homogenous point. It is best to consider the data as allocated but un-initialized.
nrt::PointCloud2::PointCloud2 ( PointCloud2 const &  other)

Create from an already existing cloud.

This will create a shallow copy of the other cloud that will only become a deep copy upon modification or an explicit call to deepCopy()

nrt::PointCloud2::PointCloud2 ( PointCloud2 &&  other)

Move from an already existing cloud.

This will move the data from another cloud into this one and cause the other cloud to become invalid. Using an invalid cloud will result in undefined behavior

Member Function Documentation

template<class... Fields>
static PointCloud2 nrt::PointCloud2::create ( size_t  initialSize = 0)
static

Create an empty point cloud with a set of fields.

This adds fields to the point cloud, giving it the capability of storing various data types. Data types must be distinct from an std::is_same basis regardless of whether they are dense or sparse.

Data types are assumed to be dense by default and can be marked as sparse by wrapping in the template class SparseField<>. Fields marked as sparse only need to be marked as sparse during insertion and can be utilized without the SparseField<> template wrapper in all other functions.

Sparse fields will only store data for indicies that have been initialized with some information. Sparse fields are slower to access and should be used when the tradeoff between space and time makes sense.

The point cloud will also, as all clouds do, contain geometrical data for each entry.

Template Parameters
FieldsA set of fields to add
Parameters
initialSizeThe initial size for the point cloud. Note that any geometry or other fields allocated here will be completely zero valued and thus likely not valid data. It is best to consider the data (including geometry) as allocated but not initialized
PointCloud2& nrt::PointCloud2::operator= ( PointCloud2 const &  other)

Assignment operator.

This will create a shallow copy of the other cloud that will only become a deep copy upon modification or an explicit call to deepCopy()

PointCloud2& nrt::PointCloud2::operator= ( PointCloud2 &&  other)

R value move assignment operator.

This will result in the other point cloud being made invalid; using an invalid point cloud will result in undefined behavior

template<class... Fields>
void nrt::PointCloud2::addField ( )
inline

Adds fields to this point cloud.

This adds a field to the point cloud, giving it the capability of storing a particular data type. Data types must be distinct from an std::is_same basis regardless of whether they are dense or sparse.

Data types are assumed to be dense by default and can be marked as sparse by wrapping in the template class SparseField<>. Fields marked as sparse only need to be marked as sparse during insertion and can be utilized without the SparseField<> template wrapper in all other functions.

Sparse fields will only store data for indicies that have been initialized with some information. Sparse fields are slower to access and should be used when the tradeoff between space and time makes sense.

Dense fields will be initialized with zero valued data which may be invalid depending on their type.

If a field already exists, calling addField with it again will do nothing.

Template Parameters
FieldsA set of fields to add
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Search.C.

Definition at line 481 of file PointCloud2Impl.H.

template<class... Fields>
void nrt::PointCloud2::removeField ( )
inline

Removes fields from the point cloud.

Removing a field will delete all data associated with it in the point cloud.

For sparse fields, there is no need to specify the type as sparse with SparseField<> as this will be automatically inferred for a sparse field. If this is specified, it will be automatically stripped.

Template Parameters
FieldsThe fields to remove
Examples:
tests/test-PointCloud2.C.

Definition at line 488 of file PointCloud2Impl.H.

template<class T >
bool nrt::PointCloud2::hasField ( ) const
inline

Checks if the point cloud contains a specific field, dense or sparse.

SparseField<> will be stripped if present and is not necessary.

Template Parameters
TThe field type to check

Definition at line 495 of file PointCloud2Impl.H.

References nrt::cloudHash().

template<class T >
bool nrt::PointCloud2::hasSparseField ( ) const
inline

Checks if the point cloud contains a specific sparse field.

SparseField<> will be stripped if present and is not necessary.

Template Parameters
TThe field type to check
Examples:
tests/test-PointCloud2.C.

Definition at line 511 of file PointCloud2Impl.H.

References nrt::cloudHash().

template<class T >
bool nrt::PointCloud2::hasSparseData ( size_t const  index) const
inline

Checks whether a specific index in the point cloud contains data of a particular sparse type.

SparseField<> will be stripped if present and is not necessary

Template Parameters
TThe field type to check
Parameters
indexThe index to check
Returns
Whether the requested index contains the type of sparse data

Definition at line 519 of file PointCloud2Impl.H.

References nrt::cloudHash().

template<class T >
Indices nrt::PointCloud2::getSparseIndices ( ) const

Assuming the requested field is sparse, retrieves all indices that contain the field.

SparseField<> will be stripped if present and is not necessary

Template Parameters
TThe field type to check
Returns
All indices that contain the sparse data.
template<class T >
size_t nrt::PointCloud2::size ( ) const

Gets the number of entries for a particular field.

SparseField<> will be stripped if present and is not necessary

Template Parameters
TThe type to check the size of
auto nrt::PointCloud2::get ( size_t  index)
inline

Returns a reference to the geometry at the specified index.

The data contained in the returned point will reference data stored in the cloud; modifying this structure will directly modify the data internal to the point cloud

Examples:
tests/test-PointCloud2.C.

Definition at line 577 of file PointCloud2Impl.H.

Referenced by main().

template<class... Fields>
PointCloud2DataRef<typename StripSparse<Fields>::type...> nrt::PointCloud2::get ( size_t  index)

Returns a reference to fields at the requested index.

If the requested fields do not exist inside of the point cloud, an exception will be thrown.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

Geometry is always included regardless of fields specified.

Template Parameters
FieldsThe fields to iterate over
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud
template<class... Fields>
PointCloud2ConstDataRef<typename StripSparse<Fields>::type...> nrt::PointCloud2::at ( size_t  index) const

Returns a constant reference to fields at the requested index.

If the requested fields do not exist inside of the point cloud, an exception will be thrown.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

Geometry is always included regardless of fields specified.

Template Parameters
FieldsThe fields to iterate over
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud
auto nrt::PointCloud2::begin ( )
inline

Get a basic iterator (includes geometry) to the beginning of the data.

Will perform a deep copy if not the sole owner of underlying data

Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Speed.C.

Definition at line 592 of file PointCloud2Impl.H.

Referenced by nrt::computeMinMax().

template<class T , class... OtherT>
Iterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::begin ( )

Get an iterator to the requested fields, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Will perform a deep copy if not the sole owner of underlying data.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if no valid sparse intersection can be found in the case when a sparse field is specified
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::begin ( ) const

Get a constant iterator to the requested fields, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if no valid sparse intersection can be found in the case when a sparse field is specified
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::const_begin ( ) const

Get a constant iterator to the requested fields, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if no valid sparse intersection can be found in the case when a sparse field is specified
auto nrt::PointCloud2::end ( )
inline

Get a basic iterator (includes geometry) to one past the end of the data.

Will perform a deep copy if not the sole owner of underlying data.

Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Speed.C.

Definition at line 621 of file PointCloud2Impl.H.

Referenced by nrt::computeMinMax().

template<class T , class... OtherT>
Iterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::end ( )

Get an iterator to the requested fields, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Will perform a deep copy if not the sole owner of underlying data.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if no valid sparse intersection can be found in the case when a sparse field is specified
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::end ( ) const

Get a constant iterator to the requested fields, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if no valid sparse intersection can be found in the case when a sparse field is specified
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::const_end ( ) const

Get a constant iterator to the requested fields, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if no valid sparse intersection can be found in the case when a sparse field is specified
auto nrt::PointCloud2::subset_begin ( Indices const  indices)
inline

Get a basic iterator (includes geometry) to the beginning of the subset.

Will perform a deep copy if not the sole owner of underlying data

Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2SubsetExceptionif an empty set of indices is passed
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Speed.C.

Definition at line 649 of file PointCloud2Impl.H.

auto nrt::PointCloud2::subset_begin ( Indices const  indices) const
inline

Get a basic iterator (includes geometry) to the beginning of the subset.

Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2SubsetExceptionif an empty set of indices is passed

Definition at line 661 of file PointCloud2Impl.H.

auto nrt::PointCloud2::subset_const_begin ( Indices const  indices) const
inline

Get a basic iterator (includes geometry) to the beginning of the subset.

Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2SubsetExceptionif an empty set of indices is passed
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Speed.C.

Definition at line 671 of file PointCloud2Impl.H.

template<class T , class... OtherT>
Iterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::subset_begin ( Indices const  indices)

Get an iterator to the requested fields in a subset, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Will perform a deep copy if not the sole owner of underlying data.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::subset_begin ( Indices const  indices) const

Get an constant iterator to the requested fields in a subset, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::subset_const_begin ( Indices const  indices) const

Get an constant iterator to the requested fields in a subset, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
auto nrt::PointCloud2::subset_end ( Indices const  indices)
inline

Get a basic iterator (includes geometry) to one past the end of the subset.

Will perform a deep copy if not the sole owner of underlying data

Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2SubsetExceptionif an empty set of indices is passed
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Speed.C.

Definition at line 677 of file PointCloud2Impl.H.

auto nrt::PointCloud2::subset_end ( Indices const  indices) const
inline

Get a basic iterator (includes geometry) to one past the end of the subset.

Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2SubsetExceptionif an empty set of indices is passed

Definition at line 689 of file PointCloud2Impl.H.

auto nrt::PointCloud2::subset_const_end ( Indices const  indices) const
inline

Get a basic iterator (includes geometry) to one past the end of the subset.

Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2SubsetExceptionif an empty set of indices is passed
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Speed.C.

Definition at line 699 of file PointCloud2Impl.H.

template<class T , class... OtherT>
Iterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::subset_end ( Indices const  indices)

Get an iterator to one past the end of the requested fields in a subset, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Will perform a deep copy if not the sole owner of underlying data.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::subset_end ( Indices const  indices) const

Get an constant iterator to one past the end of the requested fields in a subset, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> nrt::PointCloud2::subset_const_end ( Indices const  indices) const

Get an constant iterator to one past the end of the requested fields in a subset, including geometry.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Iterators with sparse fields will perform more slowly than those with dense only fields, especially during iterator creation. Iterator traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the iterator. Creation time will be longer than creating a dense iterator and scale with the size of the strictest subset and the number of fields to be iterated.

Template Parameters
TThe first field requested to be iterated over
OtherTThe other fields requested to be iterated over.
Parameters
indicesThe indices of the subset to iterate on
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
IteratorRange<geometry_iterator> nrt::PointCloud2::geometry_range ( )

Gets a range that only includes raw geometry over the entire point cloud.

Unlike regular ranges, a geometry_range will directly access geometry data and will not be wrapped in a PointCloud2DataRef<>. This means that your iteration should look something like:

for( PointCloud2::Geometry const & p : myCloud.geometry_range() )
p.x() = p.y();

Will perform a deep copy if not the owner of underlying data

Examples:
tests/test-PointCloud2.C.
auto nrt::PointCloud2::range ( )
inline

Gets a range that only includes geometry over the entire point cloud.

Ranges will return PointCloud2DataRef<> r-values which contain references to point cloud data. This means that data iterated over by a range is already by reference and can be modified directly:

for( PointCloud2DataRef<> data : myCloud.range() ) // note the lack of & on data
data.geometry().x() = 3.4f; // changes a value inside of the cloud

Will perform a deep copy if not the sole owner of underlying data.

Examples:
tests/test-PointCloud2.C.

Definition at line 705 of file PointCloud2Impl.H.

Referenced by main().

auto nrt::PointCloud2::subset_range ( Indices const  indices)
inline

Gets a range that only includes geometry over a subset of the cloud.

Will perform a deep copy if not the sole owner of underlying data.

Examples:
tests/test-PointCloud2.C.

Definition at line 723 of file PointCloud2Impl.H.

template<class T , class... OtherT>
IteratorRange<Iterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> > nrt::PointCloud2::range ( )

Gets a range over the requested fields for the entire point cloud.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Ranges with sparse fields will perform more slowly than those with dense only fields, especially during range creation. Range traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the range. Creation time will be longer than creating a dense range and scale with the size of the strictest subset and the number of fields to be ranged over.

Will perform a deep copy if not the sole owner of underlying data.

Template Parameters
TThe first field requested in the range.
OtherTThe other fields requested in the range
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
IteratorRange<ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> > nrt::PointCloud2::range ( ) const

Gets a range over the requested fields for the entire point cloud.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Ranges with sparse fields will perform more slowly than those with dense only fields, especially during range creation. Range traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the range. Creation time will be longer than creating a dense range and scale with the size of the strictest subset and the number of fields to be ranged over.

Template Parameters
TThe first field requested in the range.
OtherTThe other fields requested in the range
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
IteratorRange<ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> > nrt::PointCloud2::const_range ( ) const

Gets a range over the requested fields for the entire point cloud.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Ranges with sparse fields will perform more slowly than those with dense only fields, especially during range creation. Range traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the range. Creation time will be longer than creating a dense range and scale with the size of the strictest subset and the number of fields to be ranged over.

Template Parameters
TThe first field requested in the range.
OtherTThe other fields requested in the range
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
IteratorRange<Iterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> > nrt::PointCloud2::subset_range ( Indices const  indices)

Gets a range over the requested fields for some subset.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Ranges with sparse fields will perform more slowly than those with dense only fields, especially during range creation. Range traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the range. Creation time will be longer than creating a dense range and scale with the size of the strictest subset and the number of fields to be ranged over.

Will perform a deep copy if not the sole owner of underlying data.

Template Parameters
TThe first field requested in the range.
OtherTThe other fields requested in the range
Parameters
indicesThe indices of the subset to range over
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
IteratorRange<ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> > nrt::PointCloud2::subset_range ( Indices const  indices) const

Gets a range over the requested fields for the entire point cloud.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Ranges with sparse fields will perform more slowly than those with dense only fields, especially during range creation. Range traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the range. Creation time will be longer than creating a dense range and scale with the size of the strictest subset and the number of fields to be ranged over.

Template Parameters
TThe first field requested in the range.
OtherTThe other fields requested in the range
Parameters
indicesThe indices of the subset to range over
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
template<class T , class... OtherT>
IteratorRange<ConstIterator<typename StripSparse<T>::type, typename StripSparse<OtherT>::type...> > nrt::PointCloud2::subset_const_range ( Indices const  indices) const

Gets a range over the requested fields for the entire point cloud.

If the requested fields do not exist inside of the point cloud, an exception will be thrown. Ranges with sparse fields will perform more slowly than those with dense only fields, especially during range creation. Range traversal time should be similar in both cases.

Sparse fields do not (and should not) need to be explicitly specified as sparse using SparseField<>. This will be stripped if present.

If at least one requested field is sparse, the strictest intersection of the sparse indices will be iterated over by the range. Creation time will be longer than creating a dense range and scale with the size of the strictest subset and the number of fields to be ranged over.

Template Parameters
TThe first field requested in the range.
OtherTThe other fields requested in the range
Parameters
indicesThe indices of the subset to range over
Exceptions
PointCloud2FieldsExceptionIf at least one field does not exist in the cloud or if at least one sparse field is specified that does not have data for a provided index
void nrt::PointCloud2::resize ( size_t  size)

Resizes the point cloud.

If the new size is greater than the old size, dense data will be created to fill the new indices. The newly created dense data is not guaranteed to be valid.

If the size causes a reduction in the size of the point cloud, any dense data exceeding the new size will be removed. This will also cause any sparse data data associated with indices that no longer exist to be removed. This removal of sparse data takes time linear in the difference of cloud size and logarithmic in the number of elements in a sparse field.

Parameters
sizeThe new size for the point cloud
Examples:
tests/test-PointCloud2.C, tests/test-PointCloud2Filter.C, tests/test-PointCloud2Registration.C, tests/test-PointCloud2Search.C, and tests/test-PointCloud2Speed.C.
void nrt::PointCloud2::insert ( Geometry const &  geo)

Inserts a single geometrical point at the end of the cloud.

Any dense fields currently contained in the point cloud will be given zero valued data to correspond with the dense entry created by this insertion. Depending on the data type, this may result in invalid data for those dense fields. It is suggested to fully specify all types in the cloud, if possible, when calling the templated version of insert to prevent any invalid data from existing.

Examples:
tests/test-PointCloud2.C, tests/test-PointCloud2Common.C, tests/test-PointCloud2Filter.C, and tests/test-PointCloud2Normals.C.
template<class... Fields>
void nrt::PointCloud2::insert ( PointCloud2Data< Fields...> const &  point)
inline

Inserts a single point at the end of the cloud.

If any dense fields currently contained in the point cloud are not specified in the input data, they will be given zero valued data to correspond with the dense entry created by this insertion. Depending on the data type, this may result in invalid data. Therefor it is suggested to always fully specify dense types during an insertion if possible.

Template Parameters
FieldsThe fields to insert, which may include any fields (dense or sparse) in the point cloud. Sparse fields should not be wrapped in SparseField<>.
Exceptions
PointCloud2FieldsExceptionIf any single field listed does not exist

Definition at line 741 of file PointCloud2Impl.H.

References nrt::PointCloud2Data< Types >::geometry().

template<class... Fields>
void nrt::PointCloud2::insertSparse ( size_t const  index,
StreamableGenericBag< Fields...> const &  data 
)
inline

Adds sparse data to a point.

This function adds sparse data entries to some point that was previously only associated with dense data. The sparse fields must exist in the point cloud prior to calling this function. If the assigned index already contains the sparse data passed in, it will be overwritten.

After calling this, the data at the specified index will be associated with the provided sparse data as well as any data it was previously associated with.

Template Parameters
FieldsThe sparse fields to be inserted. Do not wrap with SparseField<>. If any field does not exist in the point cloud, an exception will be thrown.
Parameters
indexThe index to insert sparse data at. If this index does not exist in the point cloud, an exception will be thrown.
dataThe sparse data to be inserted. If the data already exists, it will be overwritten
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2Search.C.

Definition at line 765 of file PointCloud2Impl.H.

PointCloud2& nrt::PointCloud2::append ( PointCloud2 const  other)

Appends all data from another point cloud to this one.

This will add all of the data from another point cloud to the end of the data in this point cloud, increasing its size by the size of the other point cloud.

This is intended to combine two same configured point clouds together and is not meant for use with mixed types, since the behavior in that situation can be ambiguous.

If the two point clouds do not have identical configurations, an exception will be thrown.

Dense data will merely be appended to the current data. Sparse data in the other point cloud will have its index adjusted by the new starting index of data from the other point cloud. For example, if our current cloud is size 100 and we merge a size 50 cloud, a sparse field from the other cloud that was at index 2 is now at index 102.

Returns
A reference to this, which will now contain the data from the other cloud as well
Exceptions
PointCloud2FieldsExceptionIf the two clouds do not have exactly the same set of fields
Examples:
tests/test-PointCloud2.C, and tests/test-PointCloud2OpenNI.C.
template<class Field >
void nrt::PointCloud2::remove ( size_t  index)

Remove the sparse data of a specific field associated with a point.

It is not necessary to wrap the template parameter with SparseField<>. If specified, it will be stripped automatically.

Exceptions
PointCloud2FieldsExceptionIf the requested field does not exist in the cloud
void nrt::PointCloud2::quickRemove ( size_t  index)

Remove all data (from every field) associated with a specific index, not preserving ordering

This is generally a faster operation than remove() but will not preserve the ordering of points within the cloud

void nrt::PointCloud2::quickRemove ( Indices const  indices,
bool  sort = false 
)

Remove all data (from every field) associated with every index in a subset not preserving ordering

This is generally a faster operation than calling remove() or quickRemove() on several indices to remove.

Because quickRemove does not preserve ordering, the input must be sorted or the sort flag should be specified so that this function handles the sorting.

Parameters
indicesThe subset to remove
sortWhether we need to sort the input
void nrt::PointCloud2::deepCopy ( )

Performs a deep copy of the underlying data.

After calling deepcopy, a deep copy of all underlying data will occur and this PointCloud2 will have unique ownership of its data until another reference is created.

The reference count will be one after this operation and any existing references will be decremented.

Examples:
tests/test-PointCloud2.C.

The documentation for this class was generated from the following files: