annotate scripts/plot/draw/quiver.m @ 32074:03fe0b635d2e

quiver/quiver3: Overhaul input processing, validation, and add BISTs. * scripts/plot/draw/private/__quiver__.m: Overhaul numeric input validation. Simplify input classification using numeric input count switch statements and avoid quiver3 miscount due to scale factor. Add error messages for all valid numeric input combinations including vector x,y,z and scale factor. Move newplot command from quiver/quiver3 into __quiver__ after numeric input validation. Add hax as an output argument to return any changes back to calling function. * scripts/plot/draw/quiver.m: Remove newplot call. Update __quiver__ call to include hax as a return variable. Update docstring with note that line style and name-value pairs can both be provided but linstyle must appear first. Add BISTs to check standard inputs with single and multiple arrows, arrowhead shape, vector and array inputs, proper treatment of scaling factor "off", some simple input styles, and input validation BISTs to cover all numeric input errors. Added known failing BIST for linestyle+pair arrowhead showing when it should stay off (bug #64143). * scripts/plot/draw/quiver3.m: Remove newplot call. Update __quiver__ call to include hax as a return variable. Update docstring with note that line style and name-value pairs can both be provided but linstyle must appear first. Add BISTs to check standard inputs with single and multiple arrows, vector and array inputs, and input validation BISTs to cover all numeric input errors. * etc/NEWS.9.md: Update quiver/quiver3 improvement description under General Improvements.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Wed, 03 May 2023 22:52:33 -0400
parents ada96a467a28
children 7dcb6b4a4218
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30564
diff changeset
3 ## Copyright (C) 2007-2023 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
7 ##
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
8 ## This file is part of Octave.
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22366
diff changeset
13 ## (at your option) any later version.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
14 ##
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22366
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22366
diff changeset
18 ## GNU General Public License for more details.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
19 ##
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
25
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
27 ## @deftypefn {} {} quiver (@var{u}, @var{v})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
28 ## @deftypefnx {} {} quiver (@var{x}, @var{y}, @var{u}, @var{v})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
29 ## @deftypefnx {} {} quiver (@dots{}, @var{s})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
30 ## @deftypefnx {} {} quiver (@dots{}, @var{style})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
31 ## @deftypefnx {} {} quiver (@dots{}, "filled")
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
32 ## @deftypefnx {} {} quiver (@var{hax}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
33 ## @deftypefnx {} {@var{h} =} quiver (@dots{})
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
34 ##
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
35 ## Plot a 2-D vector field with arrows.
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
36 ##
24381
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
37 ## Plot the (@var{u}, @var{v}) components of a vector field at the grid points
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
38 ## defined by (@var{x}, @var{y}). If the grid is uniform then @var{x} and
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
39 ## @var{y} can be specified as grid vectors and @code{meshgrid} is used to
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
40 ## create the 2-D grid.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
41 ##
24381
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
42 ## If @var{x} and @var{y} are not given they are assumed to be
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17070
diff changeset
43 ## @code{(1:@var{m}, 1:@var{n})} where
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17070
diff changeset
44 ## @code{[@var{m}, @var{n}] = size (@var{u})}.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
45 ##
24381
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
46 ## The optional input @var{s} is a scalar defining a scaling factor to use for
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
47 ## the arrows of the field relative to the mesh spacing. A value of 1.0 will
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
48 ## result in the longest vector exactly filling one grid square. A value of 0
32062
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
49 ## or "off" disables all scaling. The default value is 0.9.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
50 ##
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
51 ## The style to use for the plot can be defined with a line style, @var{style},
24381
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
52 ## of the same format as the @code{plot} command. If a marker is specified
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
53 ## then the markers are drawn at the origin of the vectors (which are the grid
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
54 ## points defined by @var{x} and @var{y}). When a marker is specified, the
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
55 ## arrowhead is not drawn. If the argument @qcode{"filled"} is given then the
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
56 ## markers are filled. If name-value plot style properties are used, they must
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
57 ## appear in pairs and follow any other plot style arguments.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
58 ##
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 24381
diff changeset
59 ## If the first argument @var{hax} is an axes handle, then plot into this axes,
17161
52931d71400f doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
60 ## rather than the current axes returned by @code{gca}.
52931d71400f doc: Document that first argument can be an axes handle for several plot functions.
Rik <rik@octave.org>
parents: 17122
diff changeset
61 ##
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
62 ## The optional return value @var{h} is a graphics handle to a quiver object.
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
63 ## A quiver object regroups the components of the quiver plot (body, arrow,
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
64 ## and marker), and allows them to be changed together.
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
65 ##
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
66 ## Example:
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
67 ##
7121
c0d9ac299176 [project @ 2007-11-07 21:32:57 by jwe]
jwe
parents: 7120
diff changeset
68 ## @example
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
69 ## @group
7121
c0d9ac299176 [project @ 2007-11-07 21:32:57 by jwe]
jwe
parents: 7120
diff changeset
70 ## [x, y] = meshgrid (1:2:20);
8056
9a6f4713f765 Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents: 7215
diff changeset
71 ## h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10));
9a6f4713f765 Add area, bar, quiver and stair series graphics objects. Document them
David Bateman <dbateman@free.fr>
parents: 7215
diff changeset
72 ## set (h, "maxheadsize", 0.33);
7121
c0d9ac299176 [project @ 2007-11-07 21:32:57 by jwe]
jwe
parents: 7120
diff changeset
73 ## @end group
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
74 ## @end example
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
75 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17070
diff changeset
76 ## @seealso{quiver3, compass, feather, plot}
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
77 ## @end deftypefn
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
78
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
79 function h = quiver (varargin)
7121
c0d9ac299176 [project @ 2007-11-07 21:32:57 by jwe]
jwe
parents: 7120
diff changeset
80
17070
d465f9970c02 quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
81 [hax, varargin, nargin] = __plt_get_axis_arg__ ("quiver", varargin{:});
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
82
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
83 if (nargin < 2)
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
84 print_usage ();
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
85 endif
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
86
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17161
diff changeset
87 oldfig = [];
17301
68bcac3c043a Correct inversion accidentally introduced in cset 87ba70043bfc.
Rik <rik@octave.org>
parents: 17281
diff changeset
88 if (! isempty (hax))
17211
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17161
diff changeset
89 oldfig = get (0, "currentfigure");
87ba70043bfc Don't use ifelse in plot fcns to avoid unnecessary fcn evaluations.
Rik <rik@octave.org>
parents: 17161
diff changeset
90 endif
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
91 unwind_protect
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
92 [hax, htmp] = __quiver__ (hax, false, varargin{:});
22366
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
93
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
94 ## FIXME: This should be moved into __quiver__ when problem with
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
95 ## re-initialization of title object is fixed.
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
96 if (! ishold ())
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
97 set (hax, "box", "on");
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
98 endif
837df5db5710 Make graphic functions visually compatible w/Matlab.
Rik <rik@octave.org>
parents: 22323
diff changeset
99
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
100 unwind_protect_cleanup
17070
d465f9970c02 quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
101 if (! isempty (oldfig))
d465f9970c02 quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
102 set (0, "currentfigure", oldfig);
d465f9970c02 quiver.m, quiver3.m: Upgrade to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 16814
diff changeset
103 endif
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
104 end_unwind_protect
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
105
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
106 if (nargout > 0)
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
107 h = htmp;
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
108 endif
7121
c0d9ac299176 [project @ 2007-11-07 21:32:57 by jwe]
jwe
parents: 7120
diff changeset
109
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
110 endfunction
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
111
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
112
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
113 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
114 %! clf;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
115 %! [x,y] = meshgrid (1:2:20);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
116 %! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10));
24381
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
117 %! title ("quiver() plot w/arrowheads (default)");
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
118
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
119 %!demo
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
120 %! clf;
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
121 %! [x,y] = meshgrid (1:2:20);
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
122 %! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10), "o");
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
123 %! title ("quiver() plot w/origin markers");
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
124
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
125 %!demo
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
126 %! clf;
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
127 %! [x,y] = meshgrid (1:2:20);
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
128 %! h = quiver (x,y, sin (2*pi*x/10), sin (2*pi*y/10));
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
129 %! set (h, "marker", "o");
6915cc404dba doc: Clarify quiver/quiver3 documentation when a linestyle is given (bug #52608).
Rik <rik@octave.org>
parents: 23219
diff changeset
130 %! title ("quiver() plot w/origin markers and arrowheads");
7120
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
131
a2174fb073d4 [project @ 2007-11-07 21:26:43 by jwe]
jwe
parents:
diff changeset
132 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
133 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
134 %! x = linspace (0, 3, 80);
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
135 %! y = sin (2*pi*x);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
136 %! theta = 2*pi*x + pi/2;
17671
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
137 %! quiver (x, y, sin (theta)/10, cos (theta)/10, 0.4);
ddfc1600a311 Overhaul quiver/quiver3 functions.
Rik <rik@octave.org>
parents: 17572
diff changeset
138 %! axis equal tight;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
139 %! hold on; plot (x,y,"r"); hold off;
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
140 %! title ("quiver() with scaled arrows");
32044
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
141
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
142 ## Check standard inputs, single arrow.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
143 %!test
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
144 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
145 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
146 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
147 %! h = quiver (hax, 1, 2);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
148 %! childxdata = get (get (h, "children"), "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
149 %! stemchild = find (cellfun (@numel, childxdata) == 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
150 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
151 %! assert (childxdata{stemchild}(1), 1, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
152 %! assert (childxdata{stemchild}(2), 1 + 1*0.9, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
153 %! assert (isnan (childxdata{stemchild}(3)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
154 %! assert (childxdata{arrowheadchild}(2), 1 + 1*0.9, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
155 %! assert (isnan (childxdata{arrowheadchild}(4)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
156 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
157 %! h = quiver (hax, 1, 2, 0.5);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
158 %! childxdata = get (get (h, "children"), "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
159 %! stemchild = find (cellfun (@numel, childxdata) == 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
160 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
161 %! assert (childxdata{stemchild}(1), 1, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
162 %! assert (childxdata{stemchild}(2), 1 + 1*0.5, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
163 %! assert (isnan (childxdata{stemchild}(3)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
164 %! assert (childxdata{arrowheadchild}(2), 1 + 1*0.5, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
165 %! assert (isnan (childxdata{arrowheadchild}(4)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
166 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
167 %! h = quiver (hax, 0, 1, 2, 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
168 %! childxdata = get (get (h, "children"), "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
169 %! stemchild = find (cellfun (@numel, childxdata) == 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
170 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
171 %! assert (childxdata{stemchild}(1), 0, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
172 %! assert (childxdata{stemchild}(2), 0 + 2*0.9, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
173 %! assert (isnan (childxdata{stemchild}(3)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
174 %! assert (childxdata{arrowheadchild}(2), 0 + 2*0.9, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
175 %! assert (isnan (childxdata{arrowheadchild}(4)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
176 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
177 %! h = quiver (hax, 0, 1, 2, 3, 0.5);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
178 %! childxdata = get (get (h, "children"), "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
179 %! stemchild = find (cellfun (@numel, childxdata) == 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
180 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
181 %! assert (childxdata{stemchild}(1), 0, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
182 %! assert (childxdata{stemchild}(2), 0 + 2*0.5, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
183 %! assert (isnan (childxdata{stemchild}(3)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
184 %! assert (childxdata{arrowheadchild}(2), 0 + 2*0.5, eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
185 %! assert (isnan (childxdata{arrowheadchild}(4)));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
186 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
187 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
188 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
189 %! end_unwind_protect
32044
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
190
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
191 ## Check arrowhead size
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
192 %!test
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
193 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
194 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
195 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
196 %! h = quiver (hax, 0, 0, 0, 1, 1); # up
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
197 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
198 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
199 %! childydata = get (children, "ydata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
200 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
201 %! assert (childxdata{arrowheadchild}, [1/9 0 -1/9 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
202 %! assert (childydata{arrowheadchild}, [2/3 1 2/3 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
203 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
204 %! h = quiver (hax, 0, 0, 0, -1, 1); # down
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
205 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
206 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
207 %! childydata = get (children, "ydata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
208 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
209 %! assert (childxdata{arrowheadchild}, [-1/9 0 1/9 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
210 %! assert (childydata{arrowheadchild}, [-2/3 -1 -2/3 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
211 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
212 %! h = quiver (hax, 0, 0, -1, 0, 1); # left
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
213 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
214 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
215 %! childydata = get (children, "ydata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
216 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
217 %! assert (childxdata{arrowheadchild}, [-2/3 -1 -2/3 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
218 %! assert (childydata{arrowheadchild}, [1/9 0 -1/9 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
219 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
220 %! h = quiver (hax, 0, 0, 1, 0, 1); # right
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
221 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
222 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
223 %! childydata = get (children, "ydata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
224 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
225 %! assert (childxdata{arrowheadchild}, [2/3 1 2/3 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
226 %! assert (childydata{arrowheadchild}, [-1/9 0 1/9 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
227 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
228 %! h = quiver (hax, 0, 0, 1, 1, 1); # 45 deg - symmetric
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
229 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
230 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
231 %! childydata = get (children, "ydata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
232 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
233 %! assert (childxdata{arrowheadchild}, [7/9 1 5/9 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
234 %! assert (childydata{arrowheadchild}, [5/9 1 7/9 NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
235 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
236 %! h = quiver (hax, 0, 0, sqrt(3), 1, 1); # 30 deg
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
237 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
238 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
239 %! childydata = get (children, "ydata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
240 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
241 %! assert (childxdata{arrowheadchild}, [(6*sqrt(3)+1)/9, sqrt(3), (6*sqrt(3)-1)/9, NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
242 %! assert (childydata{arrowheadchild}, [(6-sqrt(3))/9, 1, (6+sqrt(3))/9, NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
243 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
244 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
245 %! end_unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
246
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
247 ## Check standard inputs, multiple arrows.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
248 %!test
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
249 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
250 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
251 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
252 %! [x,y] = meshgrid (0:1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
253 %! u = [0 1; 1 -2];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
254 %! v = [1 0; 1 -2];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
255 %! numpts = 4;
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
256 %! h = quiver (hax, u, v, 1); # assumes [x,y] = meshgrid (1:2)
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
257 %! childxdata = get (get (h, "children"), "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
258 %! basechild = find (cellfun (@numel, childxdata) == 1*numpts);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
259 %! stemchild = find (cellfun (@numel, childxdata) == 3*numpts);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
260 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4*numpts);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
261 %! assert (childxdata{basechild}, [1 1 2 2]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
262 %! assert (childxdata{stemchild}, [1,1,NaN,1,1.25,NaN,2,2.25,NaN,2,1.5,NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
263 %! assert (childxdata{arrowheadchild}([2, 6, 10, 14]), [1, 1.25, 2.25, 1.5], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
264 %! assert (childxdata{arrowheadchild}([4, 8, 12, 16]), NaN(1,4), eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
265 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
266 %! h = quiver (hax, x, y, u, v, 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
267 %! childxdata = get (get (h, "children"), "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
268 %! basechild = find (cellfun (@numel, childxdata) == 1*numpts);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
269 %! stemchild = find (cellfun (@numel, childxdata) == 3*numpts);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
270 %! arrowheadchild = find (cellfun (@numel, childxdata) == 4*numpts);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
271 %! assert (childxdata{basechild}, [0 0 1 1]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
272 %! assert (childxdata{stemchild}, [0,0,NaN,0,0.25,NaN,1,1.25,NaN,1,0.5,NaN], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
273 %! assert (childxdata{arrowheadchild}([2, 6, 10, 14]), [0, 0.25, 1.25, 0.5], eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
274 %! assert (childxdata{arrowheadchild}([4, 8, 12, 16]), NaN(1,4), eps);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
275 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
276 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
277 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
278 %! end_unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
279
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
280 ## Check multiple arrows, vector inputs identical to array inputs.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
281 %!test
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
282 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
283 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
284 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
285 %! [x,y] = meshgrid (0:1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
286 %! u = [0 1; 1 -2];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
287 %! v = [1 0; 1 -2];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
288 %! h = quiver (hax, x, y, u, v, 1); # arrayinput
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
289 %! haxarray = get(hax);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
290 %! haxarray.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
291 %! haxarray.xlabel = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
292 %! haxarray.ylabel = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
293 %! haxarray.zlabel = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
294 %! haxarray.title = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
295 %! parentarray = get(h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
296 %! parentarray.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
297 %! childrenarray = get (get (h, "children"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
298 %! [childrenarray.parent] = deal ([]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
299 %! h = quiver (hax, [0:1], [0:1], u, v, 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
300 %! haxvect1 = get(hax);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
301 %! haxvect1.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
302 %! haxvect1.xlabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
303 %! haxvect1.ylabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
304 %! haxvect1.zlabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
305 %! haxvect1.title= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
306 %! parentvect1 = get(h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
307 %! parentvect1.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
308 %! childrenvect1 = get (get (h, "children"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
309 %! [childrenvect1.parent] = deal ([]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
310 %! assert (isequaln (haxarray, haxvect1));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
311 %! assert (isequaln (parentarray, parentvect1));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
312 %! assert (isequaln (childrenarray, childrenvect1));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
313 %! h = quiver (hax, [0:1], [0:1]', u, v, 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
314 %! haxvect2 = get(hax);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
315 %! haxvect2.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
316 %! haxvect2.xlabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
317 %! haxvect2.ylabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
318 %! haxvect2.zlabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
319 %! haxvect2.title= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
320 %! parentvect2 = get(h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
321 %! parentvect2.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
322 %! childrenvect2 = get (get (h, "children"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
323 %! [childrenvect2.parent] = deal ([]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
324 %! assert (isequaln (haxvect1, haxvect2));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
325 %! assert (isequaln (parentvect1, parentvect2));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
326 %! assert (isequaln (childrenvect1, childrenvect2));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
327 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
328 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
329 %! end_unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
330
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
331 ## Check scale factor "off" is identical to scale factor = 0.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
332 %!test
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
333 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
334 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
335 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
336 %! h = quiver (hax, 1, 2, 0);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
337 %! haxzero = get(hax);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
338 %! haxzero.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
339 %! haxzero.xlabel = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
340 %! haxzero.ylabel = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
341 %! haxzero.zlabel = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
342 %! haxzero.title = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
343 %! parentzero = get(h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
344 %! parentzero.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
345 %! childrenzero = get (get (h, "children"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
346 %! [childrenzero.parent] = deal ([]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
347 %! h = quiver (hax, 1, 2, "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
348 %! haxoff = get(hax);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
349 %! haxoff.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
350 %! haxoff.xlabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
351 %! haxoff.ylabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
352 %! haxoff.zlabel= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
353 %! haxoff.title= [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
354 %! parentoff = get(h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
355 %! parentoff.children = [];
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
356 %! childrenoff = get (get (h, "children"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
357 %! [childrenoff.parent] = deal ([]);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
358 %! assert (isequaln (haxzero, haxoff));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
359 %! assert (isequaln (parentzero, parentoff));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
360 %! assert (isequaln (childrenzero, childrenoff));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
361 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
362 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
363 %! end_unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
364
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
365 ## Check input styles.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
366 %!test
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
367 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
368 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
369 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
370 %! h = quiver (hax, 0, 1, 2, 3, "-o"); # Linestyle
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
371 %! parent = get (h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
372 %! assert (strcmp (parent.marker, "o"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
373 %! assert (strcmp (parent.markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
374 %! childdata = get (parent.children);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
375 %! basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
376 %! arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
377 %! assert (strcmp (childdata(basechild).marker, "o"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
378 %! assert (strcmp (childdata(basechild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
379 %! assert (strcmp (childdata(basechild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
380 %! assert (strcmp (childdata(arrowheadchild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
381 %! assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
382 %! assert (strcmp (childdata(arrowheadchild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
383 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
384 %! h = quiver (hax, 0, 1, 2, 3, "-o", "filled"); # Linestyle + filled.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
385 %! parent = get (h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
386 %! assert (strcmp (parent.marker, "o"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
387 %! assert (numel (parent.markerfacecolor), 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
388 %! childdata = get (parent.children);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
389 %! basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
390 %! arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
391 %! assert (strcmp (childdata(basechild).marker, "o"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
392 %! assert (numel (childdata(basechild).markerfacecolor), 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
393 %! assert (strcmp (childdata(basechild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
394 %! assert (strcmp (childdata(arrowheadchild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
395 %! assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
396 %! assert (strcmp (childdata(arrowheadchild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
397 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
398 %! h = quiver (hax, 0, 1, 2, 3, "linewidth", 10); # Name/value pair.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
399 %! parent = get (h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
400 %! assert (strcmp (parent.marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
401 %! assert (strcmp (parent.markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
402 %! assert (strcmp (parent.linestyle, "-"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
403 %! assert (parent.linewidth, 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
404 %! childdata = get (parent.children);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
405 %! basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
406 %! stemchild = find (cellfun (@numel, {childdata.xdata}) == 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
407 %! arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
408 %! assert (strcmp (childdata(basechild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
409 %! assert (strcmp (childdata(basechild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
410 %! assert (strcmp (childdata(basechild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
411 %! assert (strcmp (childdata(stemchild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
412 %! assert (strcmp (childdata(stemchild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
413 %! assert (strcmp (childdata(stemchild).linestyle, "-"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
414 %! assert (childdata(stemchild).linewidth, 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
415 %! assert (strcmp (childdata(arrowheadchild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
416 %! assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
417 %! assert (strcmp (childdata(arrowheadchild).linestyle, "-"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
418 %! assert (childdata(arrowheadchild).linewidth, 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
419 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
420 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
421 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
422 %! end_unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
423
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
424 ## Test both Linestyle + name/value pair
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
425 %!test <64143>
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
426 %! hf = figure ("visible", "off");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
427 %! hax = gca();
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
428 %! unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
429 %! h = quiver (hax, 0, 1, 2, 3, "-o", "linewidth", 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
430 %! parent = get (h);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
431 %! assert (strcmp (parent.marker, "o"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
432 %! assert (strcmp (parent.markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
433 %! assert (strcmp (parent.linestyle, "-"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
434 %! assert (parent.linewidth, 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
435 %! childdata = get (parent.children);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
436 %! basechild = find (cellfun (@numel, {childdata.xdata}) == 1);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
437 %! stemchild = find (cellfun (@numel, {childdata.xdata}) == 3);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
438 %! arrowheadchild = find (cellfun (@numel, {childdata.xdata}) == 4);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
439 %! assert (strcmp (childdata(basechild).marker, "o"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
440 %! assert (strcmp (childdata(basechild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
441 %! assert (strcmp (childdata(basechild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
442 %! assert (strcmp (childdata(stemchild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
443 %! assert (strcmp (childdata(stemchild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
444 %! assert (strcmp (childdata(stemchild).linestyle, "-"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
445 %! assert (childdata(stemchild).linewidth, 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
446 %! assert (strcmp (childdata(arrowheadchild).marker, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
447 %! assert (strcmp (childdata(arrowheadchild).markerfacecolor, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
448 %! assert (strcmp (childdata(arrowheadchild).linestyle, "none"));
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
449 %! assert (childdata(arrowheadchild).linewidth, 10);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
450 %!
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
451 %! unwind_protect_cleanup
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
452 %! close (hf);
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
453 %! end_unwind_protect
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
454
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
455 ## Check arrow length, scale factor adjustment, one arrow.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
456 %!test <*39552>
32044
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
457 %! hf = figure ("visible", "off");
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
458 %! hax = gca ();
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
459 %! unwind_protect
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
460 %! [x,y] = meshgrid (1:2);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
461 %! u = [0 1; 2 3];
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
462 %! v = [1 2; 3 4];
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
463 %! numpts = numel (x);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
464 %! sf = 0.5;
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
465 %!
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
466 %! ## Check single arrow.
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
467 %! h = quiver (hax, x(4), y(4), u(4), v(4), 1);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
468 %! childxdata = get (get (h, "children"), "xdata");
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
469 %! stemchild = find (cellfun (@numel, childxdata) == 3);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
470 %! xendpoint = childxdata{stemchild}(2);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
471 %! assert (xendpoint, x(4) + u(4), eps);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
472 %!
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
473 %! h = quiver (hax, x(4), y(4), u(4), v(4), sf);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
474 %! childxdata = get (get (h, "children"), "xdata");
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
475 %! stemchild = find (cellfun (@numel, childxdata) == 3);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
476 %! xendpoint = childxdata{stemchild}(2);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
477 %! assert (xendpoint, x(4) + sf*u(4), eps);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
478 %!
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
479 %! unwind_protect_cleanup
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
480 %! close (hf);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
481 %! end_unwind_protect
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
482
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
483 ## Check arrow length, scale factor adjustment, multiple arrows.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
484 %!test <*39552>
32044
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
485 %! hf = figure ("visible", "off");
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
486 %! hax = gca ();
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
487 %! unwind_protect
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
488 %! [x,y] = meshgrid (1:2);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
489 %! u = [0 1; 2 3];
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
490 %! v = [1 2; 3 4];
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
491 %! numpts = numel (x);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
492 %! sf = 0.5;
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
493 %!
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
494 %! ## Check multiple arrows.
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
495 %! h = quiver (hax, x, y, u, v, 1);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
496 %! childxdata = get (get (h, "children"), "xdata");
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
497 %! stemchild = find (cellfun (@numel, childxdata) == 3*numpts);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
498 %! xendpoint1 = childxdata{stemchild}(5);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
499 %! xendpoint2 = childxdata{stemchild}(11);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
500 %! assert (xendpoint1, x(2) + (sqrt(2)/10)*u(2), eps);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
501 %! assert (xendpoint2, x(4) + (sqrt(2)/10)*u(4), eps);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
502 %!
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
503 %! h = quiver (hax, x, y, u, v, sf);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
504 %! childxdata = get (get (h, "children"), "xdata");
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
505 %! stemchild = find (cellfun (@numel, childxdata) == 3*numpts);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
506 %! xendpoint1 = childxdata{stemchild}(5);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
507 %! xendpoint2 = childxdata{stemchild}(11);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
508 %! assert (xendpoint1, x(2) + sf*(sqrt(2)/10)*u(2), eps);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
509 %! assert (xendpoint2, x(4) + sf*(sqrt(2)/10)*u(4), eps);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
510 %!
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
511 %! unwind_protect_cleanup
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
512 %! close (hf);
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
513 %! end_unwind_protect
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
514
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
515 ## Check for proper plotting with non-float inputs.
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
516 %!test <*59695>
32062
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
517 %! hf = figure ("visible", "off");
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
518 %! hax = gca ();
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
519 %! unwind_protect
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
520 %! h = quiver (int32(1), int32(1), int32(1), int32(1), double(0.5));
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
521 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
522 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
523 %! childydata = get (children, "ydata");
32062
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
524 %! assert (all (strcmp (cellfun (...
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
525 %! 'class', childxdata, 'UniformOutput', false), "double")));
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
526 %! assert (all (strcmp (cellfun (...
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
527 %! 'class', childydata, 'UniformOutput', false), "double")));
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
528 %! assert (childxdata{2}(2) , 1.5, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
529 %! assert (childxdata{3}(2) , 1.5, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
530 %! assert (childydata{2}(2) , 1.5, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
531 %! assert (childydata{3}(2) , 1.5, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
532 %!
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
533 %! h = quiver (0.5, 0.5, 0.5, 0.5, int32(1));
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
534 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
535 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
536 %! childydata = get (children, "ydata");
32062
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
537 %! assert (all (strcmp (cellfun (...
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
538 %! 'class', childxdata, 'UniformOutput', false), "double")));
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
539 %! assert (all (strcmp (cellfun (...
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
540 %! 'class', childydata, 'UniformOutput', false), "double")));
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
541 %! assert (childxdata{2}(2) , 1, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
542 %! assert (childxdata{3}(2) , 1, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
543 %! assert (childydata{2}(2) , 1, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
544 %! assert (childydata{3}(2) , 1, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
545 %!
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
546 %! h = quiver (false, true, false, true, true);
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
547 %! children = get (h, "children");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
548 %! childxdata = get (children, "xdata");
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
549 %! childydata = get (children, "ydata");
32062
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
550 %! assert (all (strcmp (cellfun (...
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
551 %! 'class', childxdata, 'UniformOutput', false), "double")));
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
552 %! assert (all (strcmp (cellfun (...
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
553 %! 'class', childydata, 'UniformOutput', false), "double")));
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
554 %! assert (childxdata{2}(2) , 0, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
555 %! assert (childxdata{3}(2) , 0, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
556 %! assert (childydata{2}(2) , 2, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
557 %! assert (childydata{3}(2) , 2, eps);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
558 %!
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
559 %! unwind_protect_cleanup
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
560 %! close (hf);
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
561 %! end_unwind_protect
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
562
32044
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
563 ## Test input validation
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
564 %!error <Invalid call> quiver()
32062
ada96a467a28 quiver: Improve plotting with non-float numeric inputs (bug #59695)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32044
diff changeset
565 %!error <Invalid call> quiver(1.1)
32074
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
566 %!error <Invalid call> quiver(1.1, "foo")
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
567 %!error <Invalid call> quiver(1.1, 2, 3, 4, 5, 6, "foo")
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
568 %!error <U and V must be the same size> quiver ([1, 2], 3)
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
569 %!error <U and V must be the same size> quiver (1.1, [2, 3])
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
570 %!error <U and V must be the same size> quiver (1.1, 2, eye(2), 4)
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
571 %!error <U and V must be the same size> quiver (1.1, 2, 3, eye(2))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
572 %!error <X vector length must equal> quiver (1.1, [2 3], eye(2), eye(2))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
573 %!error <Y vector length must equal> quiver ([1, 2], 3, eye(2), eye(2))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
574 %!error <X, Y, U, and V must be the same size> quiver (eye(3), eye(2), eye(2), eye(2))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
575 %!error <X, Y, U, and V must be the same size> quiver (eye(2), eye(3), eye(2), eye(2))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
576 %!error <X, Y, U, and V must be the same size> quiver (eye(2), eye(2), eye(3), eye(2))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
577 %!error <X, Y, U, and V must be the same size> quiver (eye(2), eye(2), eye(2), eye(3))
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
578 %!error <scaling factor must be> quiver (10, 20, -5)
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
579 %!error <scaling factor must be> quiver (10, 20, [1 2])
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
580 %!error <scaling factor must be> quiver (10, 20, 30, 40, -5)
03fe0b635d2e quiver/quiver3: Overhaul input processing, validation, and add BISTs.
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 32062
diff changeset
581 %!error <scaling factor must be> quiver (10, 20, 30, 40, [1 2])
32044
31f7f5359ba2 quiver: Add scale factor and input validation BISTs (bug #39552)
Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
parents: 31706
diff changeset
582