1 ## Copyright (C) 2010-2012 Ben Abbott and John W. Eaton
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} comet3 (@var{z})
21 ## @deftypefnx {Function File} {} comet3 (@var{x}, @var{y}, @var{z}, @var{p})
22 ## @deftypefnx {Function File} {} comet3 (@var{ax}, @dots{})
23 ## Produce a simple comet style animation along the trajectory provided by
24 ## the input coordinate vectors (@var{x}, @var{y}), where @var{x} will default
25 ## to the indices of @var{y}.
27 ## The speed of the comet may be controlled by @var{p}, which represents the
28 ## time which passes as the animation passes from one point to the next. The
29 ## default for @var{p} is 0.1 seconds.
31 ## If @var{ax} is specified the animation is produced in that axis rather than
36 ## Created: 2010-12-17
38 function comet3 (varargin)
40 [h, varargin, nargin] = __plt_get_axis_arg__ ("comet3", varargin{:});
42 if (nargin == 0 || nargin == 2 || nargin > 4)
64 theaxis = [min(x), max(x), min(y), max(y), min(z), max(z)];
71 h = plot3 (x(1:m), y(1:m), z(1:m), "r", x(m:k), y(m:k), z(m:k), "g",
72 x(k), y(k), z(k), "ob");
77 unwind_protect_cleanup
86 %! comet3 (cos(t), sin(t), t, 0.01);