Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
1febb304
Commit
1febb304
authored
Nov 21, 2010
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graphics assignment 9.
Source code cleanup.
parent
eefbd269
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
73 deletions
+29
-73
graphics/ass9/source/marching_tetrahedra.c
graphics/ass9/source/marching_tetrahedra.c
+25
-69
graphics/ass9/source/volume.c
graphics/ass9/source/volume.c
+4
-4
No files found.
graphics/ass9/source/marching_tetrahedra.c
View file @
1febb304
...
...
@@ -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
;
...
...
graphics/ass9/source/volume.c
View file @
1febb304
...
...
@@ -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))]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment