# HG changeset patch # User Rik # Date 1374732766 25200 # Node ID 18137205f57db176574be1f2f6954f68ab3d89ee # Parent f8b485d09ac65fa0554b8e3c46290790e79ee38f isosurface.m: Update to new version of newplot(). * scripts/plot/isosurface.m: Update to new version of newplot(). Identify function in warning messages. diff --git a/scripts/plot/isosurface.m b/scripts/plot/isosurface.m --- a/scripts/plot/isosurface.m +++ b/scripts/plot/isosurface.m @@ -150,7 +150,7 @@ endif if (calc_colors) if (nargout == 2) - warning ( "Colors will be calculated, but you did not specify an output argument for it!" ); + warning ("isosurface: colors will be calculated, but no output argument to receive it."); endif [fvc.faces, fvc.vertices, fvc.facevertexcdata] = __marching_cube__ (x, y, z, val, iso, colors); else @@ -158,13 +158,13 @@ endif if (isempty (fvc.vertices) || isempty (fvc.faces)) - warning ( "The resulting triangulation is empty" ); + warning ("isosurface: triangulation is empty"); endif switch (nargout) case 0 ## plot the calculated surface - newplot (); + hax = newplot (); if (calc_colors) pa = patch ("Faces", fvc.faces, "Vertices", fvc.vertices, "FaceVertexCData", fvc.facevertexcdata, @@ -174,8 +174,8 @@ "FaceColor", "g", "EdgeColor", "k"); endif if (! ishold ()) - set (gca (), "view", [-37.5, 30], - "xgrid", "on", "ygrid", "on", "zgrid", "on"); + set (hax, "view", [-37.5, 30], + "xgrid", "on", "ygrid", "on", "zgrid", "on"); endif case 1 varargout = {fvc}; @@ -200,12 +200,14 @@ %! [x, y, z] = meshgrid (0:1, 0:1, 0:1); # Points for single %! val = [0, 0; 0, 0]; # cube and a 3-D %! val(:,:,2) = [0, 0; 1, 0]; # array of values + %!test %! fv = isosurface (x, y, z, val, 0.3); %! assert (isfield (fv, "vertices"), true); %! assert (isfield (fv, "faces"), true); %! assert (size (fv.vertices), [3 3]); %! assert (size (fv.faces), [1 3]); + %!test %! fvc = isosurface (x, y, z, val, .3, y); %! assert (isfield (fvc, "vertices"), true); @@ -214,10 +216,12 @@ %! assert (size (fvc.vertices), [3 3]); %! assert (size (fvc.faces), [1 3]); %! assert (size (fvc.facevertexcdata), [3 1]); + %!test %! [f, v] = isosurface (x, y, z, val, .3); %! assert (size (f), [1 3]); %! assert (size (v), [3 3]); + %!test %! [f, v, c] = isosurface (x, y, z, val, .3, y); %! assert (size (f), [1 3]);