Please bare with me as I explain what I am trying to accomplish :P
Each 'X' below represents a mesh vertex:
For my Unity3d GameObject (G1); the mesh vertices are stored in a C# List object in the following order. *Note the mesh index 'A'. This is a value I know - in this case A=16 (mesh index 16).
I have another GameObject (G2) whose shape is the same (a simple rectangle) but the mesh vertices are ordered differently.*Note the mesh index 'B'. This is a value I dont know and I want to find this value (mesh index) - in this case B=17 (mesh index 17).
As you can see the mesh arrangement is pretty much the same except rotated 90 degrees. If I know the 'mesh vertex index' of A how can I find the 'mesh vertex index' of B?
Whats an algorithm that can calculate the mesh index of B? My attempt is not working at all:
uint A = 16;
uint nCols = 6;
uint nRows = 4;
// Technically both B and A sit on Row 3, Column 5 so if I can find A's row and column maybe I am there?
uint aCol = 16 / nCols; // nup not right
uint aRow = (16 % nCols) - 1; // gives 3
// Once I've calculated aCol and aRow its easy
uint B = (aRow * nRows) + aCol; // ie, (3 * 4) + 5 = 17