Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef CYLINDER_GRIDMAP_H_
00037 #define CYLINDER_GRIDMAP_H_
00038
00039 #include "Grid2D.h"
00040 #include "../structures/CylinderPatch.h"
00041
00042 class CylinderGridMap: public Grid2D<bool>
00043 {
00044 public:
00045 typedef Grid2D<bool> BoolGrid;
00046 typedef Eigen::Vector3f Vec3;
00047
00048 template<typename PointCloudT>
00049 CylinderGridMap(float cellSize, const CylinderPatch::CylinderPatchPtr& cylinderPatch, const PointCloudT& pointCloud);
00050
00051 private:
00052 typedef CylinderPatch::PointIndices PntInd;
00053
00054 void pointToHeigthAngle(float& height, float& angle, const Vec3& p) const;
00055 void heigthAngleToXY(unsigned int& x, unsigned int& y, float height, float angle) const;
00056 template<typename PointT>
00057 void addPoint(const PointT& p);
00058 void addVec3(const Vec3& p);
00059 template<typename PointCloudT>
00060 void addPoints(const PntInd& indices, const PointCloudT& pointCloud);
00061
00062 float mCellSize;
00063 CylinderPatch::CylinderPatchPtr mCylinder;
00064 };
00065
00066 template<typename PointCloudT>
00067 CylinderGridMap::CylinderGridMap(float cellSize, const CylinderPatch::CylinderPatchPtr& cylinderPatch, const PointCloudT& pointCloud)
00068 : BoolGrid(((cylinderPatch->getRadius()*2*M_PI)/cellSize)+1, (cylinderPatch->getHeight()/cellSize)+1, false),
00069 mCellSize(cellSize),
00070 mCylinder(cylinderPatch)
00071 {
00072 addPoints(mCylinder->getInliers(), pointCloud);
00073 }
00074
00075 template<typename PointT>
00076 void CylinderGridMap::addPoint(const PointT& p)
00077 {
00078 Vec3 v(p.x, p.y, p.z);
00079 this->addVec3(v);
00080 }
00081
00082 template<typename PointCloudT>
00083 void CylinderGridMap::addPoints(const PntInd& indices, const PointCloudT& pointCloud)
00084 {
00085
00086 for (PntInd::const_iterator it = indices.begin(); it != indices.end(); ++it)
00087 {
00088 this->addPoint(pointCloud.points[*it]);
00089 }
00090 }
00091
00092 #endif