YARP
Yet Another Robot Platform
yarp::sig::PointCloud< T > Class Template Reference

The PointCloud class. More...

#include <yarp/sig/PointCloud.h>

+ Inheritance diagram for yarp::sig::PointCloud< T >:

Detailed Description

template<class T>
class yarp::sig::PointCloud< T >

The PointCloud class.

Definition at line 25 of file PointCloud.h.

Public Member Functions

 PointCloud ()
 PointCloud, default constructor. More...
 
template<class T1 >
 PointCloud (const PointCloud< T1 > &alt)
 PointCloud, copy constructor. More...
 
virtual void resize (size_t width, size_t height)
 Resize the PointCloud. More...
 
virtual void resize (size_t width)
 Resize the PointCloud. More...
 
virtual const char * getRawData () const override
 Get the pointer to the data. More...
 
virtual size_t wireSizeBytes () const override
 Get the size of the data + the header in terms of number of bytes. More...
 
virtual size_t dataSizeBytes () const override
 Get the size of the data in terms of number of bytes. More...
 
virtual size_t size () const override
 
T & operator() (size_t u, size_t v)
 Obtain the point given by the (column, row) coordinates. More...
 
const T & operator() (size_t u, size_t v) const
 Obtain the point given by the (column, row) coordinates (const version). More...
 
T & operator() (size_t i)
 Obtain the point given by the index. More...
 
const T & operator() (size_t i) const
 Obtain the point given by the index (const version). More...
 
template<class T1 >
const PointCloud< T > & operator= (const PointCloud< T1 > &alt)
 Assignment operator. More...
 
PointCloud< T > & operator+= (const PointCloud< T > &rhs)
 Concatenate a point cloud to the current cloud. More...
 
const PointCloud< T > operator+ (const PointCloud< T > &rhs)
 Concatenate a point cloud to another cloud. More...
 
void push_back (const T &pt)
 Insert a new point in the cloud, at the end of the container. More...
 
virtual void clear ()
 Clear the data. More...
 
virtual void fromExternalPC (const char *source, int type, size_t width, size_t height, bool isDense=true)
 Copy the content of an external PointCloud. More...
 
template<class T1 >
void copy (const PointCloud< T1 > &alt)
 Copy operator. More...
 
virtual bool read (yarp::os::ConnectionReader &connection) override
 Read this object from a network connection. More...
 
virtual bool write (yarp::os::ConnectionWriter &writer) const override
 Write this object to a network connection. More...
 
virtual std::string toString (int precision=-1, int width=-1) const
 
yarp::os::Bottle toBottle () const
 Generate a yarp::os::Bottle filled with the PointCloud data. More...
 
bool fromBottle (const yarp::os::Bottle &bt)
 Populate the PointCloud from a yarp::os::Bottle. More...
 
virtual int getBottleTag () const override
 
- Public Member Functions inherited from yarp::sig::PointCloudBase
virtual ~PointCloudBase ()=default
 
virtual size_t height () const
 
virtual size_t width () const
 
virtual int getPointType () const
 
virtual yarp::os::Type getType () const override
 
virtual bool isOrganized () const
 
virtual bool isDense () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual void onCompletion () const
 This is called when the port has finished all writing operations. More...
 
virtual void onCommencement () const
 This is called when the port is about to begin writing operations. More...
 
virtual yarp::os::Type getWriteType () const
 

Private Member Functions

void setPointType ()
 

Private Attributes

yarp::sig::VectorOf< T > data
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (PortWriter &writer, PortReader &reader)
 Copy one portable to another, via writing and reading. More...
 
- Protected Member Functions inherited from yarp::sig::PointCloudBase
 PointCloudBase ()=default
 
virtual void copyFromRawData (const char *dst, const char *source, std::vector< int > &recipe)
 
virtual std::vector< int > getComposition (int type_composite) const
 
virtual size_t pointType2Size (int type) const
 
virtual size_t getOffset (int type_composite, int type_basic) const
 
- Protected Attributes inherited from yarp::sig::PointCloudBase
yarp::sig::PointCloudNetworkHeader header
 

Constructor & Destructor Documentation

◆ PointCloud() [1/2]

template<class T>
yarp::sig::PointCloud< T >::PointCloud ( )
inline

PointCloud, default constructor.

Definition at line 40 of file PointCloud.h.

◆ PointCloud() [2/2]

template<class T>
template<class T1 >
yarp::sig::PointCloud< T >::PointCloud ( const PointCloud< T1 > &  alt)
inline

PointCloud, copy constructor.

Clones the content of another point cloud.

Parameters
altthe point cloud to clone.

Definition at line 52 of file PointCloud.h.

Member Function Documentation

◆ clear()

template<class T>
virtual void yarp::sig::PointCloud< T >::clear ( )
inlinevirtual

Clear the data.

Definition at line 222 of file PointCloud.h.

◆ copy()

template<class T>
template<class T1 >
void yarp::sig::PointCloud< T >::copy ( const PointCloud< T1 > &  alt)
inline

Copy operator.

clones the content of another point cloud

Parameters
altthe point cloud to clone

Definition at line 257 of file PointCloud.h.

◆ dataSizeBytes()

template<class T>
virtual size_t yarp::sig::PointCloud< T >::dataSizeBytes ( ) const
inlineoverridevirtual

Get the size of the data in terms of number of bytes.

Returns
the size of the data

Implements yarp::sig::PointCloudBase.

Definition at line 104 of file PointCloud.h.

◆ fromBottle()

template<class T>
bool yarp::sig::PointCloud< T >::fromBottle ( const yarp::os::Bottle bt)
inline

Populate the PointCloud from a yarp::os::Bottle.

Parameters
[in]bt,theyarp::os::Bottle to read from. It has to be formatted in the same way it is generated by the toBottle() method.
Returns
true for success, false otherwise

Definition at line 370 of file PointCloud.h.

◆ fromExternalPC()

template<class T>
virtual void yarp::sig::PointCloud< T >::fromExternalPC ( const char *  source,
int  type,
size_t  width,
size_t  height,
bool  isDense = true 
)
inlinevirtual

Copy the content of an external PointCloud.

Parameters
source,pointerto the source data.
type,enumrepresenting the type of the source cloud.
width,widthof the source cloud.
height,heightof the source cloud.
isDense

Definition at line 237 of file PointCloud.h.

◆ getBottleTag()

template<class T>
virtual int yarp::sig::PointCloud< T >::getBottleTag ( ) const
inlineoverridevirtual

Implements yarp::sig::PointCloudBase.

Definition at line 394 of file PointCloud.h.

◆ getRawData()

template<class T>
virtual const char* yarp::sig::PointCloud< T >::getRawData ( ) const
inlineoverridevirtual

Get the pointer to the data.

Returns
the pointer to the data.

Implements yarp::sig::PointCloudBase.

Definition at line 84 of file PointCloud.h.

◆ operator()() [1/4]

template<class T>
T& yarp::sig::PointCloud< T >::operator() ( size_t  u,
size_t  v 
)
inline

Obtain the point given by the (column, row) coordinates.

Only works on organized clouds (those that have height != 1).

Parameters
u,columncoordinate
v,rowcoordinate

Definition at line 120 of file PointCloud.h.

◆ operator()() [2/4]

template<class T>
const T& yarp::sig::PointCloud< T >::operator() ( size_t  u,
size_t  v 
) const
inline

Obtain the point given by the (column, row) coordinates (const version).

Only works on organized clouds (those that have height != 1).

Parameters
u,columncoordinate
v,rowcoordinate

Definition at line 132 of file PointCloud.h.

◆ operator()() [3/4]

template<class T>
T& yarp::sig::PointCloud< T >::operator() ( size_t  i)
inline

Obtain the point given by the index.

Parameters
i,index

Definition at line 142 of file PointCloud.h.

◆ operator()() [4/4]

template<class T>
const T& yarp::sig::PointCloud< T >::operator() ( size_t  i) const
inline

Obtain the point given by the index (const version).

Parameters
i,index

Definition at line 151 of file PointCloud.h.

◆ operator+()

template<class T>
const PointCloud<T> yarp::sig::PointCloud< T >::operator+ ( const PointCloud< T > &  rhs)
inline

Concatenate a point cloud to another cloud.

Parameters
rhsthe cloud to add to the current cloud
Returns
the new cloud as a concatenation of the current cloud and the new given cloud

Definition at line 202 of file PointCloud.h.

◆ operator+=()

template<class T>
PointCloud<T>& yarp::sig::PointCloud< T >::operator+= ( const PointCloud< T > &  rhs)
inline

Concatenate a point cloud to the current cloud.

Parameters
rhsthe cloud to add to the current cloud
Returns
the new cloud as a concatenation of the current cloud and the new given cloud

Definition at line 175 of file PointCloud.h.

◆ operator=()

template<class T>
template<class T1 >
const PointCloud<T>& yarp::sig::PointCloud< T >::operator= ( const PointCloud< T1 > &  alt)
inline

Assignment operator.

Clones the content of another image.

Parameters
altthe image to clone

Definition at line 162 of file PointCloud.h.

◆ push_back()

template<class T>
void yarp::sig::PointCloud< T >::push_back ( const T &  pt)
inline

Insert a new point in the cloud, at the end of the container.

Note
This breaks the organized structure of the cloud by setting the height to 1.
Parameters
[in]ptthe point to insert.

Definition at line 212 of file PointCloud.h.

◆ read()

template<class T>
virtual bool yarp::sig::PointCloud< T >::read ( yarp::os::ConnectionReader reader)
inlineoverridevirtual

Read this object from a network connection.

Override this for your particular class.

Parameters
readeran interface to the network connection for reading
Returns
true iff the object is successfully read

Implements yarp::sig::PointCloudBase.

Definition at line 269 of file PointCloud.h.

◆ resize() [1/2]

template<class T>
virtual void yarp::sig::PointCloud< T >::resize ( size_t  width,
size_t  height 
)
inlinevirtual

Resize the PointCloud.

Parameters
width.
height.

Definition at line 63 of file PointCloud.h.

◆ resize() [2/2]

template<class T>
virtual void yarp::sig::PointCloud< T >::resize ( size_t  width)
inlinevirtual

Resize the PointCloud.

Note
This function resizes the point cloud and has the side effect of reducing the height to 1. Thus, by definition, the point cloud becomes unorganized.
Parameters
width.

Definition at line 77 of file PointCloud.h.

◆ setPointType()

template<class T>
void yarp::sig::PointCloud< T >::setPointType ( )
inlineprivate

Definition at line 402 of file PointCloud.h.

◆ size()

template<class T>
virtual size_t yarp::sig::PointCloud< T >::size ( ) const
inlineoverridevirtual
Returns
the number of points of the PointCloud

Implements yarp::sig::PointCloudBase.

Definition at line 109 of file PointCloud.h.

◆ toBottle()

template<class T>
yarp::os::Bottle yarp::sig::PointCloud< T >::toBottle ( ) const
inline

Generate a yarp::os::Bottle filled with the PointCloud data.

Returns
the yarp::os::Bottle generated

Definition at line 349 of file PointCloud.h.

◆ toString()

template<class T>
virtual std::string yarp::sig::PointCloud< T >::toString ( int  precision = -1,
int  width = -1 
) const
inlinevirtual

Definition at line 323 of file PointCloud.h.

◆ wireSizeBytes()

template<class T>
virtual size_t yarp::sig::PointCloud< T >::wireSizeBytes ( ) const
inlineoverridevirtual

Get the size of the data + the header in terms of number of bytes.

Returns
the size of the data sent through the network

Implements yarp::sig::PointCloudBase.

Definition at line 94 of file PointCloud.h.

◆ write()

template<class T>
virtual bool yarp::sig::PointCloud< T >::write ( yarp::os::ConnectionWriter writer) const
inlineoverridevirtual

Write this object to a network connection.

Override this for your particular class. Be aware that depending on the nature of the connections a port has, and what protocol they use, and how efficient the YARP implementation is, this method may be called once, twice, or many times, as the result of a single call to Port::write

Parameters
writeran interface to the network connection for writing
Returns
true iff the object is successfully written

Implements yarp::sig::PointCloudBase.

Definition at line 317 of file PointCloud.h.

Member Data Documentation

◆ data

template<class T>
yarp::sig::VectorOf<T> yarp::sig::PointCloud< T >::data
private

Definition at line 400 of file PointCloud.h.


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