changeset 33456:f3376b536969 bytecode-interpreter

maint: Merge default to bytecode-interpreter.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Thu, 25 Apr 2024 10:33:46 -0400
parents 6993450e2f71 (current diff) c224e1a810d6 (diff)
children d9edf5bc95c7
files
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/view.m	Wed Apr 24 18:31:26 2024 -0400
+++ b/scripts/plot/appearance/view.m	Thu Apr 25 10:33:46 2024 -0400
@@ -66,6 +66,8 @@
     vw = get (hax, "view");
     az = vw(1);
     el = vw(2);
+  elseif (nargout > 0)
+    error ("view: cannot simultaneously get and set viewpoint");
   elseif (numel (varargin) == 1)
     x = varargin{1};
     if (numel (x) == 2)
@@ -135,5 +137,38 @@
 %!   close (hf);
 %! end_unwind_protect
 
+%!test <*57800>
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   view (3);
+%!   view ([0, 0, 1]);
+%!   [az, el] = view ();
+%!   assert ([az, el], [0, 90], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test <65641>
+%! hf = figure ("visible", "off");
+%! unwind_protect
+%!   plot3 ([0,1], [0,1], [0,1]);
+%!   view (3);
+%!   view ([0, -1, 0]);
+%!   [az, el] = view ();
+%!   assert ([az, el], [0, 0], eps);
+%!   view (3);
+%!   view ([1, 0, 0]);
+%!   [az, el] = view ();
+%!   assert ([az, el], [90, 0], eps);
+%!   view (3);
+%!   view ([1, 0.001, 0]);
+%!   [az, el] = view ();
+%!   assert ([az, el], [0, 90 + 0.001*180/pi], eps);
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
 ## Test input validation
 %!error <Invalid call> view (0, 0, 1)
+%!error <cannot simultaneously get and set> [a, b] = view ([1, 1, 1])