6#ifndef YARP_SIG_POINTCLOUD_H
7#define YARP_SIG_POINTCLOUD_H
22 static_assert(std::is_same<T, DataXY>::value ||
23 std::is_same<T, DataXYZ>::value ||
24 std::is_same<T, DataNormal>::value ||
25 std::is_same<T, DataXYZRGBA>::value ||
26 std::is_same<T, DataXYZI>::value ||
27 std::is_same<T, DataInterestPointXYZ>::value ||
28 std::is_same<T, DataXYZNormal>::value ||
29 std::is_same<T, DataXYZNormalRGBA>::value,
"yarp::sig::PointCloud<T>: T chosen is not supported");
33 static bool compZ(
const T& a,
const T& b);
63 virtual void resize(
size_t width,
size_t height);
72 virtual void resize(
size_t width);
76 return m_storage.getMemoryBlock();
86 return sizeof(header) + dataSizeBytes();
96 return header.width * header.height * (
sizeof(T));
99 size_t size()
const override
101 return m_storage.size();
112 return m_storage[u + v * width()];
123 return m_storage[u + v * width()];
175 void push_back(
const T& pt);
180 virtual void clear();
190 virtual void fromExternalPC(
const char* source,
int type,
size_t width,
size_t height,
bool isDense =
true);
201 if (std::is_same<T, T1>::value) {
203 memcpy(
const_cast<char*
>(getRawData()), alt.
getRawData(), dataSizeBytes());
205 std::vector<int> recipe = getComposition(alt.
getPointType());
206 copyFromRawData(getRawData(), alt.
getRawData(), recipe);
214 virtual std::string
toString(
int precision = -1,
int width = -1)
const;
230 int getBottleTag()
const override;
244 bool filterDataZ(
double minZ=0,
double maxZ=std::numeric_limits<double>::infinity());
262template <
typename T,
typename =
void>
265struct has_member_z<T,
std::void_t<decltype(std::declval<T>().z)>> : std::true_type {};
#define BOTTLE_TAG_FLOAT64
std::string toString(const T &value)
convert an arbitrary type to string.
int BottleTagMap< yarp::sig::DataXYZ >()
int BottleTagMap< yarp::sig::DataXYZRGBA >()
int BottleTagMap< yarp::sig::DataXYZNormalRGBA >()
int BottleTagMap< yarp::sig::DataXYZNormal >()
int BottleTagMap< yarp::sig::DataNormal >()
int BottleTagMap< yarp::sig::DataXYZI >()
int BottleTagMap< yarp::sig::DataXY >()
int BottleTagMap< yarp::sig::DataInterestPointXYZ >()
contains the definition of a Vector type
A simple collection of objects that can be described and transmitted in a portable way.
An interface for reading from a network connection.
An interface for writing to a network connection.
The PointCloudBase class.
virtual size_t width() const
virtual int getPointType() const
virtual size_t height() const
const char * getRawData() const override
Get the pointer to the data.
const PointCloud< T > & operator=(const PointCloud< T1 > &alt)
Assignment operator.
const T & operator()(size_t i) const
Obtain the point given by the index (const version).
T & operator()(size_t u, size_t v)
Obtain the point given by the (column, row) coordinates.
T & operator()(size_t i)
Obtain the point given by the index.
PointCloud()
PointCloud, default constructor.
const T & operator()(size_t u, size_t v) const
Obtain the point given by the (column, row) coordinates (const version).
PointCloud(const PointCloud< T1 > &alt)
PointCloud, copy constructor.
size_t dataSizeBytes() const override
Get the size of the data in terms of number of bytes.
void copy(const PointCloud< T1 > &alt)
Copy operator.
size_t wireSizeBytes() const override
Get the size of the data + the header in terms of number of bytes.
size_t size() const override
Vector operator+(const Vector &a, const double &s)
Mathematical operations.
Vector & operator+=(Vector &a, const double &s)
Addition operator between a scalar and a vector (defined in Math.h).