Skip to content

Commit

Permalink
Merge pull request #962 from mschoeler/New_Point_Type
Browse files Browse the repository at this point in the history
Added Pointtype PointXYZLNormal to common
  • Loading branch information
taketwo committed Oct 16, 2014
2 parents 415de31 + 78f4a6b commit 9ec37a5
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
52 changes: 51 additions & 1 deletion common/include/pcl/impl/point_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointWithRange) \
(pcl::PointWithViewpoint) \
(pcl::MomentInvariants) \
Expand Down Expand Up @@ -112,6 +113,7 @@
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointWithRange) \
(pcl::PointWithViewpoint) \
(pcl::PointWithScale) \
Expand All @@ -120,14 +122,16 @@
// Define all point types with XYZ and label
#define PCL_XYZL_POINT_TYPES \
(pcl::PointXYZL) \
(pcl::PointXYZRGBL)
(pcl::PointXYZRGBL) \
(pcl::PointXYZLNormal)

// Define all point types that include normal[3] data
#define PCL_NORMAL_POINT_TYPES \
(pcl::Normal) \
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointSurfel)

// Define all point types that represent features
Expand Down Expand Up @@ -972,11 +976,57 @@ namespace pcl
data[3] = 1.0f;
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
intensity = 0.0f;
curvature = 0;
}

friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
};

//----
struct EIGEN_ALIGN16 _PointXYZLNormal
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
union
{
struct
{
uint32_t label;
float curvature;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
/** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
* \ingroup common
*/
struct PointXYZLNormal : public _PointXYZLNormal
{
inline PointXYZLNormal (const _PointXYZLNormal &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
curvature = p.curvature;
label = p.label;
}

inline PointXYZLNormal ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
label = 0;
curvature = 0;
}

friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
};

// ---


struct EIGEN_ALIGN16 _PointWithRange
{
Expand Down
15 changes: 15 additions & 0 deletions common/include/pcl/point_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ namespace pcl
*/
struct PointXYZINormal;

/** \brief Members: float x, y, z, label, normal[3], curvature
* \ingroup common
*/
struct PointXYZLNormal;

/** \brief Members: float x, y, z (union with float point[4]), range
* \ingroup common
*/
Expand Down Expand Up @@ -480,6 +485,16 @@ POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
(float, normal_z, normal_z)
(float, curvature, curvature)
)
POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZLNormal,
(float, x, x)
(float, y, y)
(float, z, z)
(uint32_t, label, label)
(float, normal_x, normal_x)
(float, normal_y, normal_y)
(float, normal_z, normal_z)
(float, curvature, curvature)
)
POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
(float, x, x)
(float, y, y)
Expand Down
7 changes: 7 additions & 0 deletions common/src/point_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ namespace pcl
return (os);
}

std::ostream&
operator << (std::ostream& os, const PointXYZLNormal& p)
{
os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.label << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
return (os);
}

std::ostream&
operator << (std::ostream& os, const PointWithRange& p)
{
Expand Down

0 comments on commit 9ec37a5

Please sign in to comment.