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
ac621031
Commit
ac621031
authored
Nov 21, 2010
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://vo20.nl/git/uva
parents
4b94caaa
d7ca18f4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
30 deletions
+64
-30
graphics/ass9/source/main.c
graphics/ass9/source/main.c
+4
-7
graphics/ass9/source/marching_tetrahedra.c
graphics/ass9/source/marching_tetrahedra.c
+14
-16
graphics/ass9/source/questions.txt
graphics/ass9/source/questions.txt
+42
-0
graphics/ass9/source/volume.c
graphics/ass9/source/volume.c
+4
-7
No files found.
graphics/ass9/source/main.c
View file @
ac621031
...
...
@@ -5,13 +5,10 @@
* Date ............ 29.10.2007
* Created by ...... Paul Melis
*
* Student name ....
* Student email ...
* Collegekaart ....
* Date ............
* Comments ........
*
* (always fill in these fields before submitting!!)
* Student name .... Sander van Veen & Taddeus Kroes
* Student email ... sandervv@gmail.com & taddeuskroes@hotmail.com
* Collegekaart .... 6169676 & 6054129
* Date ............ 17.11.2010
*/
#include <stdio.h>
...
...
graphics/ass9/source/marching_tetrahedra.c
View file @
ac621031
/* Computer Graphics, Assignment, Volume rendering with cubes/points/isosurface
*
* Student name ....
* Student email ...
* Collegekaart ....
* Date ............
* Comments ........
*
* (always fill in these fields before submitting!!)
* Student name .... Sander van Veen & Taddeus Kroes
* Student email ... sandervv@gmail.com & taddeuskroes@hotmail.com
* Collegekaart .... 6169676 & 6054129
* Date ............ 17.11.2010
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include "marching_tetrahedra.h"
/* Compute a linearly interpolated position where an isosurface cuts
...
...
@@ -23,13 +19,13 @@ static vec3
interpolate_points
(
unsigned
char
isovalue
,
vec3
p1
,
vec3
p2
,
unsigned
char
v1
,
unsigned
char
v2
)
{
//float diff1 = fabsf((float)(isovalue - v1)),
// diff2 = fabsf((float)(isovalue - v2)),
// total = diff1 + diff2;
//vec3 v = v3_add(v3_multiply(p1, diff1/total), v3_multiply(p2, diff2/total));
vec3
v
=
v3_add
(
v3_multiply
(
p1
,
0
.
5
),
v3_multiply
(
p2
,
0
.
5
));
// Interpolate between v1 and v2 to determine relative coordinates
vec3
v
=
v3_multiply
(
v3_add
(
v3_multiply
(
p1
,
v2
-
isovalue
),
v3_multiply
(
p2
,
isovalue
-
v1
)
),
1
.
0
/
(
v2
-
v1
));
// Multiply by voxel dimensions for absolute coordinates
return
v3_create
(
v
.
x
*
sizex
,
v
.
y
*
sizey
,
v
.
z
*
sizez
);
}
...
...
@@ -59,10 +55,12 @@ generate_tetrahedron_triangles(triangle *triangles, unsigned char isovalue,
// Use a 4-bit bitmask to determine the order of "black/white" points of
// the tetrahedon. Generate 0, 1 or 2 triangle(s) according to the case.
switch
(
(
v
[
v0
]
<=
isovalue
?
1
:
0
)
|
(
v
[
v1
]
<=
isovalue
?
1
<<
1
:
0
)
|
(
v
[
v2
]
<=
isovalue
?
1
<<
2
:
0
)
|
(
v
[
v3
]
<=
isovalue
?
1
<<
3
:
0
)
)
switch
(
(
v
[
v0
]
<=
isovalue
?
1
:
0
)
|
(
v
[
v1
]
<=
isovalue
?
2
:
0
)
|
(
v
[
v2
]
<=
isovalue
?
4
:
0
)
|
(
v
[
v3
]
<=
isovalue
?
8
:
0
)
)
{
case
0x1
:
case
0xE
:
// 0001 or 1110
// ADD_TRI usage example: interpolate between edges (v0, v1),
// (v0, v2) and (v0, v3)
ADD_TRI
(
v0
,
v1
,
v0
,
v2
,
v0
,
v3
);
break
;
case
0x2
:
case
0xD
:
// 0010 or 1101
...
...
graphics/ass9/source/questions.txt
0 → 100644
View file @
ac621031
Question 1:
What happens for case 0011/1100 when two of the tetrahedron's vertex
values are equal to the iso-value of interest and the other two are greater
than the iso-value? Is this a bad thing? Hint: think of the kind of output
generated in this case.
In that case, two corners of the same triangle are equal to the tetrahedon
vertices that are equal to the isovalue, so an edge of the triangle is
exactly on the edge of the tetrahedon between the two equal vertices. In the
interpolation function, this means a division by zero (v2 - v1 = 0), which
is indeed a bad thing. A solution to this problem would build in an extra
check for this kind of cases.
--------------------------------------------------------------------------------
Question 2:
We render the iso-surface two-sided here, that is, without back-face culling.
But if the iso-surface were to form a closed surface there would be no need
for this, as the inside/back-side of the surface would never be visible. So
for what situation does marching tetrahedra not produce a closed isosurface?
For each triangle edge in a tetrahedon, there should be a triangle in one
of the neighbouring tetrahedons that shares that edge. Because of the
shapes of the tetrahedons, this means that the end points of the edge are
the result of interpolation in both tetrahedons (which can be checked in
code relatively easily). For example, this situation occurs in a dataset
containing a cube or a sphere.
--------------------------------------------------------------------------------
Question 3:
What optimizations to the marching tetrahedrons algorithm as described
in Section 3 can you think of? Are there computations that are performed
redundantly? Is there opportunity for parallel processing?
- There's plenty of room for parallel processing, since all cells/tetrahedons
are checked independently of eachother.
- If we know (by specification) that an isosurface is closed, we can use the
property described in the answer to question 2 by creating an incremental
algorithm that uses already interpolated points in neigbouring tetrahedons
to create a triangle strip, instead of interpolating seperately in each
tetrahedon (note that there is less room for parallel processing in this case).
graphics/ass9/source/volume.c
View file @
ac621031
/* Computer Graphics, Assignment, Volume rendering with cubes/points/isosurface
*
* Student name ....
* Student email ...
* Collegekaart ....
* Date ............
* Comments ........
*
* (always fill in these fields before submitting!!)
* Student name .... Sander van Veen & Taddeus Kroes
* Student email ... sandervv@gmail.com & taddeuskroes@hotmail.com
* Collegekaart .... 6169676 & 6054129
* Date ............ 17.11.2010
*/
#include <stdio.h>
...
...
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