view scripts/plot/util/rotate3d.m @ 19152:0f9c5a15c8fa

doc: Periodic grammarcheck of documentation. * doc/interpreter/contrib.txi, doc/interpreter/expr.txi, doc/interpreter/func.txi, doc/interpreter/linalg.txi, doc/interpreter/plot.txi, libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/help.cc, libinterp/corefcn/load-save.cc, libinterp/corefcn/profiler.cc, libinterp/corefcn/syscalls.cc, libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc, libinterp/dldfcn/__init_fltk__.cc, scripts/general/deal.m, scripts/help/__gripe_missing_component__.m, scripts/miscellaneous/desktop.m, scripts/pkg/private/default_prefix.m, scripts/plot/appearance/__getlegenddata__.m, scripts/plot/util/pan.m, scripts/plot/util/rotate.m, scripts/plot/util/rotate3d.m, scripts/plot/util/zoom.m, scripts/signal/periodogram.m, scripts/specfun/factor.m, scripts/specfun/primes.m, scripts/statistics/base/lscov.m, scripts/testfun/private/compare_plot_demos.m, scripts/testfun/private/dump_demos.m, scripts/testfun/private/html_compare_plot_demos.m, scripts/testfun/test.m: Periodic grammarcheck of documentation.
author Rik <rik@octave.org>
date Mon, 22 Sep 2014 20:46:54 -0700
parents 8a6f87637c16
children dfea01b3425f
line wrap: on
line source

## Copyright (C) 2014 Andreas Weber
##
## This file is part of Octave.
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or (at
## your option) any later version.
##
## Octave is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING.  If not, see
## <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Command} {} rotate3d
## @deftypefnx {Command} {} rotate3d on
## @deftypefnx {Command} {} rotate3d off
## @deftypefnx {Function File} {} rotate3d (@var{hax}, @dots{})
## Control 3-D rotation mode of interactive graph in GUI.
##
## The function state input may be either @qcode{"on"} or @qcode{"off"}
## and can only be set for 3-D plots.
##
## If the first argument @var{hax} is an axes handle, then operate on
## this axis rather than the current axes returned by @code{gca}.
##
## To query the current mode use the @code{get} function.  For example:
##
## @example
## mode = get (gca, "rotate3d");
## @end example
## @seealso{pan, zoom}
## @end deftypefn

function rotate3d (varargin)

  if (numel (varargin) > 0 && isaxes (varargin{1}))
    hax = varargin{1};
    varargin(1) = [];
  else
    hax = gca ();
  endif

  toolkit = get (ancestor (hax, "figure"), "__graphics_toolkit__");
  if (! strcmp (toolkit, "fltk"))
    warning ("rotate3d: Only implemented for graphics_toolkit FLTK");
  endif

  ndims = __calc_dimensions__ (hax);
  if (ndims == 2)
    warning ("rotate3d: Only available for 3D plots");
  else
    if (numel (varargin) > 1)
      print_usage ();
    elseif (numel (varargin) == 0)
      # toggle
      m = get (hax, "pan");
      if (strcmp (get (hax, "rotate3d"), "on"))
        set (hax, "rotate3d", "off");
      else
        set (hax, "rotate3d", "on");
      endif
    elseif (numel (varargin) == 1)
      set (hax, "rotate3d", varargin{1});
    endif
  endif

endfunction