Mathematical Principles for Scientific Computing and Visualization
http : // www.farinhansford.com/books/scv
by Gerald Farin and Dianne Hansford

This notebook demonstrates contouring of 3d functions.

For the function w = xyz, we can see a polygonal looking contour. This can be improved by increasing the number of evaluations -- delta0 should be made smaller.

Figures  15.5 and 15.7 were created with this notebook.

See Chapter 15 : Volume Visualization for details.

Updated May 2008

(* Set the output folder *)
SetDirectory[ToFileName[Extract["FileName"/.NotebookInformation[EvaluationNotebook[]],{1},FrontEnd`FileName]]];

delta0=0.1;

(* Create a trilinear function w = xyz *)
(* Evaluated over [0,1] in each axis at a refinement of delta0 *)
lsttrilinear=Table[x y z,{z,0,1,delta0},{y,0,1,delta0},{x,0,1,delta0}];

(* Create a plot of the trilinear function *)
g1=ListContourPlot3D[lsttrilinear,DataRange->{{0,1},{0,1},{0,1}},Contours->{0.001`,0.01`,0.1`,0.5`,0.8`},Axes->True,BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11}];

(* Create a point at the x=1, y=1,z=1 corner *)
corner111=Graphics3D[{PointSize[0.1`],Point[{1,1,1}]}];


(* Plot the trivariate and corner point together *)
Show[g1,corner111] 

(* Create postscript output *)
(* Export["mcubes_xyz.eps",%]  *)

(* Let's play with a different function -- z= x^2 + y^2 + z^2 *)
delta=0.2;

(* Evaluate the function over [-1,1] in each axis *)
lst=Table[(x^2)+(y^2)+(z^2),{z,-1,1,delta},{y,-1,1,delta},{x,-1,1,delta}];

(* Plot it *)
ListContourPlot3D[lst,DataRange->{{-1,1},{-1,1},{-1,1}},Contours->{0.5`,1.5`},Axes->True,BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11}] 


(* Output to a postscript file *)(* Export["mcubes_sphere.eps",%] *)