changeset 28948:36cd3569f702

maint: match names in documentation and input parameters in function. * __ok_cancel_dlg__.m, cubehelix.m, sqp.m, __marching_cube__.m, mkpp.m: Match names in documentation and input parameters in function.
author Rik <rik@octave.org>
date Sat, 17 Oct 2020 01:04:29 -0700
parents b73a54c31152
children 07cf4d8a859c
files scripts/gui/private/__ok_cancel_dlg__.m scripts/image/cubehelix.m scripts/optimization/sqp.m scripts/plot/draw/private/__marching_cube__.m scripts/polynomial/mkpp.m
diffstat 5 files changed, 39 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/gui/private/__ok_cancel_dlg__.m	Fri Oct 16 10:42:51 2020 -0700
+++ b/scripts/gui/private/__ok_cancel_dlg__.m	Sat Oct 17 01:04:29 2020 -0700
@@ -24,14 +24,14 @@
 ########################################################################
 
 ## -*- texinfo -*-
-## @deftypefn {} {[@var{hf}, @var{hok}, @var{hcancel}] =} __ok_cancel_dlg__ (@var{title})
+## @deftypefn {} {[@var{hf}, @var{hok}, @var{hcancel}] =} __ok_cancel_dlg__ (@var{dlg_title})
 ## Undocumented internal function.
 ## @seealso{}
 ## @end deftypefn
 
-function [hf, hok, hcancel, hpanel] = __ok_cancel_dlg__ (ttl, varargin)
+function [hf, hok, hcancel, hpanel] = __ok_cancel_dlg__ (dlg_title, varargin)
 
-  hf = dialog ("name", ttl, varargin{:});
+  hf = dialog ("name", dlg_title, varargin{:});
   setappdata (hf, "__ok_cancel_btn__", "cancel");
 
   hpanel = uipanel (hf, "units", "pixels", "bordertype", "none");
--- a/scripts/image/cubehelix.m	Fri Oct 16 10:42:51 2020 -0700
+++ b/scripts/image/cubehelix.m	Sat Oct 17 01:04:29 2020 -0700
@@ -26,6 +26,7 @@
 ## -*- texinfo -*-
 ## @deftypefn  {} {@var{map} =} cubehelix ()
 ## @deftypefnx {} {@var{map} =} cubehelix (@var{n})
+## @deftypefnx {} {@var{map} =} cubehelix (@var{n}, @var{start}, @var{rots}, @var{hue}, @var{gamma})
 ## Create cubehelix colormap.
 ##
 ## This colormap varies from black to white going though blue, green, and red
--- a/scripts/optimization/sqp.m	Fri Oct 16 10:42:51 2020 -0700
+++ b/scripts/optimization/sqp.m	Sat Oct 17 01:04:29 2020 -0700
@@ -29,7 +29,7 @@
 ## @deftypefnx {} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h})
 ## @deftypefnx {} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub})
 ## @deftypefnx {} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter})
-## @deftypefnx {} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}, @var{tol})
+## @deftypefnx {} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}, @var{tolerance})
 ## Minimize an objective function using sequential quadratic programming (SQP).
 ##
 ## Solve the nonlinear program
@@ -127,7 +127,7 @@
 ## The seventh argument @var{maxiter} specifies the maximum number of
 ## iterations.  The default value is 100.
 ##
-## The eighth argument @var{tol} specifies the tolerance for the stopping
+## The eighth argument @var{tolerance} specifies the tolerance for the stopping
 ## criteria.  The default value is @code{sqrt (eps)}.
 ##
 ## The value returned in @var{info} may be one of the following:
--- a/scripts/plot/draw/private/__marching_cube__.m	Fri Oct 16 10:42:51 2020 -0700
+++ b/scripts/plot/draw/private/__marching_cube__.m	Sat Oct 17 01:04:29 2020 -0700
@@ -24,18 +24,18 @@
 ########################################################################
 
 ## -*- texinfo -*-
-## @deftypefn  {} {[@var{t}, @var{p}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso})
-## @deftypefnx {} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{x}, @var{y}, @var{z}, @var{val}, @var{iso}, @var{col})
+## @deftypefn  {} {[@var{t}, @var{p}] =} __marching_cube__ (@var{xx}, @var{yy}, @var{zz}, @var{val}, @var{iso})
+## @deftypefnx {} {[@var{t}, @var{p}, @var{c}] =} __marching_cube__ (@var{xx}, @var{yy}, @var{zz}, @var{v}, @var{iso}, @var{colors})
 ##
 ## Return the triangulation information @var{t} at points @var{p} for the
-## isosurface values resp. the volume data @var{val} and the iso level
-## @var{iso}.  It is considered that the volume data @var{val} is given at
-## the points @var{x}, @var{y} and @var{z} which are of type
+## isosurface values resp. the volume data @var{v} and the iso level
+## @var{iso}.  It is considered that the volume data @var{v} is given at
+## the points @var{xx}, @var{yy}, and @var{zz} which are of type
 ## three-dimensional numeric arrays.  The orientation of the triangles is
 ## chosen such that the normals point from the higher values to the lower
 ## values.
 ##
-## Optionally the color data @var{col} can be passed to this function
+## Optionally the color data @var{colors} can be passed to this function
 ## whereas computed vertices color data @var{c} is returned as third
 ## argument.
 ##
@@ -51,10 +51,10 @@
 ## @group
 ## N = 20;
 ## lin = linspace (0, 2, N);
-## [x, y, z] = meshgrid (lin, lin, lin);
+## [xx, yy, zz] = meshgrid (lin, lin, lin);
 ##
-## c = (x-.5).^2 + (y-.5).^2 + (z-.5).^2;
-## [t, p] = __marching_cube__ (x, y, z, c, .5);
+## v = (xx-.5).^2 + (yy-.5).^2 + (zz-.5).^2;
+## [t, p] = __marching_cube__ (xx, yy, zz, v, .5);
 ##
 ## figure ();
 ## trimesh (t, p(:,1), p(:,2), p(:,3));
@@ -82,7 +82,7 @@
 ##
 ## @end deftypefn
 
-function [T, p, col] = __marching_cube__ (xx, yy, zz, c, iso, colors)
+function [T, p, col] = __marching_cube__ (xx, yy, zz, v, iso, colors)
 
   persistent edge_table = [];
   persistent tri_table = [];
@@ -95,13 +95,13 @@
   endif
 
   if (! isnumeric (xx) || ! isnumeric (yy) || ! isnumeric (zz)
-      || ! isnumeric (c) || ndims (xx) != 3 || ndims (yy) != 3
-      || ndims (zz) != 3 || ndims (c) != 3)
-    error ("__marching_cube__: XX, YY, ZZ, C must be 3-D matrices");
+      || ! isnumeric (v) || ndims (xx) != 3 || ndims (yy) != 3
+      || ndims (zz) != 3 || ndims (v) != 3)
+    error ("__marching_cube__: XX, YY, ZZ, v must be 3-D matrices");
   endif
 
-  if (! size_equal (xx, yy, zz, c))
-    error ("__marching_cube__: XX, YY, ZZ, C must be of equal size");
+  if (! size_equal (xx, yy, zz, v))
+    error ("__marching_cube__: XX, YY, ZZ, v must be of equal size");
   endif
 
   if (any (size (xx) < [2 2 2]))
@@ -113,14 +113,14 @@
   endif
 
   if (nargin == 6)
-    if (! isnumeric (colors) || ndims (colors) != 3 || ! size_equal (colors, c))
-      error ( "COLORS must be a 3-D matrix with the same size as C" );
+    if (! isnumeric (colors) || ndims (colors) != 3 || ! size_equal (colors, v))
+      error ( "COLORS must be a 3-D matrix with the same size as v" );
     endif
     calc_cols = true;
     lindex = 5;
   endif
 
-  n = size (c) - 1;
+  n = size (v) - 1;
 
   ## phase I: assign information to each voxel which edges are intersected by
   ## the isosurface.
@@ -138,7 +138,7 @@
 
   ## calculate which vertices have values higher than iso
   for ii = 1:8
-    idx = c(vertex_idx{ii, :}) > iso;
+    idx = v(vertex_idx{ii, :}) > iso;
     cc(idx) = bitset (cc(idx), ii);
   endfor
 
@@ -152,7 +152,7 @@
   ## phase II: calculate the list of intersection points
   xyz_off = [1, 1, 1; 2, 1, 1; 2, 2, 1; 1, 2, 1; 1, 1, 2; 2, 1, 2; 2, 2, 2; 1, 2, 2];
   edges = [1 2; 2 3; 3 4; 4 1; 5 6; 6 7; 7 8; 8 5; 1 5; 2 6; 3 7; 4 8];
-  offset = sub2ind (size (c), xyz_off(:, 1), xyz_off(:, 2), xyz_off(:, 3)) - 1;
+  offset = sub2ind (size (v), xyz_off(:, 1), xyz_off(:, 2), xyz_off(:, 3)) - 1;
   pp = zeros (length (id), lindex, 12);
   ccedge = [vec(cedge(id)), id];
   ix_offset=0;
@@ -160,16 +160,16 @@
     id__ = bitget (ccedge(:, 1), jj);
     id_ = ccedge(id__, 2);
     [ix iy iz] = ind2sub (size (cc), id_);
-    id_c = sub2ind (size (c), ix, iy, iz);
+    id_c = sub2ind (size (v), ix, iy, iz);
     id1 = id_c + offset(edges(jj, 1));
     id2 = id_c + offset(edges(jj, 2));
     if (calc_cols)
       pp(id__, 1:5, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
-        xx(id2), yy(id2), zz(id2), c(id1), c(id2), colors(id1), colors(id2)), ...
+        xx(id2), yy(id2), zz(id2), v(id1), v(id2), colors(id1), colors(id2)), ...
         (1:rows (id_))' + ix_offset ];
     else
       pp(id__, 1:4, jj) = [vertex_interp(iso, xx(id1), yy(id1), zz(id1), ...
-        xx(id2), yy(id2), zz(id2), c(id1), c(id2)), ...
+        xx(id2), yy(id2), zz(id2), v(id1), v(id2)), ...
         (1:rows (id_))' + ix_offset ];
     endif
     ix_offset += rows (id_);
--- a/scripts/polynomial/mkpp.m	Fri Oct 16 10:42:51 2020 -0700
+++ b/scripts/polynomial/mkpp.m	Sat Oct 17 01:04:29 2020 -0700
@@ -56,30 +56,26 @@
 ## @seealso{unmkpp, ppval, spline, pchip, ppder, ppint, ppjumps}
 ## @end deftypefn
 
-function pp = mkpp (x, P, d)
+function pp = mkpp (breaks, coefs, d)
 
-  ## check number of arguments
   if (nargin < 2)
     print_usage ();
   endif
 
-  ## check x
-  if (length (x) < 2)
-    error ("mkpp: at least one interval is needed");
-  endif
-
-  if (! isvector (x))
-    error ("mkpp: x must be a vector");
+  ## Check BREAKS
+  if (! isvector (breaks))
+    error ("mkpp: BREAKS must be a vector");
+  elseif (length (breaks) < 2)
+    error ("mkpp: BREAKS must have at least one interval");
   endif
 
-  len = length (x) - 1;
-  dP = length (size (P));
+  len = length (breaks) - 1;
 
   pp = struct ("form", "pp",
-               "breaks", x(:).',
+               "breaks", breaks(:).',
                "coefs", [],
                "pieces", len,
-               "order", prod (size (P)) / len,
+               "order", prod (size (coefs)) / len,
                "dim", 1);
 
   if (nargin == 3)
@@ -88,7 +84,7 @@
   endif
 
   dim_vec = [pp.pieces * prod(pp.dim), pp.order];
-  pp.coefs = reshape (P, dim_vec);
+  pp.coefs = reshape (coefs, dim_vec);
 
 endfunction