Skip to content
Snippets Groups Projects
Commit b5db0dbd authored by andreucm's avatar andreucm
Browse files

GridCluster class added but not yet tested

parent 71caf803
No related branches found
No related tags found
No related merge requests found
#include "grid_cluster.h"
namespace laserscanutils
{
//init static cluster counter
unsigned int GridCluster::cluster_id_count_ = 0;
GridCluster::GridCluster() : PointSet()
{
//
}
GridCluster::~GridCluster()
{
//
}
void GridCluster::print() const
{
//print cluster params
std::cout
<< "\tcluster_id_: " << cluster_id_ << std::endl
<< "\tcentroid_x_: " << centroid_(0) << std::endl
<< "\tcentroid_y_: " << centroid_(1)<< std::endl;
//print cluster cell index pairs
std::cout << "\tcells_: ";
for (unsigned int jj = 0; jj < cells_.size(); jj++)
{
std::cout << cells_.at(jj).first << "," << cells_.at(jj).second << " - ";
}
std::cout << std::endl;
}
}//close namespace
#ifndef GRID_CLUSTER_H_
#define GRID_CLUSTER_H_
//laserscanutils
#include "laser_scan_utils.h"
#include "point_set.h"
//std
#include <iostream>
//open namespace
namespace laserscanutils
{
/** \brief Cluster class
*
* Cluster of connected occupied cells in a grid
*
**/
class GridCluster : public PointSet
{
protected:
unsigned int cluster_id_; //Cluster id.
static unsigned int cluster_id_count_; //cluster counter (acts as simple ID factory)
public:
std::vector<std::pair<unsigned int, unsigned int> > cells_; //i,j index of the grid cells of this cluster
public:
//constructor
GridCluster();
//Destructor
~GridCluster();
//print
virtual void print() const;
};
}//namespace
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment