I'm looking for solution how to find the most similar value in a vector of struct:
struct tStruct{
int nr;
double data1;
double data2;};
vector<tStruct> tPoint {
{3, 32.3247351, 14.6209107},
{4, 32.3262635, 14.6352101},
{5, 32.3249088, 14.6497090},
{6, 32.3240278, 14.6642700},
{7, 32.3256065, 14.6786958}};
I have two variables double vdata1 = 32.32443, double vdata2 = 14.65692
that I would like compare with tPoint
vector and return the nearest found value, e.g. {5, 32.3249088, 14.6497090} to make some other calculations.
Is there any way to achieve this?