point_types.hpp
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2010, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * $Id: point_types.hpp 6126 2012-07-03 20:19:58Z aichim $
00035  *
00036  */
00037 
00038 #ifndef PCL_IMPL_POINT_TYPES_HPP_
00039 #define PCL_IMPL_POINT_TYPES_HPP_
00040 
00041 // Define all PCL point types
00042 #define PCL_POINT_TYPES         \
00043   (pcl::PointXYZ)               \
00044   (pcl::PointXYZI)              \
00045   (pcl::PointXYZL)              \
00046   (pcl::Label)                  \
00047   (pcl::PointXYZRGBA)           \
00048   (pcl::PointXYZRGB)            \
00049   (pcl::PointXYZRGBL)           \
00050   (pcl::PointXYZHSV)            \
00051   (pcl::PointXY)                \
00052   (pcl::InterestPoint)          \
00053   (pcl::Axis)                   \
00054   (pcl::Normal)                 \
00055   (pcl::PointNormal)            \
00056   (pcl::PointXYZRGBNormal)      \
00057   (pcl::PointXYZINormal)        \
00058   (pcl::PointWithRange)         \
00059   (pcl::PointWithViewpoint)     \
00060   (pcl::MomentInvariants)       \
00061   (pcl::PrincipalRadiiRSD)      \
00062   (pcl::Boundary)               \
00063   (pcl::PrincipalCurvatures)    \
00064   (pcl::PFHSignature125)        \
00065   (pcl::PFHRGBSignature250)     \
00066   (pcl::PPFSignature)           \
00067   (pcl::PPFRGBSignature)        \
00068   (pcl::NormalBasedSignature12) \
00069   (pcl::FPFHSignature33)        \
00070   (pcl::VFHSignature308)        \
00071   (pcl::ESFSignature640)        \
00072   (pcl::Narf36)                 \
00073   (pcl::IntensityGradient)      \
00074   (pcl::PointWithScale)         \
00075   (pcl::ReferenceFrame)
00076 
00077 // Define all point types that include XYZ data
00078 #define PCL_XYZ_POINT_TYPES   \
00079   (pcl::PointXYZ)             \
00080   (pcl::PointXYZI)            \
00081   (pcl::PointXYZL)            \
00082   (pcl::PointXYZRGBA)         \
00083   (pcl::PointXYZRGB)          \
00084   (pcl::PointXYZRGBL)         \
00085   (pcl::PointXYZHSV)          \
00086   (pcl::InterestPoint)        \
00087   (pcl::PointNormal)          \
00088   (pcl::PointXYZRGBNormal)    \
00089   (pcl::PointXYZINormal)      \
00090   (pcl::PointWithRange)       \
00091   (pcl::PointWithViewpoint)   \
00092   (pcl::PointWithScale)
00093 
00094 // Define all point types with XYZ and label
00095 #define PCL_XYZL_POINT_TYPES  \
00096   (pcl::PointXYZL)            \
00097   (pcl::PointXYZRGBL)
00098 
00099 
00100 // Define all point types that include normal[3] data
00101 #define PCL_NORMAL_POINT_TYPES  \
00102   (pcl::Normal)                 \
00103   (pcl::PointNormal)            \
00104   (pcl::PointXYZRGBNormal)      \
00105   (pcl::PointXYZINormal)
00106 
00107 // Define all point types that represent features
00108 #define PCL_FEATURE_POINT_TYPES \
00109   (pcl::PFHSignature125)        \
00110   (pcl::PFHRGBSignature250)     \
00111   (pcl::PPFSignature)           \
00112   (pcl::PPFRGBSignature)        \
00113   (pcl::NormalBasedSignature12) \
00114   (pcl::FPFHSignature33)        \
00115   (pcl::VFHSignature308)        \
00116   (pcl::ESFSignature640)        \
00117   (pcl::Narf36)
00118 
00119 namespace pcl
00120 {
00121 
00122 #define PCL_ADD_POINT4D \
00123   EIGEN_ALIGN16 \
00124   union { \
00125     float data[4]; \
00126     struct { \
00127       float x; \
00128       float y; \
00129       float z; \
00130     }; \
00131   }; \
00132   inline Eigen::Map<Eigen::Vector3f> getVector3fMap () { return (Eigen::Vector3f::Map (data)); } \
00133   inline const Eigen::Map<const Eigen::Vector3f> getVector3fMap () const { return (Eigen::Vector3f::Map (data)); } \
00134   inline Eigen::Map<Eigen::Vector4f, Eigen::Aligned> getVector4fMap () { return (Eigen::Vector4f::MapAligned (data)); } \
00135   inline const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> getVector4fMap () const { return (Eigen::Vector4f::MapAligned (data)); } \
00136   inline Eigen::Map<Eigen::Array3f> getArray3fMap () { return (Eigen::Array3f::Map (data)); } \
00137   inline const Eigen::Map<const Eigen::Array3f> getArray3fMap () const { return (Eigen::Array3f::Map (data)); } \
00138   inline Eigen::Map<Eigen::Array4f, Eigen::Aligned> getArray4fMap () { return (Eigen::Array4f::MapAligned (data)); } \
00139   inline const Eigen::Map<const Eigen::Array4f, Eigen::Aligned> getArray4fMap () const { return (Eigen::Array4f::MapAligned (data)); }
00140 
00141 #define PCL_ADD_NORMAL4D \
00142   EIGEN_ALIGN16 \
00143   union { \
00144     float data_n[4]; \
00145     float normal[3]; \
00146     struct { \
00147       float normal_x; \
00148       float normal_y; \
00149       float normal_z; \
00150     }; \
00151   }; \
00152   inline Eigen::Map<Eigen::Vector3f> getNormalVector3fMap () { return (Eigen::Vector3f::Map (data_n)); } \
00153   inline const Eigen::Map<const Eigen::Vector3f> getNormalVector3fMap () const { return (Eigen::Vector3f::Map (data_n)); } \
00154   inline Eigen::Map<Eigen::Vector4f, Eigen::Aligned> getNormalVector4fMap () { return (Eigen::Vector4f::MapAligned (data_n)); } \
00155   inline const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> getNormalVector4fMap () const { return (Eigen::Vector4f::MapAligned (data_n)); }
00156 
00157 #define PCL_ADD_RGB \
00158   union \
00159   { \
00160     union \
00161     { \
00162       struct \
00163       { \
00164         uint8_t b; \
00165         uint8_t g; \
00166         uint8_t r; \
00167         uint8_t a; \
00168       }; \
00169       float rgb; \
00170     }; \
00171     uint32_t rgba; \
00172   };
00173 
00174   typedef Eigen::Map<Eigen::Array3f> Array3fMap;
00175   typedef const Eigen::Map<const Eigen::Array3f> Array3fMapConst;
00176   typedef Eigen::Map<Eigen::Array4f, Eigen::Aligned> Array4fMap;
00177   typedef const Eigen::Map<const Eigen::Array4f, Eigen::Aligned> Array4fMapConst;
00178   typedef Eigen::Map<Eigen::Vector3f> Vector3fMap;
00179   typedef const Eigen::Map<const Eigen::Vector3f> Vector3fMapConst;
00180   typedef Eigen::Map<Eigen::Vector4f, Eigen::Aligned> Vector4fMap;
00181   typedef const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> Vector4fMapConst;
00182 
00183 
00184 
00185   struct _PointXYZ
00186   {
00187     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00188 
00189     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00190   };
00191 
00195   struct EIGEN_ALIGN16 PointXYZ : public _PointXYZ
00196   {
00197     inline PointXYZ ()
00198     {
00199       x = y = z = 0.0f;
00200       data[3] = 1.0f;
00201     }
00202 
00203     inline PointXYZ (float _x, float _y, float _z)
00204     {
00205       x = _x; y = _y; z = _z;
00206       data[3] = 1.0f;
00207     }
00208 
00209     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00210   };
00211 
00212   inline std::ostream& operator << (std::ostream& os, const PointXYZ& p)
00213   {
00214     os << "(" << p.x << "," << p.y << "," << p.z << ")";
00215     return (os);
00216   }
00217 
00218 
00238   struct RGB
00239   {
00240     PCL_ADD_RGB;
00241   };
00242 
00243 
00247   struct EIGEN_ALIGN16 _PointXYZI
00248   {
00249     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00250     union
00251     {
00252       struct
00253       {
00254         float intensity;
00255       };
00256       float data_c[4];
00257     };
00258     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00259   };
00260 
00261   struct PointXYZI : public _PointXYZI
00262   {
00263     inline PointXYZI ()
00264     {
00265       x = y = z = 0.0f;
00266       data[3] = 1.0f;
00267       intensity = 0.0f;
00268     }
00269     inline PointXYZI (float _intensity)
00270     {
00271       x = y = z = 0.0f;
00272       data[3] = 1.0f;
00273       intensity = _intensity;
00274     }
00275   };
00276 
00277   inline std::ostream& operator << (std::ostream& os, const PointXYZI& p)
00278   {
00279     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.intensity << ")";
00280     return (os);
00281   }
00282 
00283 
00284   struct EIGEN_ALIGN16 _PointXYZL
00285   {
00286     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00287     uint32_t label;
00288     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00289   };
00290 
00291   struct PointXYZL : public _PointXYZL
00292   {
00293     inline PointXYZL ()
00294     {
00295       x = y = z = 0.0f;
00296       data[3] = 1.0f;
00297       label = 0;
00298     }
00299   };
00300 
00301   inline std::ostream& operator << (std::ostream& os, const PointXYZL& p)
00302   {
00303     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.label << ")";
00304     return (os);
00305   }
00306 
00307   struct Label
00308   {
00309     uint32_t label;
00310   };
00311 
00312   inline std::ostream& operator << (std::ostream& os, const Label& p)
00313   {
00314     os << "(" << p.label << ")";
00315     return (os);
00316   }
00317 
00318 
00339   struct EIGEN_ALIGN16 _PointXYZRGBA
00340   {
00341     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00342     PCL_ADD_RGB;
00343     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00344   };
00345 
00346   struct EIGEN_ALIGN16 PointXYZRGBA : public _PointXYZRGBA
00347   {
00348     inline PointXYZRGBA ()
00349     {
00350       x = y = z = 0.0f;
00351       data[3] = 1.0f;
00352       r = g = b = a = 0;
00353     }
00354     inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); }
00355     inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); }
00356     inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, 0)); }
00357     inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, 0)); }
00358   };
00359 
00360   inline std::ostream&
00361   operator << (std::ostream& os, const PointXYZRGBA& p)
00362   {
00363     const unsigned char* rgba_ptr = reinterpret_cast<const unsigned char*>(&p.rgba);
00364     os << "(" << p.x << "," << p.y << "," << p.z << " - "
00365       << static_cast<int>(*rgba_ptr) << ","
00366       << static_cast<int>(*(rgba_ptr+1)) << ","
00367       << static_cast<int>(*(rgba_ptr+2)) << ","
00368       << static_cast<int>(*(rgba_ptr+3)) << ")";
00369     return (os);
00370   }
00371 
00372 
00373   struct EIGEN_ALIGN16 _PointXYZRGB
00374   {
00375     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00376     PCL_ADD_RGB;
00377     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00378   };
00379 
00380   struct EIGEN_ALIGN16 _PointXYZRGBL
00381   {
00382     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00383     PCL_ADD_RGB;
00384     uint32_t label;
00385     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00386   };
00387 
00419   struct EIGEN_ALIGN16 PointXYZRGB : public _PointXYZRGB
00420   {
00421     inline PointXYZRGB ()
00422     {
00423       x = y = z = 0.0f;
00424       data[3] = 1.0f;
00425       r = g = b = a = 0;
00426     }
00427     inline PointXYZRGB (uint8_t _r, uint8_t _g, uint8_t _b)
00428     {
00429       x = y = z = 0.0f;
00430       data[3] = 1.0f;
00431       r = _r;
00432       g = _g;
00433       b = _b;
00434       a = 0;
00435     }
00436 
00437     inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); }
00438     inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); }
00439     inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, 0)); }
00440     inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, 0)); }
00441 
00442     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00443   };
00444   inline std::ostream& operator << (std::ostream& os, const PointXYZRGB& p)
00445   {
00446     os << "(" << p.x << "," << p.y << "," << p.z << " - "
00447       << static_cast<int>(p.r) << ","
00448       << static_cast<int>(p.g) << ","
00449       << static_cast<int>(p.b) << ")";
00450     return (os);
00451   }
00452 
00453   struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
00454   {
00455     inline PointXYZRGBL ()
00456     {
00457       x = y = z = 0.0f;
00458       data[3] = 1.0f;
00459       r = g = b = 0;
00460       label = 255;
00461     }
00462     inline PointXYZRGBL (uint8_t _r, uint8_t _g, uint8_t _b, uint32_t _label)
00463     {
00464       x = y = z = 0.0f;
00465       data[3] = 1.0f;
00466       r = _r;
00467       g = _g;
00468       b = _b;
00469       label = _label;
00470     }
00471     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00472   };
00473   inline std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p)
00474   {
00475     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.r << "," << p.g << "," << p.b << " - " << p.label << ")";
00476     return (os);
00477   }
00478 
00479   struct _PointXYZHSV
00480   {
00481     PCL_ADD_POINT4D;    // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00482     union
00483     {
00484       struct
00485       {
00486         float h;
00487         float s;
00488         float v;
00489       };
00490       float data_c[4];
00491     };
00492     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00493   } EIGEN_ALIGN16;
00494 
00495   struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
00496   {
00497     inline PointXYZHSV ()
00498     {
00499       x = y = z = 0.0f;
00500       data[3] = 1.0f;
00501       h = s = v = data_c[3] = 0;
00502     }
00503     inline PointXYZHSV (float _h, float _v, float _s)
00504     {
00505       x = y = z = 0.0f;
00506       data[3] = 1.0f;
00507       h = _h; v = _v; s = _s;
00508       data_c[3] = 0;
00509     }
00510     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00511   };
00512   inline std::ostream& operator << (std::ostream& os, const PointXYZHSV& p)
00513   {
00514     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.h << " , " <<  p.s << " , " << p.v << ")";
00515     return (os);
00516   }
00517 
00518 
00522   struct PointXY
00523   {
00524     float x;
00525     float y;
00526   };
00527   inline std::ostream& operator << (std::ostream& os, const PointXY& p)
00528   {
00529     os << "(" << p.x << "," << p.y << ")";
00530     return (os);
00531   }
00532 
00536   struct EIGEN_ALIGN16 InterestPoint
00537   {
00538     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00539     union
00540     {
00541       struct
00542       {
00543         float strength;
00544       };
00545       float data_c[4];
00546     };
00547     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00548   };
00549   inline std::ostream& operator << (std::ostream& os, const InterestPoint& p)
00550   {
00551     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.strength << ")";
00552     return (os);
00553   }
00554 
00558   struct EIGEN_ALIGN16 _Normal
00559   {
00560     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
00561     union
00562     {
00563       struct
00564       {
00565         float curvature;
00566       };
00567       float data_c[4];
00568     };
00569     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00570   };
00571 
00572   struct Normal : public _Normal
00573   {
00574     inline Normal ()
00575     {
00576       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
00577     }
00578 
00579     inline Normal (float n_x, float n_y, float n_z)
00580     {
00581       normal_x = n_x; normal_y = n_y; normal_z = n_z;
00582       data_n[3] = 0.0f;
00583     }
00584 
00585     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00586   };
00587 
00588   inline std::ostream& operator << (std::ostream& os, const Normal& p)
00589   {
00590     os << "(" << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
00591     return (os);
00592   }
00593 
00597   struct EIGEN_ALIGN16 _Axis
00598   {
00599     PCL_ADD_NORMAL4D;
00600     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00601   };
00602 
00603   struct EIGEN_ALIGN16 Axis : public _Axis
00604   {
00605     inline Axis ()
00606     {
00607       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
00608     }
00609 
00610     inline Axis (float n_x, float n_y, float n_z)
00611     {
00612       normal_x = n_x; normal_y = n_y; normal_z = n_z;
00613       data_n[3] = 0.0f;
00614     }
00615 
00616     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00617   };
00618 
00619   inline std::ostream& operator << (std::ostream& os, const Axis& p)
00620   {
00621     os << "(" << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << ")";
00622     return os;
00623   }
00624 
00625   inline std::ostream& operator << (std::ostream& os, const _Axis& p)
00626   {
00627     os << "(" << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << ")";
00628     return os;
00629   }
00630 
00634   struct EIGEN_ALIGN16 _PointNormal
00635   {
00636     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00637     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
00638     union
00639     {
00640       struct
00641       {
00642         float curvature;
00643       };
00644       float data_c[4];
00645     };
00646     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00647   };
00648 
00649   struct PointNormal : public _PointNormal
00650   {
00651     inline PointNormal ()
00652     {
00653       x = y = z = 0.0f;
00654       data[3] = 1.0f;
00655       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
00656     }
00657   };
00658 
00659   inline std::ostream& operator << (std::ostream& os, const PointNormal& p)
00660   {
00661     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
00662     return (os);
00663   }
00664 
00694   struct EIGEN_ALIGN16 _PointXYZRGBNormal
00695   {
00696     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00697     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
00698     union
00699     {
00700       struct
00701       {
00702         // RGB union
00703         union
00704         {
00705           struct
00706           {
00707             uint8_t b;
00708             uint8_t g;
00709             uint8_t r;
00710             uint8_t a;
00711           };
00712           float rgb;
00713           uint32_t rgba;
00714         };
00715         float curvature;
00716       };
00717       float data_c[4];
00718     };
00719     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00720   };
00721   struct PointXYZRGBNormal : public _PointXYZRGBNormal
00722   {
00723     inline PointXYZRGBNormal ()
00724     {
00725       x = y = z = 0.0f;
00726       data[3] = 1.0f;
00727       r = g = b = a = 0;
00728       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
00729     }
00730 
00731     inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); }
00732     inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); }
00733     inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, 0)); }
00734     inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, 0)); }
00735   };
00736   inline std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p)
00737   {
00738     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.rgb << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.r << ", " << p.g << ", " << p.b << " - " << p.curvature << ")";
00739     return (os);
00740   }
00741 
00745   struct EIGEN_ALIGN16 _PointXYZINormal
00746   {
00747     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00748     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
00749     union
00750     {
00751       struct
00752       {
00753         float intensity;
00754         float curvature;
00755       };
00756       float data_c[4];
00757     };
00758     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00759   };
00760 
00761   struct PointXYZINormal : public _PointXYZINormal
00762   {
00763     inline PointXYZINormal ()
00764     {
00765       x = y = z = 0.0f;
00766       data[3] = 1.0f;
00767       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
00768       intensity = 0.0f;
00769     }
00770   };
00771 
00772   inline std::ostream& operator << (std::ostream& os, const PointXYZINormal& p)
00773   {
00774     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.intensity << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
00775     return (os);
00776   }
00777 
00781   struct EIGEN_ALIGN16 _PointWithRange
00782   {
00783     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00784     union
00785     {
00786       struct
00787       {
00788         float range;
00789       };
00790       float data_c[4];
00791     };
00792     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00793   };
00794 
00795   struct PointWithRange : public _PointWithRange
00796   {
00797     inline PointWithRange ()
00798     {
00799       x = y = z = 0.0f;
00800       data[3] = 1.0f;
00801       range = 0.0f;
00802     }
00803   };
00804 
00805   inline std::ostream& operator << (std::ostream& os, const PointWithRange& p)
00806   {
00807     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.range << ")";
00808     return (os);
00809   }
00810 
00811   struct EIGEN_ALIGN16 _PointWithViewpoint
00812   {
00813     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
00814     union
00815     {
00816       struct
00817       {
00818         float vp_x;
00819         float vp_y;
00820         float vp_z;
00821       };
00822       float data_c[4];
00823     };
00824     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00825   };
00826 
00830   struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
00831   {
00832     PointWithViewpoint(float _x=0.0f, float _y=0.0f, float _z=0.0f, float _vp_x=0.0f, float _vp_y=0.0f, float _vp_z=0.0f)
00833     {
00834       x=_x; y=_y; z=_z;
00835       data[3] = 1.0f;
00836       vp_x=_vp_x; vp_y=_vp_y; vp_z=_vp_z;
00837     }
00838   };
00839   inline std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p)
00840   {
00841     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.vp_x << "," << p.vp_y << "," << p.vp_z << ")";
00842     return (os);
00843   }
00844 
00848   struct MomentInvariants
00849   {
00850     float j1, j2, j3;
00851   };
00852   inline std::ostream& operator << (std::ostream& os, const MomentInvariants& p)
00853   {
00854     os << "(" << p.j1 << "," << p.j2 << "," << p.j3 << ")";
00855     return (os);
00856   }
00857 
00861   struct PrincipalRadiiRSD
00862   {
00863     float r_min, r_max;
00864   };
00865   inline std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p)
00866   {
00867     os << "(" << p.r_min << "," << p.r_max << ")";
00868     return (os);
00869   }
00870 
00874   struct Boundary
00875   {
00876     uint8_t boundary_point;
00877   };
00878   inline std::ostream& operator << (std::ostream& os, const Boundary& p)
00879   {
00880     os << p.boundary_point;
00881     return (os);
00882   }
00883 
00887   struct PrincipalCurvatures
00888   {
00889     union
00890     {
00891       float principal_curvature[3];
00892       struct
00893       {
00894         float principal_curvature_x;
00895         float principal_curvature_y;
00896         float principal_curvature_z;
00897       };
00898     };
00899     float pc1;
00900     float pc2;
00901   };
00902   inline std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p)
00903   {
00904     os << "(" << p.principal_curvature[0] << "," << p.principal_curvature[1] << "," << p.principal_curvature[2] << " - " << p.pc1 << "," << p.pc2 << ")";
00905     return (os);
00906   }
00907 
00911   struct PFHSignature125
00912   {
00913     float histogram[125];
00914   };
00915   inline std::ostream& operator << (std::ostream& os, const PFHSignature125& p)
00916   {
00917     for (int i = 0; i < 125; ++i)
00918     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 124 ? ", " : ")");
00919     return (os);
00920   }
00921 
00925   struct PFHRGBSignature250
00926   {
00927     float histogram[250];
00928   };
00929   inline std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p)
00930   {
00931     for (int i = 0; i < 250; ++i)
00932     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 249 ? ", " : ")");
00933     return (os);
00934   }
00935 
00939   struct PPFSignature
00940   {
00941     float f1, f2, f3, f4;
00942     float alpha_m;
00943   };
00944   inline std::ostream& operator << (std::ostream& os, const PPFSignature& p)
00945   {
00946     os << "(" << p.f1 << ", " << p.f2 << ", " << p.f3 << ", " << p.f4 << ", " << p.alpha_m << ")";
00947     return (os);
00948   }
00949 
00953    struct PPFRGBSignature
00954    {
00955      float f1, f2, f3, f4;
00956      float r_ratio, g_ratio, b_ratio;
00957      float alpha_m;
00958    };
00959    inline std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p)
00960    {
00961      os << "(" << p.f1 << ", " << p.f2 << ", " << p.f3 << ", " << p.f4 << ", " <<
00962          p.r_ratio << ", " << p.g_ratio << ", " << p.b_ratio << ", " << p.alpha_m << ")";
00963      return (os);
00964    }
00965 
00970   struct NormalBasedSignature12
00971   {
00972     float values[12];
00973   };
00974   inline std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p)
00975   {
00976     for (int i = 0; i < 12; ++i)
00977     os << (i == 0 ? "(" : "") << p.values[i] << (i < 11 ? ", " : ")");
00978     return (os);
00979   }
00980 
00984   struct ShapeContext
00985   {
00986     std::vector<float> descriptor;
00987     float rf[9];
00988   };
00989 
00990   inline std::ostream& operator << (std::ostream& os, const ShapeContext& p)
00991   {
00992     for (int i = 0; i < 9; ++i)
00993     os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
00994     for (size_t i = 0; i < p.descriptor.size (); ++i)
00995     os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < p.descriptor.size()-1 ? ", " : ")");
00996     return (os);
00997   }
00998 
01002   struct SHOT
01003   {
01004     std::vector<float> descriptor;
01005     float rf[9];
01006   };
01007 
01008   PCL_DEPRECATED (inline std::ostream& operator << (std::ostream& os, const SHOT& p), "SHOT POINT IS DEPRECATED, USE SHOT352 FOR SHAPE AND SHOT1344 FOR SHAPE+COLOR INSTEAD");
01009   inline std::ostream& operator << (std::ostream& os, const SHOT& p)
01010   {
01011     for (int i = 0; i < 9; ++i)
01012     os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
01013     for (size_t i = 0; i < p.descriptor.size (); ++i)
01014     os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < p.descriptor.size()-1 ? ", " : ")");
01015     return (os);
01016   }
01017 
01021   struct SHOT352
01022   {
01023     float descriptor[352];
01024     float rf[9];
01025   };
01026 
01027   inline std::ostream& operator << (std::ostream& os, const SHOT352& p)
01028   {
01029     for (int i = 0; i < 9; ++i)
01030     os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
01031     for (size_t i = 0; i < 352; ++i)
01032     os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < 351 ? ", " : ")");
01033     return (os);
01034   }
01035 
01039   struct SHOT1344
01040   {
01041     float descriptor[1344];
01042     float rf[9];
01043   };
01044 
01045   inline std::ostream& operator << (std::ostream& os, const SHOT1344& p)
01046   {
01047     for (int i = 0; i < 9; ++i)
01048     os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
01049     for (size_t i = 0; i < 1344; ++i)
01050     os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < 1343 ? ", " : ")");
01051     return (os);
01052   }
01053 
01057   struct EIGEN_ALIGN16 _ReferenceFrame
01058   {
01059     union
01060     {
01061       struct
01062       {
01063         _Axis x_axis;
01064         _Axis y_axis;
01065         _Axis z_axis;
01066       };
01067       float rf[12];
01068     };
01069     //union
01070     //{
01071       //struct
01072       //{
01073         //float confidence;
01074       //};
01075       //float data_c[4];
01076     //};
01077 
01078     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
01079   };
01080 
01081   struct EIGEN_ALIGN16 ReferenceFrame : public _ReferenceFrame
01082   {
01083     ReferenceFrame ()
01084     {
01085       x_axis = y_axis = z_axis = Axis();
01086       //confidence = 0.;
01087     }
01088 
01089     ReferenceFrame (Axis const &x, Axis const &y, Axis const &z/*, float c = 1.0*/)
01090     {
01091       x_axis = x;
01092       y_axis = y;
01093       z_axis = z;
01094       //confidence = c;
01095     }
01096 
01097     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
01098   };
01099 
01100   inline std::ostream& operator << (std::ostream& os, const ReferenceFrame& p)
01101   {
01102     os << "(" << p.x_axis << "," << p.y_axis << "," << p.z_axis /*<< " - " << p.confidence*/ << ")";
01103     return (os);
01104   }
01105 
01109   struct FPFHSignature33
01110   {
01111     float histogram[33];
01112   };
01113   inline std::ostream& operator << (std::ostream& os, const FPFHSignature33& p)
01114   {
01115     for (int i = 0; i < 33; ++i)
01116     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 32 ? ", " : ")");
01117     return (os);
01118   }
01119 
01123   struct VFHSignature308
01124   {
01125     float histogram[308];
01126   };
01127   inline std::ostream& operator << (std::ostream& os, const VFHSignature308& p)
01128   {
01129     for (int i = 0; i < 308; ++i)
01130     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 307 ? ", " : ")");
01131     return (os);
01132   }
01133 
01137   struct ESFSignature640
01138   {
01139     float histogram[640];
01140   };
01141   inline std::ostream& operator << (std::ostream& os, const ESFSignature640& p)
01142   {
01143     for (int i = 0; i < 640; ++i)
01144     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 639 ? ", " : ")");
01145     return (os);
01146   }
01147 
01151   struct GFPFHSignature16
01152   {
01153       float histogram[16];
01154       static int descriptorSize() { return 16; }
01155   };
01156   inline std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p)
01157   {
01158     for (int i = 0; i < p.descriptorSize (); ++i)
01159     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < (p.descriptorSize () - 1) ? ", " : ")");
01160     return (os);
01161   }
01162 
01166   struct Narf36
01167   {
01168     float x, y, z, roll, pitch, yaw;
01169     float descriptor[36];
01170   };
01171   inline std::ostream& operator << (std::ostream& os, const Narf36& p)
01172   {
01173     os << p.x<<","<<p.y<<","<<p.z<<" - "<<p.roll*360.0/M_PI<<"deg,"<<p.pitch*360.0/M_PI<<"deg,"<<p.yaw*360.0/M_PI<<"deg - ";
01174     for (int i = 0; i < 36; ++i)
01175     os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < 35 ? ", " : ")");
01176     return (os);
01177   }
01178 
01182   struct BorderDescription
01183   {
01184     int x, y;
01185     BorderTraits traits;
01186     //std::vector<const BorderDescription*> neighbors;
01187   };
01188 
01189   inline std::ostream& operator << (std::ostream& os, const BorderDescription& p)
01190   {
01191     os << "(" << p.x << "," << p.y << ")";
01192     return (os);
01193   }
01194 
01198   struct IntensityGradient
01199   {
01200     union
01201     {
01202       float gradient[3];
01203       struct
01204       {
01205         float gradient_x;
01206         float gradient_y;
01207         float gradient_z;
01208       };
01209     };
01210   };
01211   inline std::ostream& operator << (std::ostream& os, const IntensityGradient& p)
01212   {
01213     os << "(" << p.gradient[0] << "," << p.gradient[1] << "," << p.gradient[2] << ")";
01214     return (os);
01215   }
01216 
01220   template <int N>
01221   struct Histogram
01222   {
01223     float histogram[N];
01224   };
01225   template <int N>
01226   inline std::ostream& operator << (std::ostream& os, const Histogram<N>& p)
01227   {
01228     for (int i = 0; i < N; ++i)
01229     os << (i == 0 ? "(" : "") << p.histogram[i] << (i < N-1 ? ", " : ")");
01230     return (os);
01231   }
01232 
01236   struct EIGEN_ALIGN16 _PointWithScale
01237   {
01238     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
01239     float scale;
01240     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
01241   };
01242 
01243   struct PointWithScale : public _PointWithScale
01244   {
01245     inline PointWithScale ()
01246     {
01247       x = y = z = 0.0f;
01248       data[3] = 1.0f;
01249       scale = 1.0f;
01250     }
01251   };
01252   inline std::ostream& operator << (std::ostream& os, const PointWithScale& p)
01253   {
01254     os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.scale << ")";
01255     return (os);
01256   }
01257 
01261   struct EIGEN_ALIGN16 _PointSurfel
01262   {
01263     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
01264     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
01265     union
01266     {
01267       struct
01268       {
01269         uint32_t rgba;
01270         float radius;
01271         float confidence;
01272         float curvature;
01273       };
01274       float data_c[4];
01275     };
01276     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
01277   };
01278 
01279   struct PointSurfel : public _PointSurfel
01280   {
01281     inline PointSurfel ()
01282     {
01283       x = y = z = 0.0f;
01284       data[3] = 1.0f;
01285       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
01286       rgba = 0;
01287       radius = confidence = curvature = 0.0f;
01288     }
01289   };
01290 
01291   inline std::ostream& operator << (std::ostream& os, const PointSurfel& p)
01292   {
01293     const unsigned char* rgba_ptr = reinterpret_cast<const unsigned char*>(&p.rgba);
01294     os <<
01295     "(" << p.x << "," << p.y << "," << p.z << " - " <<
01296     p.normal_x << "," << p.normal_y << "," << p.normal_z << " - "
01297     << static_cast<int>(*rgba_ptr) << ","
01298     << static_cast<int>(*(rgba_ptr+1)) << ","
01299     << static_cast<int>(*(rgba_ptr+2)) << ","
01300     << static_cast<int>(*(rgba_ptr+3)) << " - " <<
01301     p.radius << " - " << p.confidence << " - " << p.curvature << ")";
01302     return (os);
01303   }
01304 
01308   template <typename PointT> inline bool
01309   isFinite (const PointT &pt)
01310   {
01311     return (pcl_isfinite (pt.x) && pcl_isfinite (pt.y) && pcl_isfinite (pt.z));
01312   }
01313 
01314   // specification for pcl::Normal
01315   template <> inline bool
01316   isFinite<pcl::Normal> (const pcl::Normal &n)
01317   {
01318     return (pcl_isfinite (n.normal_x) && pcl_isfinite (n.normal_y) && pcl_isfinite (n.normal_z));
01319   }
01320 } // End namespace
01321 
01322 // Preserve API for PCL users < 1.4
01323 #include <pcl/common/distances.h>
01324 
01325 #endif


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:19