Man Scilab

surface_properties
Scilab Data type

surface_properties - description of the 3D entities properties

Description

The Surface entity is a leaf of the graphics entities hierarchy. Two classes appears under this type of entity : Plot3d and Fac3d according to the ploting function.

Here are the properties contained in a surface entity:

visible: This field contains the visible property value for the entity . It should be "on" or "off" . By default, surfaces are visibles, the value's property is "on" . If "off" the 3D graphics are not displayed on the screen.
data: This field defines a tlist data structure of type "3d" composed of a row and column indices of each element as the x-, y- and z-coordinates contained respectivly in data.x, data.y and data.z . The complementary field named data.color is available in case a color vector or matrix is specified. If none, data.color is not displayed. The surface is painted according to color_mode and color_flag properties.
color_mode: an integer for surface color treatment where:

If color_mode>0 and color_flag==0 the surface is painted with color "color_mode" ; the boundary of the facet is drawn with current line style and color.

if color_mode==0 and color_flag==0 a mesh of the surface is drawn.

if color_mode<0 and color_flag==0 the surface is painted with color "-color_mode" ; the boundary of the facet is not drawn.

thickness: This field contains the default thickness value of the lines used to draw the facets contours. It should be a positive integer.
foreground: This field contains the color index used to draw the axes and the facets contours. Its value should be a color index (relative to the current colormap).
color_flag: This field is used to specify the algorithm used to set facets' colors.

If color_flag==0 then all facets are painted using the color index and method defined by color_mode .

If color_flag==1 then all facets are painted using the color index proportional to z . The minimum z value is painted using the index 1 color while the maximum z value is painted using highest color index.

If color_flag==2 then all facets are painted using the color index given in the data.color property (one color per facet is needed). Two cases are then possible:

data.color contains a color vector : if color(i) is positive it gives the color of facet i and the boundary of the facet is drawn with current line style and color. If color(i) is negative, color id -color(i) is used and the boundary of the facet is not drawn.

data.color contains a color matrix of size (nf,n) where n stands for the number of facets and nf for the number of points defining the polygonal facet. For the nf vertices defining each facet, the algorithm computes an average value of the color index (from the matrix color index) : the nf vertices of the same facet will have the same color index value.

This option is available only with Fac3d entity type.

If color_flag==3 then facets painting results of interpolation of facet boundary colors. The facet boundary colors indices are given in the data.color property (one color per facet boundary is needed). Man musts provide one color for each vertex defining the boundary of the facet ; here again, two cases are possible:

data.color contains a colors vector : then, there are too few data to complete the interpolated shading mode. Indeed, a color matrix of size (nf,n) (where n stands for the number of facets and nf for the number of points defining the polygonal facet) is needed to perform this operation. For each facet, the algorithm copies the single color index value of the facet into the nf color indexes vertices defining the facet's boundary.

data.color contains a color matrix of size (nf,n) (see upper for nf and n definitions), the interpolated shading mode can be completed normally using those color indexes.

This option is available only with Fac3d entity type.

hiddencolor: This field contains the color index used to draw the backward faces of a surface. Its value should be a color index (relative to the current colormap) or -1 which satns for the same color than the "visible" face.
parent: This property contains the handle of the parent. The parent of the surface entity should be of type "Axes" or "Agregation" .

Examples

set("figure_style","new") 
//create a figure 
t=[0:0.3:2*%pi]'; z=sin(t)*cos(t');
[xx,yy,zz]=genfac3d(t,t,z); 
plot3d([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)])) 
h=get("hdl") //get handle on current entity (here the surface) 
a=gca(); //get current axes
a.rotation_angles=[40,70]; 
a.grid=[1 1 1]; 
//make grids 
a.data_bounds=[-6,6;6,-1;0,5]; 
a.axes_visible="off"; 
//axes are hidden a.axes_bounds=[.2 0 1 1]; 
f=get("current_figure");
//get the handle of the parent figure 
f.color_map=hotcolormap(64); 
//change the figure colormap 
h.color_flag=1; 
//color according to z 
h.color_mode=-2; 
//remove the facets boundary 
h.color_flag=2; 
//color according to given colors 
h.data.color=[1+modulo(1:400,64),1+modulo(1:400,64)];
//shaded
h.color_flag=3; 

scf(2); // creates second window
plot3d([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
e=gce();
f=e.data;
TL = tlist(["3d" "x" "y" "z" "color"],f.x,f.y,f.z,6*rand(f.z)); // random color matrix
e.data = TL;
TL2 = tlist(["3d" "x" "y" "z" "color"],f.x,f.y,f.z,4*rand(1,800)); // random color vector
e.data = TL2;
TL3 = tlist(["3d" "x" "y" "z" "color"],f.x,f.y,f.z,[20*ones(1,400) 6*ones(1,400)]);
e.data = TL3;
TL4 = tlist(["3d" "x" "y" "z"],f.x,f.y,f.z); // no color specified
e.data = TL4;
e.color_flag=1 // color index proportional to altitude (z coord.)
e.color_flag=2; // back to default mode
e.color_flag= 3; // interpolated shading mode (based on blue default color because field data.color is not filled)



See Also

set ,   get ,   delete ,   plot3d ,   plot3d1 ,   plot3d2 ,   graphics_entities ,  

Author

Djalel ABDEMOUCHE

Back