Hello,
I need to store the cooridants of a vector, for example:
If the vector was:
0 1 0 1 0
0 1 0 1 0
0 1 1 1 1
0 0 0 0 0
And this vector is then split into blocks, I need to store the the corridents so I can then use them later to put the vector back together. Now I have managed to get the calculation to calculate the corridents, I just don't know how I'd go about setting them as a 2D vector..
Here is the function that handles the corridents:
vector<double> subsetMatrix(const iniMatrix& theMatrix, int mat_row, int mat_col, int offsetX, int offsetY, int newRow, intnewCol)
{
iniMatrix newMatrix;
for(int i=offsetY; (i < newRow); i++)
{
for(int j= offsetX; (j < newCol); j++)
{
newMatrix.push_back(theMatrix[i*mat_row+j]);
// i*mat_row+j IS the corridents
}
}
return newMatrix;
}
I have a 2D vector defined in the class, I just need a way of pushing to this vector and then retriving it.