I have 6 points (for example) but i dont have dimx=6 * dimy=6 points, and when i use this code:
int cont=0;
for (int ix=0; ix<dimx; ix++){
for (int iy=0; iy<dimy; iy++){
cont++;
points[ix][iy][0]=x[cont];
points[ix][iy][1]=y[cont];
points[ix][iy][2]=z[cont];
}
}
int cont=0;
for (int ix=0; ix<dimx; ix++){
for (int iy=0; iy<dimy; iy++){
cont++;
points[ix][iy][0]=x[cont];
points[ix][iy][1]=y[cont];
points[ix][iy][2]=z[cont];
}
}
To copy to clipboard, switch view to plain text mode
i'm trying to alocate 6x6 points, and this is the error, cont=0,1,.....,36, and x[0,..,6] y[0,...,6] and z[0,...,6].
The definition of the pointer (***points) is ok, but the initialization of the pointer is bad.
This code works if i make only a for loop like this:
for (int i=0; i<dimx; i++){
points[i][i][0]=x[i];
points[i][i][1]=y[i];
points[i][i][2]=z[i];
}
for (int i=0; i<dimx; i++){
points[i][i][0]=x[i];
points[i][i][1]=y[i];
points[i][i][2]=z[i];
}
To copy to clipboard, switch view to plain text mode
But this is not what i want for making a surface, because i have a lots of points in the array with no initialization.
So, i make this question: how construct a surface if i have n points (x,y,z) with evaluators (opengl) or nurbs (glut), or another way...?
Bookmarks