Mercurial > octave
annotate scripts/plot/draw/streamtube.m @ 28896:90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
* acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m,
asecd.m, asech.m, asind.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m,
cscd.m, csch.m, sec.m, secd.m, sech.m, sind.m, tand.m, cart2pol.m, cart2sph.m,
celldisp.m, common_size.m, deal.m, del2.m, fliplr.m, integral2.m, interp1.m,
isequal.m, isequaln.m, nextpow2.m, pol2cart.m, quad2d.m, quadl.m, quadv.m,
randi.m, rat.m, repelem.m, rescale.m, shiftdim.m, sortrows.m, sph2cart.m,
xor.m, convhull.m, delaunay.m, delaunayn.m, griddata.m, griddatan.m,
inpolygon.m, voronoi.m, voronoin.m, listdlg.m, msgbox.m, questdlg.m,
rmappdata.m, setappdata.m, __gripe_missing_component__.m,
get_first_help_sentence.m, type.m, which.m, cmpermute.m, cmunique.m,
gray2ind.m, imfinfo.m, imshow.m, imwrite.m, ind2rgb.m, movie.m, rgb2ind.m,
importdata.m, bandwidth.m, condeig.m, gls.m, housh.m, linsolve.m, logm.m,
lscov.m, normest.m, normest1.m, ols.m, ordeig.m, planerot.m, qzhess.m, rref.m,
copyfile.m, delete.m, dos.m, fileparts.m, getfield.m, menu.m, mkdir.m,
movefile.m, orderfields.m, publish.m, setfield.m, substruct.m, unix.m,
unpack.m, decic.m, ode23.m, ode23s.m, ode45.m, fminsearch.m, lsqnonneg.m,
pqpnonneg.m, sqp.m, annotation.m, lighting.m, shading.m, area.m, compass.m,
contourc.m, feather.m, fplot.m, hist.m, isocaps.m, isocolors.m, isonormals.m,
isosurface.m, ostreamtube.m, pie.m, pie3.m, reducepatch.m, reducevolume.m,
rose.m, smooth3.m, stairs.m, stem.m, stem3.m, stream2.m, stream3.m,
streamline.m, streamribbon.m, streamtube.m, surfnorm.m, trimesh.m, trisurf.m,
colstyle.m, hgload.m, linkprop.m, meshgrid.m, ndgrid.m, padecoef.m, polyfit.m,
polyval.m, unmkpp.m, profexport.m, ismember.m, unique.m, movfun.m, movslice.m,
periodogram.m, sinc.m, spdiags.m, sprandsym.m, betaincinv.m, ellipke.m,
factor.m, gammainc.m, gammaincinv.m, isprime.m, lcm.m, gallery.m, hadamard.m,
bounds.m, corrcoef.m, discrete_rnd.m, empirical_rnd.m, histc.m, mode.m,
movmad.m, movmax.m, movmean.m, movmedian.m, movmin.m, movprod.m, movstd.m,
movsum.m, movvar.m, ranks.m, runlength.m, zscore.m, str2num.m, strchr.m,
strsplit.m, strtok.m, untabify.m, assert.m, demo.m, example.m, speed.m, test.m,
datenum.m, datevec.m, webread.m, webwrite.m:
Add expected error message <Invalid call> to BIST tests for nargin.
Remove redundant tests for nargin greater than the number of declared inputs
which are now handled by interpreter.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 11 Oct 2020 21:59:35 -0700 |
parents | 8a9a041db1dc |
children | 3c37ae43996a |
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 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2019-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27810
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/>. |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
7 ## |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
9 ## |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
13 ## (at your option) any later version. |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
14 ## |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
18 ## GNU General Public License for more details. |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
19 ## |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
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 ######################################################################## |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
25 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
27 ## @deftypefn {} {} streamtube (@var{x}, @var{y}, @var{z}, @var{u}, @var{v}, @var{w}, @var{sx}, @var{sy}, @var{sz}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
28 ## @deftypefnx {} {} streamtube (@var{u}, @var{v}, @var{w}, @var{sx}, @var{sy}, @var{sz}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
29 ## @deftypefnx {} {} streamtube (@var{xyz}, @var{x}, @var{y}, @var{z}, @var{div}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
30 ## @deftypefnx {} {} streamtube (@var{xyz}, @var{div}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
31 ## @deftypefnx {} {} streamtube (@var{xyz}, @var{dia}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
32 ## @deftypefnx {} {} streamtube (@dots{}, @var{options}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
33 ## @deftypefnx {} {} streamtube (@var{hax}, @dots{}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
34 ## @deftypefnx {} {@var{h} =} streamtube (@dots{}) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
35 ## Plot tubes scaled by the divergence along streamlines. |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
36 ## |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
37 ## @code{streamtube} draws tubes whose diameter is scaled by the divergence of |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
38 ## a vector field. The vector field is given by |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
39 ## @code{[@var{u}, @var{v}, @var{w}]} and is defined over a rectangular grid |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
40 ## given by @code{[@var{x}, @var{y}, @var{z}]}. The tubes start at the |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
41 ## seed points @code{[@var{sx}, @var{sy}, @var{sz}]} and are plot along |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
42 ## streamlines. |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
43 ## |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
44 ## @code{streamtube} can also be called with a cell array containing |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
45 ## pre-computed streamline data. To do this, @var{xyz} must be created with |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
46 ## the @code{stream3} command. @var{div} is used to scale the tubes. |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
47 ## In order to plot tubes scaled by the vector field divergence, @var{div} |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
48 ## must be calculated with the @code{divergence} command. |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
49 ## |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
50 ## A tube diameter of zero corresponds to the smallest scaling value along the |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
51 ## streamline and the largest tube diameter corresponds to the largest scaling |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
52 ## value. |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
53 ## |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
54 ## It is also possible to draw a tube along an arbitrary array of vertices |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
55 ## @var{xyz}. The tube diameter can be specified by the vertex array @var{dia} |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
56 ## or by a constant. |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
57 ## |
27794
45ad2127582b
doc: grammarcheck scripts before 6.1 release.
Rik <rik@octave.org>
parents:
27759
diff
changeset
|
58 ## The input parameter @var{options} is a 2-D vector of the form |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
59 ## @code{[@var{scale}, @var{n}]}. The first parameter scales the tube |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
60 ## diameter (default 1). The second parameter specifies the number of vertices |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
61 ## that are used to construct the tube circumference (default 20). |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
62 ## |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
63 ## If the first argument @var{hax} is an axes handle, then plot into this axes, |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
64 ## rather than the current axes returned by @code{gca}. |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
65 ## |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
66 ## The optional return value @var{h} is a graphics handle to the plot objects |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
67 ## created for each tube. |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
68 ## |
28386
8a9a041db1dc
Add "streamribbon" function (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28385
diff
changeset
|
69 ## @seealso{stream3, streamline, streamribbon, ostreamtube} |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
70 ## @end deftypefn |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
71 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
72 function h = streamtube (varargin) |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
73 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
74 [hax, varargin, nargin] = __plt_get_axis_arg__ ("streamtube", varargin{:}); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
75 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
76 options = []; |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
77 xyz = []; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
78 div = []; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
79 dia = []; |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
80 switch (nargin) |
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
81 case 0 |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
82 print_usage (); |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
83 case 2 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
84 ## "dia" can be a cell array or a constant |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
85 if (iscell (varargin{2}) || numel (varargin{2}) == 1) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
86 [xyz, dia] = varargin{:}; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
87 else |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
88 [xyz, div] = varargin{:}; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
89 [m, n, p] = size (div); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
90 [x, y, z] = meshgrid (1:n, 1:m, 1:p); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
91 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
92 case 3 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
93 if (iscell (varargin{2})) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
94 [xyz, dia, options] = varargin{:}; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
95 else |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
96 [xyz, div, options] = varargin{:}; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
97 [m, n, p] = size (div); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
98 [x, y, z] = meshgrid (1:n, 1:m, 1:p); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
99 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
100 case 5 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
101 [xyz, x, y, z, div] = varargin{:}; |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
102 case 6 |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
103 if (iscell (varargin{1})) |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
104 [xyz, x, y, z, div, options] = varargin{:}; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
105 else |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
106 [u, v, w, spx, spy, spz] = varargin{:}; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
107 [m, n, p] = size (u); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
108 [x, y, z] = meshgrid (1:n, 1:m, 1:p); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
109 endif |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
110 case 7 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
111 [u, v, w, spx, spy, spz, options] = varargin{:}; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
112 [m, n, p] = size (u); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
113 [x, y, z] = meshgrid (1:n, 1:m, 1:p); |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
114 case 9 |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
115 [x, y, z, u, v, w, spx, spy, spz] = varargin{:}; |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
116 case 10 |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
117 [x, y, z, u, v, w, spx, spy, spz, options] = varargin{:}; |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
118 otherwise |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
119 error ("streamtube: invalid number of inputs"); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
120 endswitch |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
121 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
122 scale = 1; |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
123 num_circum = 20; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
124 if (! isempty (options)) |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
125 switch (numel (options)) |
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
126 case 1 |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
127 scale = options(1); |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
128 case 2 |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
129 scale = options(1); |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
130 num_circum = options(2); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
131 otherwise |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
132 error ("streamtube: invalid number of OPTIONS elements"); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
133 endswitch |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
134 |
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
135 if (! isreal (scale) || scale <= 0) |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
136 error ("streamtube: SCALE must be a real scalar > 0"); |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
137 endif |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
138 if (! isreal (num_circum) || num_circum < 3) |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
139 error ("streamtube: number of tube vertices N must be greater than 2"); |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
140 endif |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
141 num_circum = fix (num_circum); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
142 endif |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
143 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
144 if (isempty (xyz)) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
145 xyz = stream3 (x, y, z, u, v, w, spx, spy, spz, 0.2); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
146 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
147 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
148 if (isempty (div) && isempty (dia)) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
149 div = divergence (x, y, z, u, v, w); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
150 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
151 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
152 if (! isempty (dia) && iscell (dia)) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
153 for i = 1 : length (xyz) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
154 if (rows (dia{i}) != rows (xyz{i})) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
155 error ("streamtube: DIA must have same length then XYZ"); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
156 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
157 endfor |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
158 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
159 |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
160 if (isempty (hax)) |
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
161 hax = gca (); |
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
162 else |
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
163 hax = hax(1); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
164 endif |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
165 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
166 ## Derive final scale factor from the bounding box diagonal |
28036
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
167 mxx = mnx = mxy = mny = mxz = mnz = []; |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
168 j = 1; |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
169 for i = 1 : length (xyz) |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
170 sl = xyz{i}; |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
171 if (! isempty (sl)) |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
172 slx = sl(:,1); sly = sl(:,2); slz = sl(:,3); |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
173 mxx(j) = max (slx); mnx(j) = min (slx); |
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
174 mxy(j) = max (sly); mny(j) = min (sly); |
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
175 mxz(j) = max (slz); mnz(j) = min (slz); |
28036
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
176 j += 1; |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
177 endif |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
178 endfor |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
179 dx = max (mxx) - min (mnx); |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
180 dy = max (mxy) - min (mny); |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
181 dz = max (mxz) - min (mnz); |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
182 clen = scale * sqrt (dx*dx + dy*dy + dz*dz) / 40; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
183 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
184 h = []; |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
185 for i = 1 : length (xyz) |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
186 sl = xyz{i}; |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
187 num_vertices = rows (sl); |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
188 if (! isempty (sl) && num_vertices > 1) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
189 if (isempty (dia)) |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
190 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
191 ## Plot a tube based on normalized divergence |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
192 [div_sl, max_vertices] = interp_sl (x, y, z, div, sl); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
193 if (max_vertices > 1) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
194 ## Nomalize the divergence along the streamline |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
195 mn = min (div_sl); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
196 mx = max (div_sl); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
197 if (mn == mx) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
198 radius_sl = clen * ones (max_vertices, 1); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
199 else |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
200 radius_sl = clen * (div_sl - mn) / (mx - mn); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
201 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
202 htmp = plottube (hax, sl, radius_sl, max_vertices, num_circum); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
203 h = [h; htmp]; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
204 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
205 |
28036
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
206 else |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
207 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
208 ## Plot a tube from external data (vertex array or constant) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
209 if (iscell (dia)) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
210 radius_sl = 0.5 * scale * dia{i}; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
211 else |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
212 radius_sl = 0.5 * scale * dia * ones (1, num_vertices); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
213 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
214 htmp = plottube (hax, sl, radius_sl, num_vertices, num_circum); |
28036
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
215 h = [h; htmp]; |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
216 |
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
217 endif |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
218 endif |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
219 endfor |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
220 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
221 endfunction |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
222 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
223 function h = plottube (hax, sl, radius_sl, max_vertices, num_circum) |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
224 |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
225 phi = linspace (0, 2*pi, num_circum); |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
226 cp = cos (phi); |
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
227 sp = sin (phi); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
228 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
229 ## 1st streamline segment |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
230 X0 = sl(1,:); |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
231 X1 = sl(2,:); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
232 R = X1 - X0; |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
233 RE = R / norm (R); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
234 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
235 ## Guide point and its rotation to create a segment |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
236 KE = get_normal1 (RE); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
237 K = radius_sl(1) * KE; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
238 XS0 = rotation (K, RE, cp, sp) + repmat (X0.', 1, num_circum); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
239 K = radius_sl(2) * KE; |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
240 XS = rotation (K, RE, cp, sp) + repmat (X1.', 1, num_circum); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
241 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
242 px = zeros (num_circum, max_vertices); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
243 py = zeros (num_circum, max_vertices); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
244 pz = zeros (num_circum, max_vertices); |
28036
465be7c652f1
streamtube: Change used graphics object and tube radius (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28035
diff
changeset
|
245 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
246 px(:,1) = XS0(1,:).'; |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
247 py(:,1) = XS0(2,:).'; |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
248 pz(:,1) = XS0(3,:).'; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
249 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
250 px(:,2) = XS(1,:).'; |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
251 py(:,2) = XS(2,:).'; |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
252 pz(:,2) = XS(3,:).'; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
253 |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
254 for i = 3 : max_vertices |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
255 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
256 ## Next streamline segment |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
257 X0 = X1; |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
258 X1 = sl(i,:); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
259 R = X1 - X0; |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
260 RE = R / norm (R); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
261 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
262 ## Project KE onto RE and get the difference in order to transport |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
263 ## the normal vector KE along the vertex array |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
264 Kp = KE - RE * dot (KE, RE); |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
265 KE = Kp / norm (Kp); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
266 K = radius_sl(i) * KE; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
267 |
28135
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
268 ## Rotate around RE and collect surface patches |
695bb31e565b
Rename "streamtube" to "ostreamtube" (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28036
diff
changeset
|
269 XS = rotation (K, RE, cp, sp) + repmat (X1.', 1, num_circum); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
270 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
271 px(:,i) = XS(1,:).'; |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
272 py(:,i) = XS(2,:).'; |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
273 pz(:,i) = XS(3,:).'; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
274 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
275 endfor |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
276 |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
277 h = surface (hax, px, py, pz); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
278 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
279 endfunction |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
280 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
281 ## Interpolate onto the streamline vertices and return the first chunck of |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
282 ## valid samples until a singularity is hit (NaN or +-Inf) or |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
283 ## the streamline vertex array "sl" ends |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
284 function [div_sl_crop, max_vertices] = interp_sl (x, y, z, div, sl) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
285 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
286 div_sl = interp3 (x, y, z, div, sl(:,1), sl(:,2), sl(:,3)); |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
287 is_nan = find (isnan (div_sl), 1, "first"); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
288 is_inf = find (isinf (div_sl), 1, "first"); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
289 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
290 max_vertices = rows (sl); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
291 if (! isempty (is_nan)) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
292 max_vertices = min (max_vertices, is_nan - 1); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
293 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
294 if (! isempty (is_inf)) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
295 max_vertices = min (max_vertices, is_inf - 1); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
296 endif |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
297 |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
298 div_sl_crop = div_sl(1 : max_vertices); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
299 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
300 endfunction |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
301 |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
302 ## Arbitrary N normal to X |
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
303 function N = get_normal1 (X) |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
304 |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
305 if ((X(3) == 0) && (X(1) == -X(2))) |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
306 N = [(- X(2) - X(3)), X(1), X(1)]; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
307 else |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
308 N = [X(3), X(3), (- X(1) - X(2))]; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
309 endif |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
310 |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
311 N /= norm (N); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
312 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
313 endfunction |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
314 |
28035
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
315 ## Rotate X around U where |U| = 1 |
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
316 ## cp = cos (angle), sp = sin (angle) |
0cd5f632a4b0
streamtube.m: Clean up function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
27984
diff
changeset
|
317 function Y = rotation (X, U, cp, sp) |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
318 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
319 ux = U(1); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
320 uy = U(2); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
321 uz = U(3); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
322 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
323 Y(1,:) = X(1) * (cp + ux * ux * (1 - cp)) + ... |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
324 X(2) * (ux * uy * (1 - cp) - uz * sp) + ... |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
325 X(3) * (ux * uz * (1 - cp) + uy * sp); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
326 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
327 Y(2,:) = X(1) * (uy * ux * (1 - cp) + uz * sp) + ... |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
328 X(2) * (cp + uy * uy * (1 - cp)) + ... |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
329 X(3) * (uy * uz * (1 - cp) - ux * sp); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
330 |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
331 Y(3,:) = X(1) * (uz * ux * (1 - cp) - uy * sp) + ... |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
332 X(2) * (uz * uy * (1 - cp) + ux * sp) + ... |
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
333 X(3) * (cp + uz * uz * (1 - cp)); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
334 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
335 endfunction |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
336 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
337 %!demo |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
338 %! clf; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
339 %! [x, y, z] = meshgrid (-3:0.15:3, -1:0.1:1, -1:0.1:1); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
340 %! u = 2 + 8 * exp (-2.0*x.*x); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
341 %! v = zeros (size (x)); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
342 %! w = zeros (size (x)); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
343 %! h = streamtube (x, y, z, u, v, w, -3, 0, 0, [5, 60]); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
344 %! set (h, "facecolor", "r", "edgecolor", "none"); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
345 %! hold on; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
346 %! camlight (); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
347 %! lighting gouraud; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
348 %! view (3); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
349 %! grid on; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
350 %! quiver3 (x, y, z, u, v, w); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
351 %! axis tight equal; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
352 %! title ("Divergence Plot"); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
353 |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
354 %!demo |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
355 %! clf; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
356 %! t = 0:.15:15; |
28385
1888f07317a8
streamtube.m, ostreamtube.m: Minor code cleaning (patch #9916).
Markus Meisinger <chloros2@gmx.de>
parents:
28137
diff
changeset
|
357 %! xyz{1} = [cos(t)', sin(t)', (t/3)']; |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
358 %! dia{1} = cos(t)'; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
359 %! streamtube (xyz, dia); |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
360 %! grid on; |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
361 %! axis tight equal; |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
362 %! colormap (jet); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
363 %! shading interp; |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
364 %! camlight (); |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
365 %! lighting gouraud; |
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
366 %! view (3); |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
367 %! title ("Plot Arbitrary Tube"); |
27759
992e702ef0d7
Add stream* functions (patch #9859).
Markus Meisinger <chloros2@gmx.de>
parents:
diff
changeset
|
368 |
27810
f2b89a2e20b6
overhaul streamXXX.m series of functions.
Rik <rik@octave.org>
parents:
27794
diff
changeset
|
369 ## Test input validation |
28896
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
28386
diff
changeset
|
370 %!error <Invalid call> streamtube () |
28136
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
371 %!error <invalid number of inputs> streamtube (1) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
372 %!error <invalid number of inputs> streamtube (1,2,3,4) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
373 %!error <invalid number of inputs> streamtube (1,2,3,4,5,6,7,8) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
374 %!error <invalid number of inputs> streamtube (1,2,3,4,5,6,7,8,9,10,11) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
375 %!error <invalid number of OPTIONS elements> streamtube (1,2,[1,2,3]) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
376 %!error <SCALE must be a real scalar . 0> streamtube (1,2,[1i]) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
377 %!error <SCALE must be a real scalar . 0> streamtube (1,2,[0]) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
378 %!error <SCALE must be a real scalar . 0> streamtube (1,2,[-1]) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
379 %!error <N must be greater than 2> streamtube (1,2,[1,1i]) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
380 %!error <N must be greater than 2> streamtube (1,2,[1,2]) |
23f667483fab
Add Matlab compatible "streamtube" function (bug #57471).
Markus Meisinger <chloros2@gmx.de>
parents:
28135
diff
changeset
|
381 %!error <DIA must have same length then XYZ> streamtube ({[1,1,1;2,2,2]},{[1,1,1]}) |