-1

I am getting row data from a sensor (distances & amplitude) and saving them into a vector container in C++.
Using OpenGL, I am visualizing it(see the pic below)
Sensor in the middle and get distance of any obstacle within 100 meter range around 360° Now I want to split the data based on some factors(for clustering purpose) and want to save them into new individual vector(s). The problem is, I don't know how many cluster I'll get, so no idea about the number of vector(s) I'll need.
Anybody know any method for this, please share.

Harsh Patel
  • 187
  • 9

1 Answers1

1

This sounds like a vector of vector.

// Vector of vector that will contain all your clusters
std::vector<std::vector<DATA>> clusters;

// everytime you have a new cluster you can then do something like :
std::vector<DATA> currentCluster;

// You add the data to the cluster
currentCluster.emplace_back(/* The data */)

// You then add the currentCluster to the group of clusters.
clusters.emplace_back(currentCluster);