[Index for tmp_for_tar/vrml.doc]
[Return to Master Index]
vrml_points
(tmp_for_tar/vrml.doc/vrml_points.m)
Function Synopsis
s = vrml_points(x,...)
Help text
s = vrml_points(x,options)
x : 3xP : 3D points
Makes a vrml2 "point [ ... ]" node from a 3xP matrix x.
Options :
"name", name : The Coordinate node will be called name
(default="allpoints").
"hide" : The points will be defined, but not showed.
"balls" : Displays spheres rather than points. Overrides the
"hide" options and no Coordinate node is defined;makes
"name" ineffective.
"rad", rad : radius of balls (default = 0.1)
"nums" : Displays numbers rather than points. Overrides the
"hide" options and no Coordinate node is defined;
makes "name" ineffective.
"col", col : Points will have RGB col. Default = [0.3,0.4,0.9]
Last modified: December 2000
Listing of function file tmp_for_tar/vrml.doc/vrml_points.m
## s = vrml_points(x,options)
##
## x : 3xP : 3D points
##
## Makes a vrml2 "point [ ... ]" node from a 3xP matrix x.
##
## Options :
##
## "name", name : The Coordinate node will be called name
## (default="allpoints").
## "hide" : The points will be defined, but not showed.
##
## "balls" : Displays spheres rather than points. Overrides the
## "hide" options and no Coordinate node is defined;makes
## "name" ineffective.
##
## "rad", rad : radius of balls (default = 0.1)
##
## "nums" : Displays numbers rather than points. Overrides the
## "hide" options and no Coordinate node is defined;
## makes "name" ineffective.
##
## "col", col : Points will have RGB col. Default = [0.3,0.4,0.9]
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: December 2000
function s = vrml_points(x,...)
## varargin
hide = 0;
boxes = balls = nums = 0;
rad = 0.1 ;
name = "allpoints" ;
col = [0.3 0.4 0.9];
while --nargin,
tmp = va_arg();
if strcmp(tmp,"hide") ,
hide = 1;
elseif strcmp(tmp,"balls") ,
balls = 1;
elseif strcmp(tmp,"boxes") ,
boxes = 1;
elseif strcmp(tmp,"rad") ,
rad = va_arg() ; nargin-- ;
elseif strcmp(tmp,"nums") ,
nums = 1;
elseif strcmp(tmp,"col") ,
col = va_arg() ; nargin-- ;
elseif strcmp(tmp,"name") ,
name = va_arg() ; nargin-- ;
end
end
if rows (x) != 3,
if columns (x) == 3,
x = x' ;
else
printf("vrml_points : input is neither 3xP or Px3\n");
keyboard
end
end
P = columns (x) ;
if !balls && !boxes && !nums,
s = sprintf(["Shape {\n",...
" appearance Appearance {\n",...
" material Material { diffuseColor %8.3f %8.3f %8.3f }\n }\n",...
" geometry PointSet {\n",...
" coord DEF %s Coordinate {\n point [\n " ],col,name); # ]
s0 = sprintf("%10.6g %10.6g %10.6g ,\n ",x);
s = sprintf("%s%s]\n }\n }\n }\n",s,s0); # [
if hide ,
s = sprintf(["Switch {\nchoice\n[\n",s,"\n]\n}"]);
end
elseif nums,
s = "";
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",...
" material Material {\n",...
" diffuseColor %8.3f %8.3f %8.3f \n",...
" }\n",...
" }\n",...
" geometry Text {\n",...
" string "%s"\n",...
" fontStyle FontStyle { size 0.25 }\n",...
" }\n",...
" }\n",...
" ]\n",...
" }\n",...
" ]\n",...
"}\n"],... # [
x(:,i),col,sprintf("%d",i-1));
## x(:,i),col,col,sprintf("%d",i-1));
## " emissiveColor %8.3f %8.3f %8.3f\n",...
## " axisOfRotation 0.0 0.0 0.0\n",...
s = sprintf("%s%s",s,s0);
end
else
if balls, shape = sprintf("Sphere { radius %8.3f}",rad) ;
else shape = sprintf("Box { size %8.3f %8.3f %8.3f}",rad,rad,rad) ;
end
s = "";
for i = 1:P,
s0 = sprintf([...
"Transform {\n",...
" translation %10.6g %10.6g %10.6g\n",...
" children [\n",... # ]
" Shape {\n",...
" appearance Appearance {\n",...
" material Material {\n",...
" diffuseColor %8.3f %8.3f %8.3f \n",...
" }\n",...
" }\n",...
" geometry %s\n",...
" }\n",...
" ]\n",...
"}\n"],...
x(:,i),col,shape);
## " emissiveColor %8.3f %8.3f %8.3f\n",...
## x(:,i),col,col,shape);
s = sprintf("%s%s",s,s0);
end
end
Produced by oct2html on Sat Dec 2 19:08:39 2000
Cross-Directory links are: ON