improve docs and acks related to new MC alg

This commit is contained in:
Almar Klein
2016-05-25 10:53:06 +02:00
parent 41857a0736
commit ededdfaf56
4 changed files with 14 additions and 8 deletions
+3
View File
@@ -230,6 +230,9 @@
- Alex Izvorski
Color spaces for YUV and related spaces
- Thomas Lewiner
Design and original implementation of the Lewiner marching cubes algorithm
- Jeff Hemmelgarn
Minimum threshold
+8 -6
View File
@@ -52,7 +52,9 @@ def marching_cubes_lewiner(volume, level=None, spacing=(1., 1., 1.),
If given and True, the classic marching cubes by Lorensen (1987)
is used. This option is included for reference purposes. Note
that this algorithm has ambiguities and is not guaranteed to
produce a topologically correct result.
produce a topologically correct result. The results with using
this option are *not* generally the same as the ``marching_cubes()``
function.
Returns
-------
@@ -74,11 +76,11 @@ def marching_cubes_lewiner(volume, level=None, spacing=(1., 1., 1.),
Notes about the algorithm
-------------------------
The algorithm [1] is an improved version of Chernyaev's Marching Cubes 33
algorithm, originally written in C++. It is an efficient algorithm
that relies on heavy use of lookup tables to handle the many different
cases. This keeps the algorithm relatively easy. The current algorithm
is a port of Lewiner's algorithm and written in Cython.
The algorithm [1] is an improved version of Chernyaev's Marching
Cubes 33 algorithm. It is an efficient algorithm that relies on
heavy use of lookup tables to handle the many different cases,
keeping the algorithm relatively easy. This implementation is
written in Cython, ported from Lewiner's C++ implementation.
References
----------
+2 -2
View File
@@ -27,7 +27,7 @@ elif SELECT == 2:
isovalue = 0.2
elif SELECT == 3:
# Generate two donuts
# Generate two donuts using a formula by Thomas Lewiner
n = 48
a, b = 2.5/n, -1.25
isovalue = 0.0
@@ -53,7 +53,7 @@ elif SELECT == 4:
# Get surface meshes
t0 = time.time()
vertices1, faces1, *_ = marching_cubes_lewiner(vol, isovalue, gradient_direction=gradient_dir, use_classic=False)
vertices1, faces1, *_ = marching_cubes_lewiner(vol, isovalue, gradient_direction=gradient_dir, use_classic=True)
print('finding surface lewiner took %1.0f ms' % (1000*(time.time()-t0)) )
t0 = time.time()
@@ -138,6 +138,7 @@ def test_both_algs_same_result_donut():
for iz in range(vol.shape[0]):
for iy in range(vol.shape[1]):
for ix in range(vol.shape[2]):
# Double-torii formula by Thomas Lewiner
z, y, x = float(iz)*a+b, float(iy)*a+b, float(ix)*a+b
vol[iz,iy,ix] = ( (
(8*x)**2 + (8*y-2)**2 + (8*z)**2 + 16 - 1.85*1.85 ) * ( (8*x)**2 +