Puzzling behaviour of ListContoutPlot3D
- To: mathgroup at smc.vnet.net
 - Subject: [mg122139] Puzzling behaviour of ListContoutPlot3D
 - From: "Tony Harker" <a.harker at ucl.ac.uk>
 - Date: Sun, 16 Oct 2011 07:06:47 -0400 (EDT)
 - Delivered-to: l-mathgroup@mail-archive0.wolfram.com
 
  Having struggled to understand why a real-world application was giving me
puzzling output from ListContourPlot3D, I boiled the problem down to the
following reduced cases. First, a simple spherically symmetrical cases in
the interval -1 to 1 in each dimension, with data given either as a grid of
values or as a list of {x,y,z,f} values:
 
fn[{x_, y_, z_}] := Sqrt[x^2 + y^2 + z^2]
grid = Table[{x, y, z}, {x, -1, 1, .2}, {y, -1, 1, .2}, {z, -1,   1, .2}];
ListContourPlot3D[Map[fn, grid, {3}], Contours -> {.5}]
ListContourPlot3D[Map[Flatten[{#, fn[#]}] &, Flatten[grid, 2]],  Contours ->
{.5}]
 
  Both plots give closed surfaces, but although the underlying values are
the same the first plot is nearer to spherical than the second. Why the
difference?
 
Then I tried a different range of values:
 
fn[{x_, y_, z_}] := Sqrt[(x - 6)^2 + (y - 6)^2 + (z - 6)^2]
grid = Table[{x, y, z}, {x, 1, 11}, {y, 1, 11}, {z, 1, 11}];
ListContourPlot3D[Map[fn, grid, {3}], Contours -> {5}]
ListContourPlot3D[Map[Flatten[{#, fn[#]}] &, Flatten[grid, 2]],  Contours ->
{5}]
 
  Again, the first plot was nice and spherical. This time, though, the
second plot did not even produce a closed surface. In the real problem I was
originally tackling, half the surface octants were missing and half were
present, but here the  amount of surface that shows is not so neatly
classifiable. What's happening?
 
In[473]:= $Version
 
Out[473]= "8.0 for Microsoft Windows (64-bit) (February 23, 2011)"
 
   Tony
 
A.H. Harker
Department of Physics and Astronomy
University College London
Gower Street
London
WC1E 6BT
Tel: (within UK)    020 7679 3404
     (overseas ) +44 20 7679 3404
E:    a.harker at ucl.ac.uk