comparison scripts/plot/private/__interp_cube__.m @ 17184:abf384f5d243

maint: Remove unneeded input validation from internal fcns in private/ directories. * scripts/general/private/__isequal__.m, scripts/general/private/__splinen__.m, scripts/image/private/__imwrite__.m, scripts/image/private/ind2x.m, scripts/miscellaneous/private/__xzip__.m, scripts/miscellaneous/private/display_info_file.m, scripts/pkg/private/describe.m, scripts/pkg/private/get_forge_pkg.m, scripts/pkg/private/unload_packages.m, scripts/plot/private/__actual_axis_position__.m, scripts/plot/private/__add_datasource__.m, scripts/plot/private/__clabel__.m, scripts/plot/private/__errcomm__.m, scripts/plot/private/__errplot__.m, scripts/plot/private/__fltk_print__.m, scripts/plot/private/__gnuplot_get_var__.m, scripts/plot/private/__go_draw_axes__.m, scripts/plot/private/__go_draw_figure__.m, scripts/plot/private/__interp_cube__.m, scripts/plot/private/__line__.m, scripts/plot/private/__next_line_color__.m, scripts/plot/private/__next_line_style__.m, scripts/plot/private/__plt__.m, scripts/plot/private/__pltopt__.m, scripts/signal/private/rectangle_lw.m, scripts/signal/private/rectangle_sw.m, scripts/signal/private/triangle_lw.m, scripts/signal/private/triangle_sw.m, scripts/sparse/private/__sprand_impl__.m, scripts/statistics/models/private/logistic_regression_derivatives.m, scripts/statistics/models/private/logistic_regression_likelihood.m: Remove unneeded input validation from internal fcns in private/ directories.
author Rik <rik@octave.org>
date Sun, 04 Aug 2013 18:13:08 -0700
parents c2dbdeaa25df
children 088d014a7fe2
comparison
equal deleted inserted replaced
17183:4bb7ae321901 17184:abf384f5d243
22 ## @deftypefn {Function File} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{v}) 22 ## @deftypefn {Function File} {[@var{vxyz}, @var{idx}, @var{frac}] =} __interp_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{v})
23 ## Undocumented internal function. 23 ## Undocumented internal function.
24 ## @end deftypefn 24 ## @end deftypefn
25 25
26 function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" ) 26 function [Vxyz, idx, frac] = __interp_cube__ (x, y, z, val, v, req = "values" )
27 if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3 ... 27 if (ismatrix (x) && ndims (x) == 3 && ismatrix (y) && ndims (y) == 3
28 && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val)) 28 && ismatrix (z) && ndims (z) == 3 && size_equal (x, y, z, val))
29 x = squeeze (x(1,:,1))(:); 29 x = squeeze (x(1,:,1))(:);
30 y = squeeze (y(:,1,1))(:); 30 y = squeeze (y(:,1,1))(:);
31 z = squeeze (z(1,1,:))(:); 31 z = squeeze (z(1,1,:))(:);
32 elseif (isvector (x) && isvector (y) && isvector (z) ) 32 elseif (isvector (x) && isvector (y) && isvector (z))
33 x = x(:); 33 x = x(:);
34 y = y(:); 34 y = y(:);
35 z = z(:); 35 z = z(:);
36 else 36 else
37 error ("__interp_cube__: X, Y, Z have wrong dimensions"); 37 error ("__interp_cube__: X, Y, Z have wrong dimensions");
38 endif 38 endif
39 if (size (val) != [length(x), length(y), length(z)]) 39 if (size (val) != [length(x), length(y), length(z)])
40 error ("__interp_cube__: VAL has wrong dimensions"); 40 error ("__interp_cube__: VAL has wrong dimensions");
41 endif 41 endif
42 if (columns (v) != 3) 42 if (columns (v) != 3)
43 error ( "v has to be N*3 matrix"); 43 error ( "V has to be Nx3 matrix");
44 endif 44 endif
45 if (!ischar (req)) 45 ##if (!ischar (req))
46 error ("__interp_cube__: Invalid request parameter use 'values', 'normals' or 'normals8'"); 46 ## error ('__interp_cube__: Invalid request parameter use "values", "normals" or "normals8"');
47 endif 47 ##endif
48 if (isempty (v)) 48 if (isempty (v))
49 Vxyz = idx = frac = []; 49 Vxyz = idx = frac = [];
50 return 50 return
51 endif 51 endif
52 52
53 switch (req) 53 switch (req)
54 case "values"
55 [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v);
56 case "normals" 54 case "normals"
57 [idx, frac] = cube_idx (x, y, z, v); 55 [idx, frac] = cube_idx (x, y, z, v);
58 56
59 dx = x(2:end) - x(1:end-1); 57 dx = x(2:end) - x(1:end-1);
60 dy = y(2:end) - y(1:end-1); 58 dy = y(2:end) - y(1:end-1);
94 dx = [dx;dx(end)](idx(:,2)); 92 dx = [dx;dx(end)](idx(:,2));
95 dy = [dy;dy(end)](idx(:,1)); 93 dy = [dy;dy(end)](idx(:,1));
96 dz = [dz;dz(end)](idx(:,3)); 94 dz = [dz;dz(end)](idx(:,3));
97 [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v); 95 [Dx, Dy, Dz, idx, frac] = interp_cube_trilin_grad (x, y, z, val, v);
98 Vxyz = [Dx./dx, Dy./dy, Dz./dz]; 96 Vxyz = [Dx./dx, Dy./dy, Dz./dz];
97 case "values"
98 [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v);
99 otherwise 99 otherwise
100 error ("__interp_cube__: Invalid request type '%s', use 'values', 'normals' or 'normals8'", req); 100 error ('__interp_cube__: Invalid request type "%s", use "values", "normals" or "normals8"', req);
101 endswitch 101 endswitch
102 endfunction 102 endfunction
103 103
104 function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v) 104 function [Vxyz, idx, frac] = interp_cube_trilin (x, y, z, val, v)
105 [idx, frac] = cube_idx (x(:), y(:), z(:), v); 105 [idx, frac] = cube_idx (x(:), y(:), z(:), v);