Commit 1febb304 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Graphics assignment 9.

Source code cleanup.
parent eefbd269
......@@ -44,7 +44,7 @@ interpolate_points(unsigned char isovalue, vec3 p1, vec3 p2,
2 triangles.
*/
// Some abbreviating definitions that are used in the function below
/* Some abbreviating definitions that are used in the function below */
#define ADD_VEC(i,a,b) (triangles[tri_count].p[(i)] = \
interpolate_points(isovalue, c.p[(a)], c.p[(b)], v[(a)], v[(b)]))
#define ADD_TRI(a,b,c,d,e,f) \
......@@ -55,7 +55,6 @@ generate_tetrahedron_triangles(triangle *triangles, unsigned char isovalue,
cell c, int v0, int v1, int v2, int v3)
{
unsigned char *v = c.value;
//vec3 *p = triangles[0].p;
int tri_count = 0;
// Use a 4-bit bitmask to determine the order of "black/white" points of
......@@ -66,69 +65,26 @@ generate_tetrahedron_triangles(triangle *triangles, unsigned char isovalue,
case 0x1: case 0xE: // 0001 or 1110
ADD_TRI(v0, v1, v0, v2, v0, v3);
break;
//p[0] = interpolate_points(isovalue, c.p[v0], c.p[v1], v[v0], v[v1]);
//p[1] = interpolate_points(isovalue, c.p[v0], c.p[v2], v[v0], v[v2]);
//p[2] = interpolate_points(isovalue, c.p[v0], c.p[v3], v[v0], v[v3]);
//return 1;
case 0x2: case 0xD: // 0010 or 1101
ADD_TRI(v1, v0, v1, v3, v1, v2);
break;
//p[0] = interpolate_points(isovalue, c.p[v1], c.p[v0], v[v1], v[v0]);
//p[1] = interpolate_points(isovalue, c.p[v1], c.p[v3], v[v1], v[v3]);
//p[2] = interpolate_points(isovalue, c.p[v1], c.p[v2], v[v1], v[v2]);
//return 1;
case 0x4: case 0xB: // 0100 or 1011
ADD_TRI(v2, v0, v2, v1, v2, v3);
break;
//p[0] = interpolate_points(isovalue, c.p[v2], c.p[v0], v[v2], v[v0]);
//p[1] = interpolate_points(isovalue, c.p[v2], c.p[v1], v[v2], v[v1]);
//p[2] = interpolate_points(isovalue, c.p[v2], c.p[v3], v[v2], v[v3]);
//return 1;
case 0x8: case 0x7: // 1000 or 0111
ADD_TRI(v3, v0, v3, v2, v3, v1);
break;
//p[0] = interpolate_points(isovalue, c.p[v3], c.p[v0], v[v3], v[v0]);
//p[1] = interpolate_points(isovalue, c.p[v3], c.p[v2], v[v3], v[v2]);
//p[2] = interpolate_points(isovalue, c.p[v3], c.p[v1], v[v3], v[v1]);
//return 1;
case 0x3: case 0xC: // 0011 or 1100
ADD_TRI(v0, v3, v0, v2, v1, v3);
ADD_TRI(v1, v3, v0, v2, v1, v2);
break;
//p[0] = interpolate_points(isovalue, c.p[v0], c.p[v3], v[v0], v[v3]);
//p[1] = interpolate_points(isovalue, c.p[v0], c.p[v2], v[v0], v[v2]);
//p[2] = interpolate_points(isovalue, c.p[v1], c.p[v3], v[v1], v[v3]);
//p = triangles[1].p;
//p[0] = interpolate_points(isovalue, c.p[v1], c.p[v3], v[v1], v[v3]);
//p[2] = interpolate_points(isovalue, c.p[v1], c.p[v2], v[v1], v[v2]);
//p[1] = interpolate_points(isovalue, c.p[v0], c.p[v2], v[v0], v[v2]);
//return 2;
case 0x5: case 0xA: // 0101 or 1010
ADD_TRI(v0, v1, v2, v3, v0, v3);
ADD_TRI(v0, v1, v1, v2, v2, v3);
break;
//p[0] = interpolate_points(isovalue, c.p[v0], c.p[v1], v[v0], v[v1]);
//p[1] = interpolate_points(isovalue, c.p[v2], c.p[v3], v[v2], v[v3]);
//p[2] = interpolate_points(isovalue, c.p[v0], c.p[v3], v[v0], v[v3]);
//p = triangles[1].p;
//p[0] = interpolate_points(isovalue, c.p[v0], c.p[v1], v[v0], v[v1]);
//p[1] = interpolate_points(isovalue, c.p[v1], c.p[v2], v[v1], v[v2]);
//p[2] = interpolate_points(isovalue, c.p[v2], c.p[v3], v[v2], v[v3]);
//return 2;
case 0x6: case 0x9: // 0110 or 1001
ADD_TRI(v0, v1, v2, v3, v1, v3);
ADD_TRI(v0, v1, v0, v2, v2, v3);
break;
//p[0] = interpolate_points(isovalue, c.p[v0], c.p[v1], v[v0], v[v1]);
//p[2] = interpolate_points(isovalue, c.p[v1], c.p[v3], v[v1], v[v3]);
//p[1] = interpolate_points(isovalue, c.p[v2], c.p[v3], v[v2], v[v3]);
//p = triangles[1].p;
//p[0] = interpolate_points(isovalue, c.p[v0], c.p[v1], v[v0], v[v1]);
//p[1] = interpolate_points(isovalue, c.p[v0], c.p[v2], v[v0], v[v2]);
//p[2] = interpolate_points(isovalue, c.p[v2], c.p[v3], v[v2], v[v3]);
//return 2;
default: // 0000 or 1111
break;
}
return tri_count;
......
......@@ -35,7 +35,7 @@ voxel2idx(int i, int j, int k)
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
/* 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))]
......
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