Commit eefbd269 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Graphics assignment 9

Added another definition in volume.c.
parent a2e6c09c
......@@ -34,28 +34,25 @@ voxel2idx(int i, int j, int k)
/* Extract a cell from the volume, so that datapoint 0 of the
cell corresponds to voxel (i, j, k), datapoint 1 to voxel (i+1, j, k),
etc. See Figure 3 in the assignment. */
// Abbreviation definition, used in the function below
#define ADD_DATA_POINT(index,i,j,k) \
c.p[(index)] = v3_create((i), (j), (k)); \
c.value[(index)] = volume[voxel2idx((i), (j), (k))]
cell
get_cell(int i, int j, int k)
{
cell c;
c.p[0] = v3_create(i, j, k);
c.p[1] = v3_create(i+1, j, k);
c.p[2] = v3_create(i, j+1, k);
c.p[3] = v3_create(i+1, j+1, k);
c.p[4] = v3_create(i, j, k+1);
c.p[5] = v3_create(i+1, j, k+1);
c.p[6] = v3_create(i, j+1, k+1);
c.p[7] = v3_create(i+1, j+1, k+1);
c.value[0] = volume[voxel2idx(i, j, k)];
c.value[1] = volume[voxel2idx(i+1, j, k)];
c.value[2] = volume[voxel2idx(i, j+1, k)];
c.value[3] = volume[voxel2idx(i+1, j+1, k)];
c.value[4] = volume[voxel2idx(i, j, k+1)];
c.value[5] = volume[voxel2idx(i+1, j, k+1)];
c.value[6] = volume[voxel2idx(i, j+1, k+1)];
c.value[7] = volume[voxel2idx(i+1, j+1, k+1)];
ADD_DATA_POINT(0, i , j , k);
ADD_DATA_POINT(1, i+1, j , k);
ADD_DATA_POINT(2, i , j+1, k);
ADD_DATA_POINT(3, i+1, j+1, k);
ADD_DATA_POINT(4, i , j , k+1);
ADD_DATA_POINT(5, i+1, j , k+1);
ADD_DATA_POINT(6, i , j+1, k+1);
ADD_DATA_POINT(7, i+1, j+1, k+1);
return c;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment