Mercurial > hg > octave-lyh
changeset 17078:18137205f57d
isosurface.m: Update to new version of newplot().
* scripts/plot/isosurface.m: Update to new version of newplot().
Identify function in warning messages.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Jul 2013 23:12:46 -0700 |
parents | f8b485d09ac6 |
children | 7a67ab7c4771 |
files | scripts/plot/isosurface.m |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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]);