Let us typedef single and two(
multi) dimensional arrays respectively as below:
typedef float VERTREX[3];
typedef VERTREX TRIANGLE[3];
then say I have initialized some VERTEX arrays,
VERTREX v1 = { 1, 2, 3 };
VERTREX v2 = { 2, 2, 3 };
VERTREX v3 = { 1, 2, 1 };
Assume mathematically a Triangle defined by combination of three vertices,therefore I defined a Triangle as following code snippet,
TRIANGLE tr;
Problem arisen when I am going to assign each VERTEX(single dimension array) elements in to TRIANGLE(Array of arrays/2-Dimensional array) as below code,
tr[0] = v1;
tr[1] = v2; tr[2] = v3;
Also I cannot continue with creating array of Triangles too.
TRIANGLE tr[4];
hence same behavior as expected.
If someone has an idea/solution how to assign Single Dimension array as an element of Two(Multi) Dimensional array please respond.Please do not provide solution with standard containers like std::vector or using raw pointers approach.
Please bound to array concept.
Thank you everyone for listening.
What I have tried:
Tried to create pointers to each Vertex arrays,but,it failed my optimization concept.