Skip to content
Prev 332900 / 398503 Next

`level' definition in `computeContour3d' (misc3d package)

On Sat, 09 Nov 2013 17:16:28 +0100, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:

            
it's not "bad" contours, actually. my question only concerns the different  
meaning
of `level' depending on whether `level = maxvol' or not.

here is a real example:

8<------------------------------------------------
library(misc3d)

dim <- 21
cnt <- (dim+1)/2
wid1 <- 5
wid2 <- 1
rng1 <- (cnt-wid1):(cnt+wid1)
rng2 <- (cnt-wid2):(cnt+wid2)

v <- array(0, rep (dim, 3))

#put 11x11x11 box of ones at center
v[rng1, rng1, rng1] <- 1

con1 <- computeContour3d(v, level = 1)
drawScene(makeTriangles(con1))
dum <- readline("CR for next plot")

#put an additional  3x3x3 box of twos at center
v[rng2, rng2, rng2] <- 2
con2 <- computeContour3d(v, level = 1)
drawScene(makeTriangles(con2))
8<------------------------------------------------

this first puts a 11x11x11 box one Ones at the center of the  
zero-initalized array and computes `con1' for `level=1'. in the 2. step
it puts a further, 3x3x3 box of Twos at the center and computes the  
`level=1' contour again which this time does not delineate
the box of Ones but lies somewhere between the two non-zero boxes since  
now the test in `faceType' is for `> level'. this is not immediately  
obvious from the plots (no scale) but obvious from looking at `con1' and  
`con2': the `con2' isosurface is shrunk by 3 voxels at each
side relative to `con1' (so my initial mail was wrong here: `con2' does  
not "jump" to the next "discrete" isocontour but rather to
a point about halfway between both plateaus ). I also (for my own problem  
at hand) computed the total surface area which is
(not surprisingly...) 600 for `con1' and 64.87 for `con2'. so if one is  
interested in such surfaces (I am) this makes a big difference in such  
data.

the present behavior is not "wrong" per se but I would much prefer if the  
test where always for `>= level' (so that in the present example the
resulting isosurface would in both cases delineate the box of Ones -- as  
is the case when using `level = 1-e-6' instead of `level=1').

I believe the isosurface for a given value of `level' should have an  
unambiguous meaning independent of what the data further "inside" are  
looking like.

is this clearer now?
--