Description: Adjust ode for Octave 9 The continuation lines with '\' has been deprecated since Octave 7. In Octave 9, only '...' is allowed. Author: Rafael Laboissière Forwarded: no Last-Update: 2024-02-13 --- inst/best_dir_cov.m +++ inst/best_dir_cov.m @@ -88,10 +88,10 @@ tmp = zeros(D,D*P) ; # wrt. d and x for i=1:D, - ## d2wx(W+i,(i-1)*P+1:i*P) = \ + ## d2wx(W+i,(i-1)*P+1:i*P) = ... ## 2*x'*(kron(y(i,:)) - d2wx(W+i,:) = \ - 2*x'*kron(y(i,:),kron(d,isig)) - \ + d2wx(W+i,:) = ... + 2*x'*kron(y(i,:),kron(d,isig)) - ... w'*a'*isig*kron(y(i,:),eye(P)) ; end --- inst/save_vrml.m +++ inst/save_vrml.m @@ -54,15 +54,15 @@ l_direction = [0.57735 -0.57735 0.577 bg_node = sprintf (["Background {\n",... " skyColor %8.3g %8.3g %8.3g\n",... - "}\n"],\ + "}\n"],... bg_col); bg_node = ""; -lightstr = sprintf (["PointLight {\n",\ - " intensity %8.3g\n",\ - " ambientIntensity %8.3g\n",\ - " direction %8.3g %8.3g %8.3g\n",\ - "}\n"],\ +lightstr = sprintf (["PointLight {\n",... + " intensity %8.3g\n",... + " ambientIntensity %8.3g\n",... + " direction %8.3g %8.3g %8.3g\n",... + "}\n"],... l_intensity, l_ambientIntensity, l_direction); lightstr = ""; --- inst/test_moving_surf.m +++ inst/test_moving_surf.m @@ -59,7 +59,7 @@ if 1 s4 = vrml_anim ("Coordinate",[a,b,a],"foo.set_point",[0 0.5 1],tn); - s3 = vrml_faces ([-1 -1 1 1;-1 1 1 -1;0.1 0.1 0.1 0.1],\ + s3 = vrml_faces ([-1 -1 1 1;-1 1 1 -1;0.1 0.1 0.1 0.1],... {[1 2 3 4]},"tran",0.4,"col",[0.9 0.4 0.4]); vrml_browse ([s1,s2,s3,s4]) --- inst/test_vmesh.m +++ inst/test_vmesh.m @@ -46,14 +46,14 @@ vmesh (z); printf ("Press a key.\n"); pause; -printf (["The same surface, with checkered stripes ",\ +printf (["The same surface, with checkered stripes ",... "(see the 'checker' option).\n"]); vmesh (z,"checker",-[6,5]); printf ("Press a key.\n"); pause; -printf (["The same surface, with z-dependent coloring (see 'zrb', 'zgrey'\n",\ +printf (["The same surface, with z-dependent coloring (see 'zrb', 'zgrey'\n",... " and 'zcol' options)\n"]); vmesh (z,"zrb"); --- inst/test_vrml_faces.m +++ inst/test_vrml_faces.m @@ -36,7 +36,7 @@ if 1 printf ("Going to show a tetrahedron\n"); - printf (["\n If nothing appears, it may be due to problems",\ + printf (["\n If nothing appears, it may be due to problems",... "\n with your FreeWRL installation\n"]); vrml_browse ([slight, s1]); printf ("Press a key in this terminal when done\n");pause; @@ -47,7 +47,7 @@ if 1 printf ("Going to show almost the same tetrahedron\n"); - printf (["\n If nothing appears, it may be due to problems",\ + printf (["\n If nothing appears, it may be due to problems",... "\n with your FreeWRL installation\n"]); vrml_browse ([slight, s1]); printf ("Press a key in this terminal when done\n");pause; @@ -104,15 +104,15 @@ if 0 s1 = vrml_faces (x, trg, "tex",texfile,"imsz",[H,W]); s2 = vrml_faces (x, trg, "tex",texfile); - printf (["Tetrahedrons should appear like (R=red, G=green, B=blue)\n\n",\ - " R 2\n",\ - " /\n",\ - " / G\n",\ - " G B /\n",\ - " 3--------4 B\n",\ - " R B \\\n",\ - " \\ R\n",\ - " G \\\n",\ + printf (["Tetrahedrons should appear like (R=red, G=green, B=blue)\n\n",... + " R 2\n",... + " /\n",... + " / G\n",... + " G B /\n",... + " 3--------4 B\n",... + " R B \\\n",... + " \\ R\n",... + " G \\\n",... " 1\n"]); vrml_browse ([slight, s1, vrml_transfo(s2,[2,0,0])]); --- inst/vmesh.m +++ inst/vmesh.m @@ -108,7 +108,7 @@ surf_args = {x,y,z}; # Arguments that'll if numel (varargin) - op1 = [" tran col checker creaseAngle emit colorPerVertex tex zcol frame ",\ + op1 = [" tran col checker creaseAngle emit colorPerVertex tex zcol frame ",... " level lcol ltran bwid "]; op0 = " smooth zgray zrb normalize steps bars "; @@ -117,11 +117,11 @@ if numel (varargin) opts = read_options (varargin,"op0",op0,"op1",op1,"default",df); # Identify options for vrml_surf() -# all_surf_opts = list ("tran", "col", "checker", "creaseAngle", "emit", \ -# "colorPerVertex", "smooth", "tex",\ +# all_surf_opts = list ("tran", "col", "checker", "creaseAngle", "emit", ... +# "colorPerVertex", "smooth", "tex",... # "zgray","zrb","zcol"); - all_surf_opts = {"tran", "col", "checker", "creaseAngle", "emit", \ - "colorPerVertex", "smooth", "steps", "bars", "bwid", "tex",\ + all_surf_opts = {"tran", "col", "checker", "creaseAngle", "emit", ... + "colorPerVertex", "smooth", "steps", "bars", "bwid", "tex",... "zgray","zrb","zcol"}; for i = 1:length(all_surf_opts) @@ -187,16 +187,16 @@ pt2 = pts(:,ii); x2 = x(ii); y2 = y(ii); # pl = [pl1 pl2]; -pl = [vrml_DirectionalLight("direction",[-1,-1,-1],"intensity",0.75),\ - vrml_DirectionalLight("direction",[-1, 1,-1],"intensity",0.5),\ - vrml_DirectionalLight("direction",[ 1,-1,-1],"intensity",0.5),\ - vrml_DirectionalLight("direction",[ 1, 1,-1],"intensity",0.33),\ +pl = [vrml_DirectionalLight("direction",[-1,-1,-1],"intensity",0.75),... + vrml_DirectionalLight("direction",[-1, 1,-1],"intensity",0.5),... + vrml_DirectionalLight("direction",[ 1,-1,-1],"intensity",0.5),... + vrml_DirectionalLight("direction",[ 1, 1,-1],"intensity",0.33),... vrml_DirectionalLight("direction",[ 0, 0, 1],"intensity",0.5)]; -# distance = max ([max (x(:)) - min (x(:)),\ -# max (y(:)) - min (y(:)),\ +# distance = max ([max (x(:)) - min (x(:)),... +# max (y(:)) - min (y(:)),... # max (z(:)) - min (z(:))]) -# vp = vrml_Viewpoint ("orientation", [1 0 0 -pi/6],\ +# vp = vrml_Viewpoint ("orientation", [1 0 0 -pi/6],... # "position", distance*[0 0 5]); minpts = min (pt2'); @@ -205,7 +205,7 @@ medpts = (minpts + maxpts)/2; ptssz = (maxpts - minpts); ptssz = max (ptssz, max (ptssz/10)); -if frame, fr = vrml_frame (minpts-ptssz/10,\ +if frame, fr = vrml_frame (minpts-ptssz/10,... "scale", ptssz * 1.2, "col",(ones(3)+eye(3))/2); else fr = ""; end @@ -235,10 +235,10 @@ if ! isempty (level) if prod (size (ltran)) == 1 , ltran = ltran*ones(1,nlev); end for i = 1:nlev - slevel = [slevel, \ - vrml_parallelogram([xmin xmin xmax xmax;\ - ymin ymax ymax ymin;\ - level(i) level(i) level(i) level(i)],\ + slevel = [slevel, ... + vrml_parallelogram([xmin xmin xmax xmax;... + ymin ymax ymax ymin;... + level(i) level(i) level(i) level(i)],... "col",lcol(i,:),"tran",ltran(i))]; end end --- inst/vrml_DirectionalLight.m +++ inst/vrml_DirectionalLight.m @@ -39,10 +39,10 @@ for k=1:2:nargin, hash = setfield(hash,varargin{k:k+1}); end -tpl = struct ("ambientIntensity", "%8.3f",\ - "intensity", "%8.3f",\ - "direction", "%8.3f",\ - "on", "%s",\ +tpl = struct ("ambientIntensity", "%8.3f",... + "intensity", "%8.3f",... + "direction", "%8.3f",... + "on", "%s",... "color", "%8.3f %8.3f %8.3f"); body = ""; @@ -55,7 +55,7 @@ for [val,key] = hash, error (sprintf ("vrml_PointLight : unknown field '%s'",key)); end - body = [body,\ + body = [body,... sprintf(" %-20s %s\n",key, sprintf(getfield (tpl,key), val))]; end --- inst/vrml_PointLight.m +++ inst/vrml_PointLight.m @@ -40,12 +40,12 @@ function s = vrml_PointLight (varargin) if mod(nargin,2) != 0, print_usage; end h = struct (varargin{:}); -tpl = struct ("ambientIntensity", "%8.3f",\ - "intensity", "%8.3f",\ - "radius", "%8.3f",\ - "on", "%s",\ - "attenuation", "%8.3f %8.3f %8.3f",\ - "color", "%8.3f %8.3f %8.3f",\ +tpl = struct ("ambientIntensity", "%8.3f",... + "intensity", "%8.3f",... + "radius", "%8.3f",... + "on", "%s",... + "attenuation", "%8.3f %8.3f %8.3f",... + "color", "%8.3f %8.3f %8.3f",... "location", "%8.3f %8.3f %8.3f"); body = ""; @@ -61,8 +61,8 @@ for [val,key] = h, end - body = [body,\ - sprintf(" %-20s %s\n",key, \ + body = [body,... + sprintf(" %-20s %s\n",key, ... sprintf (getfield (tpl,key), val))]; end end --- inst/vrml_TimeSensor.m +++ inst/vrml_TimeSensor.m @@ -42,10 +42,10 @@ function s = vrml_TimeSensor (varargin) verbose = 0; -tpl = struct ("cycleInterval", "SFTime",\ -"startTime", "SFTime",\ -"stopTime", "SFTime",\ -"enabled", "SFBool",\ +tpl = struct ("cycleInterval", "SFTime",... +"startTime", "SFTime",... +"stopTime", "SFTime",... +"enabled", "SFBool",... "loop", "SFBool" ); @@ -55,7 +55,7 @@ dnode = struct (); # Transform varargin into key-value pairs i = j = k = 1; # i:pos in new varargin, j:pos in headpar, # k:pos is old varargin. -while i <= length (varargin) && \ +while i <= length (varargin) && ... ! (ischar (varargin{i}) && isfield (tpl, varargin{i})) if j <= length (headpar) @@ -70,7 +70,7 @@ while i <= length (varargin) && \ i += 2; k++; else - error ("vrml_TimeSensor : Argument %i should be string, not '%s'",\ + error ("vrml_TimeSensor : Argument %i should be string, not '%s'",... k,typeinfo (varargin{i})); end end @@ -86,11 +86,11 @@ while i < length (varargin) k = varargin{i++}; # Read key if ! ischar (k) - error ("vrml_TimeSensor : Arg n. %i should be a string, not a %s.",\ + error ("vrml_TimeSensor : Arg n. %i should be a string, not a %s.",... i-1, typeinfo (k)); end if ! isfield (tpl, k) && ! strcmp (k,"DEF") - error ("vrml_TimeSensor : Unknown field '%s'. Should be one of :\n%s",\ + error ("vrml_TimeSensor : Unknown field '%s'. Should be one of :\n%s",... k, sprintf (" '%s'\n",fieldnames (tpl)'{:})); end @@ -107,7 +107,7 @@ while i < length (varargin) else # Add data field if verbose - printf ("vrml_TimeSensor : Adding '%s' of type %s, with arg of type %s\n",\ + printf ("vrml_TimeSensor : Adding '%s' of type %s, with arg of type %s\n",... k,getfield(tpl,k),typeinfo (v)); end tmp = getfield(tpl,k); --- inst/vrml_Viewpoint.m +++ inst/vrml_Viewpoint.m @@ -42,12 +42,12 @@ if mod(nargin,2) != 0, print_usage; end h = struct (varargin{:}); -tpl = struct ("fieldOfView", "%8.3f",\ - "jump", "%s",\ - "orientation", "%8.3f %8.3f %8.3f %8.3f",\ - "orientation0", "%8.3f %8.3f %8.3f %8.3f",\ - "position", "%8.3f %8.3f %8.3f",\ - "description", "\"%s\"",\ +tpl = struct ("fieldOfView", "%8.3f",... + "jump", "%s",... + "orientation", "%8.3f %8.3f %8.3f %8.3f",... + "orientation0", "%8.3f %8.3f %8.3f %8.3f",... + "position", "%8.3f %8.3f %8.3f",... + "description", "\"%s\"",... "DEF", ""); DEF = ""; defaultPos = [0 0 10]; @@ -113,8 +113,8 @@ endif body = ""; for [val, key] = h - body = [body,\ - sprintf(" %-20s %s\n",key, \ + body = [body,... + sprintf(" %-20s %s\n",key, ... sprintf (getfield (tpl,key), val))]; end --- inst/vrml_arrow.m +++ inst/vrml_arrow.m @@ -76,43 +76,43 @@ endfor smat1 = vrml_material (col(:,1), emit); smat2 = vrml_material (col(:,2), emit); -v = sprintf (["Group {\n",\ - " children [\n",\ - " Transform {\n",\ - " translation %8.3g %8.3g %8.3g\n",\ - " children [\n",\ - " Shape {\n",\ - " appearance Appearance {\n",\ - smat1,\ - " }\n"\ - " geometry Cylinder {\n",\ - " radius %8.3g\n",\ - " height %8.3g\n",\ - " }\n",\ - " }\n",\ - " ]\n",\ - " }\n",\ - " Transform {\n",\ - " translation %8.3g %8.3g %8.3g\n",\ - " children [\n",\ - " Shape {\n",\ - " appearance Appearance {\n",\ - smat2,\ - " }\n",\ - " geometry Cone { \n",\ - " bottomRadius %8.3g \n",\ - " height %8.3g\n",\ - " }\n",\ - " }\n",\ - " ]\n",\ - " }\n",\ - " ]\n",\ - "}\n"],\ - [0,(sz(1)-sz(2))/2,0],\ - sz(4),\ - sz(1)-sz(2),\ - [0,sz(2)/2+sz(1)-sz(2),0],\ - sz(3),\ +v = sprintf (["Group {\n",... + " children [\n",... + " Transform {\n",... + " translation %8.3g %8.3g %8.3g\n",... + " children [\n",... + " Shape {\n",... + " appearance Appearance {\n",... + smat1,... + " }\n"... + " geometry Cylinder {\n",... + " radius %8.3g\n",... + " height %8.3g\n",... + " }\n",... + " }\n",... + " ]\n",... + " }\n",... + " Transform {\n",... + " translation %8.3g %8.3g %8.3g\n",... + " children [\n",... + " Shape {\n",... + " appearance Appearance {\n",... + smat2,... + " }\n",... + " geometry Cone { \n",... + " bottomRadius %8.3g \n",... + " height %8.3g\n",... + " }\n",... + " }\n",... + " ]\n",... + " }\n",... + " ]\n",... + "}\n"],... + [0,(sz(1)-sz(2))/2,0],... + sz(4),... + sz(1)-sz(2),... + [0,sz(2)/2+sz(1)-sz(2),0],... + sz(3),... sz(2)); endfunction --- inst/vrml_browse.m +++ inst/vrml_browse.m @@ -113,7 +113,7 @@ if vrml_b_pid > 0 # There's already a b end else if verbose - printf ( ["vrml_browse : ",\ + printf ( ["vrml_browse : ",... "browser pid=%d died. I'll spawn another\n"], vrml_b_pid); end vrml_b_pid = -1 ; @@ -138,10 +138,10 @@ if !length (s) x /= 4 ; y /= 4 ; ## pix = ones (n) ; - ## tmp = [1 0 0 1 1 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0 ;\ - ## 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 ;\ - ## 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 0 0 ;\ - ## 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 ;\ + ## tmp = [1 0 0 1 1 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0 ;... + ## 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 ;... + ## 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 0 0 ;... + ## 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 ;... ## 1 0 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 ]; ## rtmp = rows(tmp)+2; @@ -194,7 +194,7 @@ if vrml_b_pid <= 0 ## cmd if status, - printf("vrml_browse : Can't start browser '%s'. Is it installed?\n",\ + printf("vrml_browse : Can't start browser '%s'. Is it installed?\n",... vrml_b_name); p = vrml_b_pid ; return ; --- inst/vrml_cyl.m +++ inst/vrml_cyl.m @@ -48,7 +48,7 @@ if nargin > 1 op1 = " rad tran col hcol brad emit " ; op0 = " verbose balls noemit arrow " ; - df = tars (rad, tran, col, hcol, verbose, balls, noemit, arrow, brad, \ + df = tars (rad, tran, col, hcol, verbose, balls, noemit, arrow, brad, ... emit); @@ -97,36 +97,36 @@ for i = 2:N smat = vrml_material (col(:,i-1), emitcol(:,i-1), tran(i-1)); # Do a cylinder - s = [s,sprintf(["Transform {\n",\ - " translation %8.3f %8.3f %8.3f\n",\ - " children [\n",\ - " Transform {\n",\ - " rotation %8.3f %8.3f %8.3f %8.3f\n",\ - " children [\n",\ - " Shape {\n",\ - " appearance Appearance {\n",\ - " %s",\ - " }\n",\ - " geometry Cylinder {\n",\ - " height %8.3f\n",\ - " radius %8.3f\n",\ - " }\n",\ - " }\n",\ - " ]\n",\ - " }\n",\ - " ]\n",\ - "}\n"],\ - t,\ - ax,an,\ - smat,\ - n,\ + s = [s,sprintf(["Transform {\n",... + " translation %8.3f %8.3f %8.3f\n",... + " children [\n",... + " Transform {\n",... + " rotation %8.3f %8.3f %8.3f %8.3f\n",... + " children [\n",... + " Shape {\n",... + " appearance Appearance {\n",... + " %s",... + " }\n",... + " geometry Cylinder {\n",... + " height %8.3f\n",... + " radius %8.3f\n",... + " }\n",... + " }\n",... + " ]\n",... + " }\n",... + " ]\n",... + "}\n"],... + t,... + ax,an,... + smat,... + n,... rad)]; else t = x(:,i-1) ; if isnan (hcol), hcol = col(:,i); end arrowcol = [col(:,i) hcol(1:3)(:)]; - s = [s,\ - vrml_transfo(vrml_arrow ([n,nan,2*rad/n,rad/n],arrowcol,emit),\ + s = [s,... + vrml_transfo(vrml_arrow ([n,nan,2*rad/n,rad/n],arrowcol,emit),... t, ax*an)]; end end @@ -137,7 +137,7 @@ if balls, s = [s, vrml_points(x,"balls","col",col, "rad",brad,"emit",emit)]; elseif columns(x)>2, # Make a rounded junction - s = [s, vrml_points(x(:,2:columns(x)-1),"balls","col",col,"rad",rad, \ + s = [s, vrml_points(x(:,2:columns(x)-1),"balls","col",col,"rad",rad, ... "emit", emit)]; end --- inst/vrml_demo_tutorial_1.m +++ inst/vrml_demo_tutorial_1.m @@ -13,19 +13,19 @@ ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . -printf (["\n",\ - " VRML Mini-HOWTO's first listing\n",\ +printf (["\n",... + " VRML Mini-HOWTO's first listing\n",... " Display a quadratic surface w/ 31 x 31 points\n\n"]); -printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"\ - " q : quit\n",\ - " w : switch to walk mode\n",\ - " e : switch to examine mode\n",\ - " h : toggle headlights on or off\n",\ - " drag left mouse : rotate (examine mode) or translate\n",\ - " (walk mode).\n",\ - " drag right mouse : zoom (examine mode) or translate\n",\ - " (walk mode).\n",\ +printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"... + " q : quit\n",... + " w : switch to walk mode\n",... + " e : switch to examine mode\n",... + " h : toggle headlights on or off\n",... + " drag left mouse : rotate (examine mode) or translate\n",... + " (walk mode).\n",... + " drag right mouse : zoom (examine mode) or translate\n",... + " (walk mode).\n",... "\n"]); ## Listing 1 --- inst/vrml_demo_tutorial_2.m +++ inst/vrml_demo_tutorial_2.m @@ -16,19 +16,19 @@ printf("vrml_select_points does not work any more. Sorry\n"); return -printf (["\n",\ - " VRML Mini-HOWTO's second listing\n",\ +printf (["\n",... + " VRML Mini-HOWTO's second listing\n",... " Show 3D points and select some with the mouse\n\n"]); -printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"\ - " q : quit\n",\ - " w : switch to walk mode\n",\ - " e : switch to examine mode\n",\ - " drag left mouse : rotate (examine mode) or translate\n",\ - " (walk mode).\n",\ - " drag right mouse : zoom (examine mode) or translate\n",\ - " (walk mode).\n",\ - " click on box : toggle selection\n",\ +printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"... + " q : quit\n",... + " w : switch to walk mode\n",... + " e : switch to examine mode\n",... + " drag left mouse : rotate (examine mode) or translate\n",... + " (walk mode).\n",... + " drag right mouse : zoom (examine mode) or translate\n",... + " (walk mode).\n",... + " click on box : toggle selection\n",... "\n"]); ## Listing 2 --- inst/vrml_demo_tutorial_3.m +++ inst/vrml_demo_tutorial_3.m @@ -13,18 +13,18 @@ ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . -printf (["\n",\ - " VRML Mini-HOWTO's second listing\n",\ +printf (["\n",... + " VRML Mini-HOWTO's second listing\n",... " Show a XYZ frame with a background\n\n"]); -printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"\ - " q : quit\n",\ - " w : switch to walk mode\n",\ - " e : switch to examine mode\n",\ - " drag left mouse : rotate (examine mode) or translate\n",\ - " (walk mode).\n",\ - " drag right mouse : zoom (examine mode) or translate\n",\ - " (walk mode).\n",\ +printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"... + " q : quit\n",... + " w : switch to walk mode\n",... + " e : switch to examine mode\n",... + " drag left mouse : rotate (examine mode) or translate\n",... + " (walk mode).\n",... + " drag right mouse : zoom (examine mode) or translate\n",... + " (walk mode).\n",... "\n"]); ## Listing 3 --- inst/vrml_demo_tutorial_4.m +++ inst/vrml_demo_tutorial_4.m @@ -13,19 +13,19 @@ ## You should have received a copy of the GNU General Public License along with ## this program; if not, see . -printf (["\n",\ - " VRML Mini-HOWTO's second listing\n",\ +printf (["\n",... + " VRML Mini-HOWTO's second listing\n",... " Show a helix of ellipsoids and one consisting of cylinders\n\n"]); -printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"\ - " q : quit\n",\ - " w : switch to walk mode\n",\ - " e : switch to examine mode\n",\ - " h : toggle headlights on or off\n",\ - " drag left mouse : rotate (examine mode) or translate\n",\ - " (walk mode).\n",\ - " drag right mouse : zoom (examine mode) or translate\n",\ - " (walk mode).\n",\ +printf ([" Reminder of FreeWRL keystrokes and mouse actions :\n"... + " q : quit\n",... + " w : switch to walk mode\n",... + " e : switch to examine mode\n",... + " h : toggle headlights on or off\n",... + " drag left mouse : rotate (examine mode) or translate\n",... + " (walk mode).\n",... + " drag right mouse : zoom (examine mode) or translate\n",... + " (walk mode).\n",... "\n"]); ## Listing 4 --- inst/vrml_ellipsoid.m +++ inst/vrml_ellipsoid.m @@ -48,26 +48,26 @@ d(find(d)) = 1 ./ nze (d) ; [r,a] = rotparams (u'); -v = sprintf (["Transform {\n",\ - " translation 0 0 0\n",\ - " rotation %8.3g %8.3g %8.3g %8.3g\n",\ - " scale %8.3g %8.3g %8.3g\n",\ - " children [\n",\ - " Shape {\n",\ - " appearance Appearance {\n",\ - " material Material {\n",\ - " diffuseColor %8.3g %8.3g %8.3g\n",\ - " emissiveColor %8.3g %8.3g %8.3g\n",\ - " }\n",\ - " }\n",\ - " geometry Sphere {}\n",\ - " }\n",\ - " ]\n",\ - "}\n",\ - ],\ - r,a,\ - d,\ - col,\ +v = sprintf (["Transform {\n",... + " translation 0 0 0\n",... + " rotation %8.3g %8.3g %8.3g %8.3g\n",... + " scale %8.3g %8.3g %8.3g\n",... + " children [\n",... + " Shape {\n",... + " appearance Appearance {\n",... + " material Material {\n",... + " diffuseColor %8.3g %8.3g %8.3g\n",... + " emissiveColor %8.3g %8.3g %8.3g\n",... + " }\n",... + " }\n",... + " geometry Sphere {}\n",... + " }\n",... + " ]\n",... + "}\n",... + ],... + r,a,... + d,... + col,... col/20); endfunction --- inst/vrml_faces.m +++ inst/vrml_faces.m @@ -153,11 +153,11 @@ function s = vrml_faces (x,f,varargin) texcoord_point_str = sprintf (" %8.5f %8.5f\n", tcoord); - col_str_2 = sprintf ([" texCoord TextureCoordinate {\n",\ - " point [\n %s]\n",\ - " }\n"\ - ],\ - texcoord_point_str\ + col_str_2 = sprintf ([" texCoord TextureCoordinate {\n",... + " point [\n %s]\n",... + " }\n"... + ],... + texcoord_point_str... ); # If texture has been provided @@ -187,14 +187,14 @@ function s = vrml_faces (x,f,varargin) tcoord = tcoord (:,1:3*nfaces); end - col_str_2 = sprintf ([" texCoord TextureCoordinate {\n",\ - " point [\n %s]\n",\ - " }\n",\ - " texCoordIndex [\n %s]\n",\ - " coordIndex [\n %s]\n",\ - ],\ - sprintf ("%10.8f %10.8f,\n ",tcoord),\ - sprintf ("%-4d, %-4d, %-4d, -1,\n ",0:3*nfaces-1),\ + col_str_2 = sprintf ([" texCoord TextureCoordinate {\n",... + " point [\n %s]\n",... + " }\n",... + " texCoordIndex [\n %s]\n",... + " coordIndex [\n %s]\n",... + ],... + sprintf ("%10.8f %10.8f,\n ",tcoord),... + sprintf ("%-4d, %-4d, %-4d, -1,\n ",0:3*nfaces-1),... sprintf ("%-4d, %-4d, %-4d, -1,\n ",f-1) ); @@ -205,7 +205,7 @@ function s = vrml_faces (x,f,varargin) # surface col_str_1 = [" appearance Appearance {\n",... - vrml_material(col, emit, tran,DEFcol),\ + vrml_material(col, emit, tran,DEFcol),... " }\n"]; col_str_2 = ""; @@ -219,7 +219,7 @@ function s = vrml_faces (x,f,varargin) if tran, ts = sprintf ("transparency %8.3f",tran); else ts = ""; end - col_str_1 = ["appearance Appearance {\n",\ + col_str_1 = ["appearance Appearance {\n",... " material Material {",ts,"}\n}\n"]; end if isnan (colorPerVertex) @@ -229,13 +229,13 @@ function s = vrml_faces (x,f,varargin) end if colorPerVertex, cPVs = "TRUE"; else cPVs = "FALSE"; end - col_str_2 = sprintf ([" colorPerVertex %s\n",\ - " color %s Color {\n",\ - " color [\n%s\n",\ - " ]\n",\ - " }"],\ - cPVs,\ - col_def_str,\ + col_str_2 = sprintf ([" colorPerVertex %s\n",... + " color %s Color {\n",... + " color [\n%s\n",... + " ]\n",... + " }"],... + cPVs,... + col_def_str,... sprintf(" %8.3f %8.3f %8.3f,\n",col)); end --- inst/vrml_frame.m +++ inst/vrml_frame.m @@ -65,12 +65,12 @@ if args verbose = 0; ## df = tars (col, hcol, diam, scale, verbose); - df = struct ("dc", dc, \ # Diameter of cone (absolute) - "dr", dr, \ # Diameter of rod (absolute) - "col", col, \ # Color - "hcol", hcol, \ # Color of head (if different) - "diam", diam, \ # Diameter of cone relative to branch length - "scale", scale, \ # Lenght of branches + df = struct ("dc", dc, ... # Diameter of cone (absolute) + "dr", dr, ... # Diameter of rod (absolute) + "col", col, ... # Color + "hcol", hcol, ... # Color of head (if different) + "diam", diam, ... # Diameter of cone relative to branch length + "scale", scale, ... # Lenght of branches "verbose",verbose); op1 = " col hcol diam scale dc dr "; op0 = " verbose "; @@ -127,17 +127,17 @@ sz(4,:) ./= n; tmp = [r2(:,1), null(r2(:,1)')](:,[2,1,3])'; if det (tmp) < 0, tmp(3,:) *= -1; end -a1 = vrml_transfo (vrml_arrow(sz(:,1),[col(1,:);hcol(1,:)],0),\ +a1 = vrml_transfo (vrml_arrow(sz(:,1),[col(1,:);hcol(1,:)],0),... [0,0,0],tmp); ## keyboard tmp = [r2(:,2), null(r2(:,2)')](:,[2,1,3])'; if det (tmp) < 0, tmp(3,:) *= -1; end -a2 = vrml_transfo (vrml_arrow(sz(:,2),[col(2,:);hcol(2,:)],0),\ +a2 = vrml_transfo (vrml_arrow(sz(:,2),[col(2,:);hcol(2,:)],0),... [0,0,0],tmp); tmp = [r2(:,3), null(r2(:,3)')](:,[2,1,3])'; if det (tmp) < 0, tmp(3,:) *= -1; end -a3 = vrml_transfo (vrml_arrow(sz(:,3),[col(3,:);hcol(3,:)],0),\ +a3 = vrml_transfo (vrml_arrow(sz(:,3),[col(3,:);hcol(3,:)],0),... [0,0,0],tmp); f0 = vrml_group (a1, a2, a3); --- inst/vrml_group.m +++ inst/vrml_group.m @@ -34,11 +34,11 @@ end ni = 4; s = [blanks(ni), strrep(s,"\n",["\n",blanks(ni)])(:)']; -v = sprintf (["Group {\n",\ - " children [\n",\ - "%s",\ - " ]\n",\ - "}\n"],\ +v = sprintf (["Group {\n",... + " children [\n",... + "%s",... + " ]\n",... + "}\n"],... s); endfunction --- inst/vrml_interp.m +++ inst/vrml_interp.m @@ -45,12 +45,12 @@ persistent nname = struct ("col" if isfield (nname, typ) typs = nname.(typ); elseif ischar(typ) -# e2 = leval ("sprintf",\ +# e2 = leval ("sprintf",... # append (list(" '%s'\n"), fieldnames (nname))); e2 = sprintf(" '%s'\n", fieldnames (nname){:}); error ("vrml_interp : Unknown type '%s'. Should be in:\n%s",typ,e2); else -# e2 = leval ("sprintf",\ +# e2 = leval ("sprintf",... # append (list(" '%s;\n"), fieldnames (nname))); e2 = sprintf(" '%s'\n", fieldnames (nname){:}); error ("vrml_interp : typ should be a string in:\n%s",typ,e2); --- inst/vrml_material.m +++ inst/vrml_material.m @@ -53,10 +53,10 @@ if isempty (DEF), sd = ""; else sd = ["DEF ",DEF]; end -s = sprintf ([" material ",sd," Material {\n",\ - se,st,\ - " diffuseColor %8.3g %8.3g %8.3g \n",\ - " }\n"],\ +s = sprintf ([" material ",sd," Material {\n",... + se,st,... + " diffuseColor %8.3g %8.3g %8.3g \n",... + " }\n"],... dc); endfunction --- inst/vrml_parallelepiped.m +++ inst/vrml_parallelepiped.m @@ -66,15 +66,15 @@ if balls end end -x = [bnds([1 2 2 1 1 2 2 1],1)';\ - bnds([1 1 2 2 1 1 2 2],2)';\ +x = [bnds([1 2 2 1 1 2 2 1],1)';... + bnds([1 1 2 2 1 1 2 2],2)';... bnds([1 1 1 1 2 2 2 2],3)']; -faces = [1 2 3 4;\ - 5 6 7 8;\ - 1 2 6 5;\ - 2 3 7 6;\ - 3 4 8 7;\ +faces = [1 2 3 4;... + 5 6 7 8;... + 1 2 6 5;... + 2 3 7 6;... + 3 4 8 7;... 4 1 5 8]'; # The facet @@ -99,8 +99,8 @@ if border if isnan (bocol), bocol = col; end if !balls # Make pretty junctions of cylinders - s = [s,\ - vrml_cyl(x(:,[1:columns(x),1]),"rad",borad,"emit",boemit,"col",col),\ + s = [s,... + vrml_cyl(x(:,[1:columns(x),1]),"rad",borad,"emit",boemit,"col",col),... vrml_points(x(:,1),"balls","rad",borad,"emit",boemit,"col",col)]; else # but only if balls don't cover them s = [s,vrml_cyl(x(:,[1:columns(x),1]),"rad",borad,"emit",boemit)]; --- inst/vrml_parallelogram.m +++ inst/vrml_parallelogram.m @@ -86,8 +86,8 @@ if border if isnan (bocol), bocol = col; end if !balls # Make pretty junctions of cylinders - s = [s,\ - vrml_cyl(x(:,[1:columns(x),1]),"rad",borad,"emit",boemit,"col",col),\ + s = [s,... + vrml_cyl(x(:,[1:columns(x),1]),"rad",borad,"emit",boemit,"col",col),... vrml_points(x(:,1),"balls","rad",borad,"emit",boemit,"col",col)]; else # but only if balls don't cover them s = [s,vrml_cyl(x(:,[1:columns(x),1]),"rad",borad,"emit",boemit)]; --- inst/vrml_points.m +++ inst/vrml_points.m @@ -103,19 +103,19 @@ if !balls && !cubes && !nums, if prod (size (col)) == 3*P # One color per point smat = ""; - scol = sprintf (" color Color { color [\n %s]\n }\n",\ + scol = sprintf (" color Color { color [\n %s]\n }\n",... sprintf (" %8.3f %8.3f %8.3f\n", col)); else # One color - smat = [" appearance Appearance {\n",\ - vrml_material(col, emit),"\n",\ + smat = [" appearance Appearance {\n",... + vrml_material(col, emit),"\n",... " }\n"]; scol = ""; end - s = sprintf(["Shape {\n",\ - smat,\ - " geometry PointSet {\n",\ - scol,\ + s = sprintf(["Shape {\n",... + smat,... + " geometry PointSet {\n",... + scol,... " coord DEF %s Coordinate {\n point [\n " ],name); # ] @@ -131,28 +131,28 @@ elseif nums, s = ""; if prod (size (col)) == 3, col = col(:) * ones (1,P); end for i = 1:P, - s0 = sprintf([\ - "Transform {\n",\ - " translation %10.6g %10.6g %10.6g\n",\ - " children [\n",\ # ] - " Billboard {\n",\ - " children [\n",\ # ] - " Shape {\n",\ - " appearance Appearance {\n",\ - vrml_material(col(:,i), emit, tran),"\n",\ - " }\n",\ - " geometry Text {\n",\ - " string \"%s\"\n",\ - " fontStyle FontStyle { size 0.25 }\n",\ - " }\n",\ - " }\n",\ - " ]\n",\ - " }\n",\ - " ]\n",\ - "}\n"],\ # [ + s0 = sprintf([... + "Transform {\n",... + " translation %10.6g %10.6g %10.6g\n",... + " children [\n",... # ] + " Billboard {\n",... + " children [\n",... # ] + " Shape {\n",... + " appearance Appearance {\n",... + vrml_material(col(:,i), emit, tran),"\n",... + " }\n",... + " geometry Text {\n",... + " string \"%s\"\n",... + " fontStyle FontStyle { size 0.25 }\n",... + " }\n",... + " }\n",... + " ]\n",... + " }\n",... + " ]\n",... + "}\n"],... # [ x(:,i),sprintf("%d",i-1)); ## x(:,i),col,col,sprintf("%d",i-1)); - ## " emissiveColor %8.3f %8.3f %8.3f\n",\ + ## " emissiveColor %8.3f %8.3f %8.3f\n",... ## " axisOfRotation 0.0 0.0 0.0\n",\ s = sprintf("%s%s",s,s0); @@ -196,20 +196,20 @@ else # nodes individually if ! all_same_col, colorstr = vrml_material (col(:,i), emit); end - s0 = sprintf([\ - "Transform {\n",\ - " translation %10.6g %10.6g %10.6g\n",\ - " children [\n",\ # ] - " Shape {\n",\ - " appearance Appearance {\n",\ - colorstr,"\n",\ - " }\n",\ - " geometry ",shapestr,"\n",\ - " }\n",\ - " ]\n",\ - "}\n"],\ + s0 = sprintf([... + "Transform {\n",... + " translation %10.6g %10.6g %10.6g\n",... + " children [\n",... # ] + " Shape {\n",... + " appearance Appearance {\n",... + colorstr,"\n",... + " }\n",... + " geometry ",shapestr,"\n",... + " }\n",... + " ]\n",... + "}\n"],... x(:,i)); - ## " emissiveColor %8.3f %8.3f %8.3f\n",\ + ## " emissiveColor %8.3f %8.3f %8.3f\n",... ## x(:,i),col,col,shape); s = sprintf("%s%s",s,s0); end --- inst/vrml_surf.m +++ inst/vrml_surf.m @@ -118,7 +118,7 @@ if numel (varargin) op1 = " tran col creaseAngle emit colorPerVertex checker DEFcoord DEFcol zcol bwid tex "; op0 = " smooth zgray zrb steps bars " ; - default = tars (tran, col, creaseAngle, emit, colorPerVertex, steps, bars, \ + default = tars (tran, col, creaseAngle, emit, colorPerVertex, steps, bars, ... bwid, DEFcoord, DEFcol, zcol, smooth, checker, zgray, zrb, tex); s = read_options (varargin,"op0",op0,"op1",op1,"default",default); @@ -374,7 +374,7 @@ if zgray || zrb || any (zcol(:)) # Treat ii = find (ci >= columns (zcol)); if ! isempty (ii), ci(ii) = columns (zcol) - 1; cw(ii) = 1; end col = zeros (3,R*C); - col(:,keepip) = \ + col(:,keepip) = ... zcol(:,ci) .* ([1;1;1]*(1-cw)) + zcol(:,ci+1) .* ([1;1;1]*cw); end # EOF zgray zrb and zcol options @@ -419,8 +419,8 @@ if ! colorPerVertex col = reshape (col,3, (R-1)*(C-1)); col = [col, col]; else - printf(["vrml_surf : ",\ - " colorPerVertex==0, (R-1)*(C-1)==%i, but col has size [%i,%i]\n"],\ + printf(["vrml_surf : ",... + " colorPerVertex==0, (R-1)*(C-1)==%i, but col has size [%i,%i]\n"],... R*C,size (col)); end @@ -441,9 +441,9 @@ if ! all(keepp), keept = all (reshape(keepp(trgs),3,2*(R-1)*(C-1))); else tmp = reshape (keepp,R,C); - keept = \ - all (reshape (tmp(trgs(1:2,:)),2,2*(R-1)*(C-1))) & \ - [(tmp(1:R-1,2:C) | tmp(2:R,2:C))(:)', \ + keept = ... + all (reshape (tmp(trgs(1:2,:)),2,2*(R-1)*(C-1))) & ... + [(tmp(1:R-1,2:C) | tmp(2:R,2:C))(:)', ... (tmp(1:R-1,1:C-1) | tmp(2:R,1:C-1))(:)'] ; end @@ -473,10 +473,10 @@ if ! all(keepp), end ## printf ("Calling vrml_faces\n"); if !tex - s = vrml_faces (pts, trgs, "col", col,\ - "colorPerVertex",colorPerVertex,\ - "creaseAngle", creaseAngle,\ - "tran", tran, "emit", emit,\ + s = vrml_faces (pts, trgs, "col", col,... + "colorPerVertex",colorPerVertex,... + "creaseAngle", creaseAngle,... + "tran", tran, "emit", emit,... "DEFcoord",DEFcoord,"DEFcol",DEFcol); else texXY = texXY(:,keepip); @@ -488,8 +488,8 @@ else # texXY(:,trgs(:)) # R, C # keyboard - s = vrml_faces (pts, trgs,\ - "tran", tran, "tex", tex, "tcoord", texXY,\ + s = vrml_faces (pts, trgs,... + "tran", tran, "tex", tex, "tcoord", texXY,... "DEFcoord",DEFcoord,"DEFcol",DEFcol); end ## printf ("Done\n"); --- inst/vrml_text.m +++ inst/vrml_text.m @@ -52,31 +52,31 @@ if nargin > 1 style= s.style; verbose= s.verbose; end -s = sprintf (["Shape {\n",\ - " appearance Appearance {\n",\ - " material Material {\n",\ - " diffuseColor %8.3f %8.3f %8.3f\n",\ - " emissiveColor %8.3f %8.3f %8.3f\n",\ - " }\n",\ - " }\n",\ - " geometry Text {\n",\ - " string \"%s\"\n"\ - " fontStyle FontStyle {\n",\ - " family \"%s\"\n",\ - " justify \"%s\"\n",\ - " style \"%s\"\n",\ - " size %-8.3f\n",\ - " }\n",\ - " }\n",\ - "}\n",\ - ],\ - col,\ - col,\ - t,\ - family,\ - justify,\ - style,\ - size\ +s = sprintf (["Shape {\n",... + " appearance Appearance {\n",... + " material Material {\n",... + " diffuseColor %8.3f %8.3f %8.3f\n",... + " emissiveColor %8.3f %8.3f %8.3f\n",... + " }\n",... + " }\n",... + " geometry Text {\n",... + " string \"%s\"\n"... + " fontStyle FontStyle {\n",... + " family \"%s\"\n",... + " justify \"%s\"\n",... + " style \"%s\"\n",... + " size %-8.3f\n",... + " }\n",... + " }\n",... + "}\n",... + ],... + col,... + col,... + t,... + family,... + justify,... + style,... + size... ); endfunction --- inst/vrml_transfo.m +++ inst/vrml_transfo.m @@ -75,8 +75,8 @@ else error ("vrml_transfo : rotation should have size 3x3, 3 or 4\n"); end if verbose, - printf (["vrml_transfo : %8.3f %8.3f %8.3f %8.3f\n",\ - " %8.3f %8.3f %8.3f\n"],\ + printf (["vrml_transfo : %8.3f %8.3f %8.3f %8.3f\n",... + " %8.3f %8.3f %8.3f\n"],... axis,ang,t); printf ("length of string is %i\n",prod(size(s))); end @@ -103,11 +103,11 @@ if any (abs (c - c0)>sqrt (eps)) end if !isempty (DEF), sd = ["DEF ",DEF," "]; end -v = sprintf([sd,"Transform {\n",sr,st,ss,\ - " children [\n%s\n",\ - " ]\n",\ - "}\n",\ - ],\ +v = sprintf([sd,"Transform {\n",sr,st,ss,... + " children [\n%s\n",... + " ]\n",... + "}\n",... + ],... s) ; ## keyboard