- Code: Select all
double V[][6] = {
{-.01,0,0, -.2,-.2,1}, // POINT AND NORMAL
{.1,0,0, .2,-.2,1},
{0,.11,0, -.2,.2,1},
{.08,.09,0, .2,.2,1}
};
but this gives me a compiler error. It says "syntax error : '{'" and
"unexpected token(s) preceding '{'; skipping apparent function body".
Does anyone know why? All I want to do is declare and initialize it.
Also, lets say I have a 3-dim array, (which I cant initialize either until I fix my first problem)
- Code: Select all
double polygon[][][] = {
{ V[0], V[1], V[2] },
{ V[1], V[2], V[3] }
};
and I need a for loop to go thru polygon. I want to do something like:
- Code: Select all
for (int n = 0 ; n < polygon.length ; n++)
for (int i = 0 ; i < polygon[n].length ; i++)
for (int k = 0 ; k < 3 ; k++)
normal[k] = polygon[n][i][k+3];
What do I replace the polygon.length's with? Would it be sizeof(polygon)/sizeof(polygon[0]) for the outer loop and sizeof(polygon[0])/sizeof(polygon[0][0]) for the inner?
This stuff confuses me.
Thanx for the help,
-Flack
