RobWorkProject
Public Types | Public Member Functions | Static Public Member Functions | List of all members
PointCloud Class Reference

A simple point cloud data structure. Points may be ordered or not. An ordered set is kept as a single array in row major order and with a width and a height. An unordered array must have height==1 and width equal to the number of points. More...

#include <PointCloud.hpp>

Inherits GeometryData.

Public Types

typedef rw::common::Ptr< PointCloudPtr
 smart pointer type to this class
 
typedef rw::math::Vector3D< float > point_type
 type of point used internally in pointcloud
 
- Public Types inherited from GeometryData
enum  GeometryType {
  PointCloud, LineMesh, PlainTriMesh, IdxTriMesh,
  SpherePrim, BoxPrim, OBBPrim, AABBPrim,
  LinePrim, PointPrim, PyramidPrim, ConePrim,
  TrianglePrim, CylinderPrim, TubePrim, PlanePrim,
  RayPrim, Quadratic, UserType
}
 geometry data types
 
typedef rw::common::Ptr< GeometryDataPtr
 smart pointer type to this class
 

Public Member Functions

 PointCloud ()
 constructor
 
 PointCloud (int w, int h)
 constructor More...
 
virtual ~PointCloud ()
 destructor
 
GeometryType getType () const
 the type of this primitive More...
 
virtual size_t size () const
 gets the number of points in the point cloud.
 
bool isOrdered ()
 
std::vector< rw::math::Vector3D< float > > & getData ()
 returns a char pointer to the image data More...
 
const std::vector< rw::math::Vector3D< float > > & getData () const
 returns a char pointer to the image data More...
 
const rw::math::Vector3D< float > & operator() (int x, int y) const
 access points in point cloud. More...
 
rw::math::Vector3D< float > & operator() (int x, int y)
 access points in point cloud. More...
 
int getWidth () const
 width of the point cloud data. If the data is unordered then this will be equal to the number of points. More...
 
int getHeight () const
 
void resize (int w, int h)
 set width of point cloud. Data elements are accessed as [x+y*width]. More...
 
rw::common::Ptr< TriMeshgetTriMesh (bool forceCopy=true)
 gets a trimesh representation of this geometry data. More...
 
rw::common::Ptr< const TriMeshgetTriMesh (bool forceCopy=true) const
 gets a trimesh representation of this geometry data. More...
 
const rw::math::Transform3D< float > & getDataTransform () const
 
- Public Member Functions inherited from GeometryData
virtual ~GeometryData ()
 Destructor.
 
virtual bool isConvex ()
 test if this geometry data is convex More...
 

Static Public Member Functions

static rw::common::Ptr< PointCloudloadPCD (const std::string &filename)
 load point cloud from PCD file More...
 
static void savePCD (const PointCloud &cloud, const std::string &filename, const rw::math::Transform3D< float > &t3d=rw::math::Transform3D< float >::identity())
 save point cloud in PCD file format (PCL library format) More...
 
- Static Public Member Functions inherited from GeometryData
static std::string toString (GeometryType type)
 format GeometryType to string More...
 

Detailed Description

A simple point cloud data structure. Points may be ordered or not. An ordered set is kept as a single array in row major order and with a width and a height. An unordered array must have height==1 and width equal to the number of points.

Constructor & Destructor Documentation

◆ PointCloud()

PointCloud ( int  w,
int  h 
)
inline

constructor

Parameters
w
h

Member Function Documentation

◆ getData() [1/2]

std::vector<rw::math::Vector3D<float> >& getData ( )
inline

returns a char pointer to the image data

Returns
char pointer to the image data

◆ getData() [2/2]

const std::vector<rw::math::Vector3D<float> >& getData ( ) const
inline

returns a char pointer to the image data

Returns
const char pointer to the image data

◆ getHeight()

int getHeight ( ) const
inline
Returns

◆ getTriMesh() [1/2]

rw::common::Ptr<TriMesh> getTriMesh ( bool  forceCopy = true)
virtual

gets a trimesh representation of this geometry data.

The trimesh that is returned is by default a copy, which means ownership is transfered to the caller. Specifying forceCopy to false will enable copy by reference and ownership is not necesarilly transfered. This is more efficient, though pointer is only alive as long as this GeometryData is alive.

Returns
TriMesh representation of this GeometryData

Implements GeometryData.

◆ getTriMesh() [2/2]

rw::common::Ptr<const TriMesh> getTriMesh ( bool  forceCopy = true) const

gets a trimesh representation of this geometry data.

The trimesh that is returned is by default a copy, which means ownership is transfered to the caller. Specifying forceCopy to false will enable copy by reference and ownership is not necesarilly transfered. This is more efficient, though pointer is only alive as long as this GeometryData is alive.

Returns
TriMesh representation of this GeometryData

◆ getType()

GeometryType getType ( ) const
inlinevirtual

the type of this primitive

Implements GeometryData.

◆ getWidth()

int getWidth ( ) const
inline

width of the point cloud data. If the data is unordered then this will be equal to the number of points.

Returns
width of data points

◆ loadPCD()

static rw::common::Ptr<PointCloud> loadPCD ( const std::string &  filename)
static

load point cloud from PCD file

Parameters
filename[in] name of PCD file
Returns
a point cloud

◆ operator()() [1/2]

const rw::math::Vector3D<float>& operator() ( int  x,
int  y 
) const
inline

access points in point cloud.

Parameters
x[in] x coordinate, must be in [0;width[
y[in] y coordinate, must be in [0;height[
Returns
point

◆ operator()() [2/2]

rw::math::Vector3D<float>& operator() ( int  x,
int  y 
)
inline

access points in point cloud.

Parameters
x[in] x coordinate, must be in [0;width[
y[in] y coordinate, must be in [0;height[
Returns
point

◆ resize()

void resize ( int  w,
int  h 
)
inline

set width of point cloud. Data elements are accessed as [x+y*width].

If the current data array cannot contain the elements then it will be resized to be able to it.

Parameters
w[in] new width
h[in] new height

◆ savePCD()

static void savePCD ( const PointCloud cloud,
const std::string &  filename,
const rw::math::Transform3D< float > &  t3d = rw::math::Transform3D< float >::identity() 
)
static

save point cloud in PCD file format (PCL library format)

Parameters
cloud[in] the point cloud to save
filename[in] the name of the file to save to
t3d[in] the transformation of the point cloud

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