1 ## Copyright (C) 2008-2012 Ben Abbott
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} {} comet (@var{y})
21 ## @deftypefnx {Function File} {} comet (@var{x}, @var{y})
22 ## @deftypefnx {Function File} {} comet (@var{x}, @var{y}, @var{p})
23 ## @deftypefnx {Function File} {} comet (@var{ax}, @dots{})
24 ## Produce a simple comet style animation along the trajectory provided by
25 ## the input coordinate vectors (@var{x}, @var{y}), where @var{x} will default
26 ## to the indices of @var{y}.
28 ## The speed of the comet may be controlled by @var{p}, which represents the
29 ## time which passes as the animation passes from one point to the next. The
30 ## default for @var{p} is 0.1 seconds.
32 ## If @var{ax} is specified the animation is produced in that axis rather than
36 ## Author: Ben Abbott bpabbott@mac.com
37 ## Created: 2008-09-21
39 function comet (varargin)
41 [h, varargin, nargin] = __plt_get_axis_arg__ ("comet", varargin{:});
63 theaxis = [min(x), max(x), min(y), max(y)];
70 h = plot (x(1:m), y(1:m), "r", x(m:k), y(m:k), "g", x(k), y(k), "ob");
75 unwind_protect_cleanup
84 %! x = cos(2*t).*(cos(t).^2);
85 %! y = sin(2*t).*(sin(t).^2);