Mercurial > octave
annotate scripts/plot/draw/private/__interp_cube__.m @ 31220:5b021ecc8bfe stable
pie3: Fix "Too many input" args error.
* __pie__.m (update_text_pos): Change prototype to match the expected number of
input arguments.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Wed, 31 Aug 2022 22:01:39 +0200 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
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 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30326
diff
changeset
|
3 ## Copyright (C) 2009-2022 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/>. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 ## |
11104 | 8 ## This file is part of Octave. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
11104 | 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:
23220
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:
22323
diff
changeset
|
13 ## (at your option) any later version. |
11104 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 ## |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
11104 | 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:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
25 ## |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
25039
40a65b30fadf
maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
27 ## @deftypefn {} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{caller}, @var{x}, @var{y}, @var{z}, @var{val}, @var{v}, @var{req}) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
28 ## Undocumented internal function. |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
29 ## @end deftypefn |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
30 |
22786 | 31 function [Vxyz, idx, frac] = __interp_cube__ (caller, x, y, z, val, v, |
32 req = "values") | |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
33 |
22786 | 34 if (isnumeric (x) && ndims (x) == 3 && isnumeric (y) && isnumeric (z) |
35 && size_equal (x, y, z, val)) | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
36 x = squeeze (x(1,:,1))(:); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
37 y = squeeze (y(:,1,1))(:); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
38 z = squeeze (z(1,1,:))(:); |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
39 elseif (isvector (x) && isvector (y) && isvector (z)) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
40 x = x(:); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
41 y = y(:); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
42 z = z(:); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
43 else |
22786 | 44 error ([caller ": X, Y, Z have unequal dimensions"]); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
45 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
46 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
47 if (size (val) != [length(x), length(y), length(z)]) |
22786 | 48 error ([caller ": VAL dimensions must match those of X, Y, and Z"]); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
49 endif |
14872
c2dbdeaa25df
maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents:
14868
diff
changeset
|
50 if (columns (v) != 3) |
22786 | 51 error ([caller ": V must be an Nx3 matrix"]); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
52 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
53 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
54 if (isempty (v)) |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
55 Vxyz = idx = frac = []; |
17312
088d014a7fe2
Use semicolon after "return" statement in core m-files.
Rik <rik@octave.org>
parents:
17176
diff
changeset
|
56 return; |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
57 endif |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
58 |
11120
a44f979a35ce
style fixes for some .m files
John W. Eaton <jwe@octave.org>
parents:
11104
diff
changeset
|
59 switch (req) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
60 case "normals" |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
61 [idx, frac] = cube_idx (x, y, z, v); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
62 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
63 dx = x(2:end) - x(1:end-1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
64 dy = y(2:end) - y(1:end-1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
65 dz = z(2:end) - z(1:end-1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
66 dx = 0.5 .* [dx;dx(end)](idx(:,2)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
67 dy = 0.5 .* [dy;dy(end)](idx(:,1)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
68 dz = 0.5 .* [dz;dz(end)](idx(:,3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
69 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
70 p000 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) - dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
71 p100 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) - dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
72 p010 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) - dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
73 p001 = [v(:, 1) - dx, v(:, 2) - dy, v(:, 3) + dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
74 p011 = [v(:, 1) - dx, v(:, 2) + dy, v(:, 3) + dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
75 p101 = [v(:, 1) + dx, v(:, 2) - dy, v(:, 3) + dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
76 p110 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) - dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
77 p111 = [v(:, 1) + dx, v(:, 2) + dy, v(:, 3) + dz]; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
78 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
79 v000 = interp_cube_trilin (x, y, z, val, p000); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
80 v100 = interp_cube_trilin (x, y, z, val, p100); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
81 v010 = interp_cube_trilin (x, y, z, val, p010); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
82 v001 = interp_cube_trilin (x, y, z, val, p001); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
83 v011 = interp_cube_trilin (x, y, z, val, p011); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
84 v101 = interp_cube_trilin (x, y, z, val, p101); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
85 v110 = interp_cube_trilin (x, y, z, val, p110); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
86 v111 = interp_cube_trilin (x, y, z, val, p111); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
87 |
30326
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
88 Dx = -v000 + v100 - v010 - v001 - v011 + v101 + v110 + v111; |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
89 Dy = -v000 - v100 + v010 - v001 + v011 - v101 + v110 + v111; |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
90 Dz = -v000 - v100 - v010 + v001 + v011 + v101 - v110 + v111; |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
91 Vxyz = 0.5 .* [Dx./dx, Dy./dy, Dz./dz]; |
22786 | 92 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
93 case "normals8" |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
94 [idx, frac] = cube_idx (x, y, z, v); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
95 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
96 dx = x(2:end) - x(1:end-1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
97 dy = y(2:end) - y(1:end-1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
98 dz = z(2:end) - z(1:end-1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
99 dx = [dx;dx(end)](idx(:,2)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
100 dy = [dy;dy(end)](idx(:,1)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
101 dz = [dz;dz(end)](idx(:,3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
102 [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
103 Vxyz = [Dx./dx, Dy./dy, Dz./dz]; |
22786 | 104 |
17176
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
105 case "values" |
abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
Rik <rik@octave.org>
parents:
14872
diff
changeset
|
106 [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v); |
22786 | 107 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
108 otherwise |
22786 | 109 error ([caller ': Invalid request type "%s", use "values", "normals" or "normals8"'], req); |
110 | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
111 endswitch |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
112 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
113 endfunction |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
114 |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
115 function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
116 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
117 [idx, frac] = cube_idx (x(:), y(:), z(:), v); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
118 sval = size (val); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
119 i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
120 i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
121 i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
122 i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
123 i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
124 i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
125 i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
126 i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 ); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
127 Bx = frac(:, 1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
128 By = frac(:, 2); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
129 Bz = frac(:, 3); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
130 Vxyz = ... |
30326
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
131 val( i000 ) .* (1 - Bx) .* (1 - By) .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
132 val( i100 ) .* Bx .* (1 - By) .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
133 val( i010 ) .* (1 - Bx) .* By .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
134 val( i001 ) .* (1 - Bx) .* (1 - By) .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
135 val( i011 ) .* (1 - Bx) .* By .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
136 val( i101 ) .* Bx .* (1 - By) .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
137 val( i110 ) .* Bx .* By .* (1 - Bz) + ... |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
138 val( i111 ) .* Bx .* By .* Bz; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
139 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
140 endfunction |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
141 |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
142 function [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
143 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
144 [idx, frac] = cube_idx (x(:), y(:), z(:), v); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
145 sval = size (val); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
146 i000 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
147 i100 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
148 i010 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
149 i001 = sub2ind (sval, idx(:, 1), idx(:, 2), idx(:, 3)+1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
150 i101 = sub2ind (sval, idx(:, 1)+1, idx(:, 2), idx(:, 3)+1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
151 i011 = sub2ind (sval, idx(:, 1), idx(:, 2)+1, idx(:, 3)+1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
152 i110 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
153 i111 = sub2ind (sval, idx(:, 1)+1, idx(:, 2)+1, idx(:, 3)+1 ); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
154 Bx = frac(:, 1); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
155 By = frac(:, 2); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
156 Bz = frac(:, 3); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
157 Dx = ... |
30326
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
158 val( i000 ) .* -1 .* (1 - By) .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
159 val( i100 ) .* (1 - By) .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
160 val( i010 ) .* -1 .* By .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
161 val( i001 ) .* -1 .* (1 - By) .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
162 val( i011 ) .* -1 .* By .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
163 val( i101 ) .* (1 - By) .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
164 val( i110 ) .* By .* (1 - Bz) + ... |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
165 val( i111 ) .* By .* Bz; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
166 Dy = ... |
30326
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
167 val( i000 ) .* (1 - Bx) .* -1 .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
168 val( i100 ) .* Bx .* -1 .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
169 val( i010 ) .* (1 - Bx) .* (1 - Bz) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
170 val( i001 ) .* (1 - Bx) .* -1 .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
171 val( i011 ) .* (1 - Bx) .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
172 val( i101 ) .* Bx .* -1 .* Bz + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
173 val( i110 ) .* Bx .* (1 - Bz) + ... |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
174 val( i111 ) .* Bx .* Bz; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
175 Dz = ... |
30326
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
176 val( i000 ) .* (1 - Bx) .* (1 - By) .* -1 + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
177 val( i100 ) .* Bx .* (1 - By) .* -1 + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
178 val( i010 ) .* (1 - Bx) .* By .* -1 + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
179 val( i001 ) .* (1 - Bx) .* (1 - By) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
180 val( i011 ) .* (1 - Bx) .* By + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
181 val( i101 ) .* Bx .* (1 - By) + ... |
cd7c824f3f22
eliminate use of .+ and .- operators in Octave sources
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
182 val( i110 ) .* Bx .* By .* -1 + ... |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
183 val( i111 ) .* Bx .* By; |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
184 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
185 endfunction |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
186 |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
187 function [idx, frac] = cube_idx (x, y, z, v) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
188 |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
189 idx = zeros (size (v)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
190 frac = zeros (size (v)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
191 idx(:, 2) = lookup (x(2:end-1), v(:, 1)) + 1; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
192 frac(:, 2) = (v(:, 1) - x(idx(:, 2)) )... |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
193 ./ (x(idx(:, 2)+1) - x(idx(:, 2))); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
194 idx(:, 1) = lookup (y(2:end-1), v(:, 2)) + 1; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
195 frac(:, 1) = (v(:, 2) - y(idx(:, 1))) ... |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
196 ./ (y(idx(:, 1)+1) - y(idx(:, 1))); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
197 idx(:, 3) = lookup (z(2:end-1), v(:, 3)) + 1; |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
198 frac(:, 3) = (v(:, 3) - z(idx(:, 3))) ... |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
199 ./ (z(idx(:, 3)+1) - z(idx(:, 3))); |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
200 |
10635
d1978e7364ad
Print name of function in error() string messages.
Rik <octave@nomad.inbox5.com>
parents:
9896
diff
changeset
|
201 endfunction |