1 ## Copyright (C) 2005-2012 Etienne Grossmann <etienne@egdn.net>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
16 ## s = vrml_interp (typ, val,...)
18 function s = vrml_interp (typ, val, varargin)
22 if nargin < 1, help vrml_interp; return; end
28 s = read_options (varargin, "op1", op1, "default", df);
29 [key, DEF] = getfields (s, "key", "DEF");
33 persistent nname = struct ("col" , "Color",
35 "coord" , "Coordinate",
36 "Coordinate" , "Coordinate",
39 "orient" , "Orientation",
40 "Orientation", "Orientation",
42 "Position" , "Position",
45 if isfield (nname, typ)
48 # e2 = leval ("sprintf",\
49 # append (list(" '%s'\n"), fieldnames (nname)));
50 e2 = sprintf(" '%s'\n", fieldnames (nname){:});
51 error ("vrml_interp : Unknown type '%s'. Should be in:\n%s",typ,e2);
53 # e2 = leval ("sprintf",\
54 # append (list(" '%s;\n"), fieldnames (nname)));
55 e2 = sprintf(" '%s'\n", fieldnames (nname){:});
56 error ("vrml_interp : typ should be a string in:\n%s",typ,e2);
62 vs = sprintf ("%8.5f, ", val);
63 vs = sprintf (" keyValue [ %s ]\n", vs(1:length(vs)-2));
68 ks = sprintf ("%8.5f, ", key);
69 ks = sprintf (" key [ %s ]\n", ks(1:length(ks)-2));
71 if length (DEF), defs = ["DEF ",DEF," "];
75 s = [defs,typs,"Interpolator {\n", vs, ks,"}\n"];endfunction