<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>

  <TITLE>surface_properties</TITLE>

  <TYPE>Scilab Data type</TYPE>

  <DATE>2005</DATE>

  <SHORT_DESCRIPTION name="surface_properties">description of the 3D entities
  properties</SHORT_DESCRIPTION>

  <DESCRIPTION>
    <P>The Surface entity is a leaf of the graphics entities hierarchy. Two
    classes appears under this type of entity : <VERB>Plot3d</VERB> and
    <VERB>Fac3d</VERB> according to the ploting function or the way data is
    entered. <VERB>Fac3d</VERB> and <VERB>Plo3d</VERB> entities are similar
    but <VERB>Fac3d</VERB> is more complete and accept more options than
    <VERB>Plot3d</VERB>. To always have <VERB>Fac3d</VERB> entities, simply
    use <VERB>genfac3d</VERB> to pre-build matrices before using
    <VERB>plot3d</VERB> or use the <VERB>surf</VERB> command.</P>

    <P>Here are the properties contained in a surface entity:</P>

    <DESCRIPTION_INDENT>
      <DESCRIPTION_ITEM label="parent: ">
        <SP>This property contains the handle of the parent. The parent of the
        surface entity should be of type <VERB>"Axes"</VERB> or
        <VERB>"Compound"</VERB>.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="children: ">
        <SP>This property contains a vector with the <VERB>children</VERB> of
        the handle. However, surface handles currently do not have any
        <VERB>children</VERB>.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="visible: ">
        <SP>This field contains the <VERB>visible</VERB> property value for
        the entity . It should be <VERB>"on" </VERB> or <VERB>"off"</VERB> .
        By default, surfaces are visibles, the value's property is
        <VERB>"on"</VERB>. If <VERB>"off"</VERB> the 3D graphics are not
        displayed on the screen.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="surface_mode: ">
        <SP>This field contains the default <VERB>surface_mode</VERB> property
        value for the surface. Its value should be <VERB>"on" </VERB>(surface
        drawn) or <VERB>"off"</VERB> (no surface drawn).</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="foreground: ">
        <SP>If <VERB>color_mode &gt;= 0</VERB>, this field contains the color
        index used to draw the edges. If not, foreground is not used at all.
        The foreground value should be an integer color index (relative to the
        current colormap).</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="thickness: ">
        <SP>This field contains the default <VERB>thickness</VERB> value of
        the lines used to draw the facets contours. It should be a positive
        integer.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="mark_mode: ">
        <SP>This field contains the default <VERB>mark_mode</VERB> property
        value for the surface. Its value should be <VERB>"on"</VERB> (marks
        drawn) or <VERB>"off"</VERB> (no marks drawn).</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="mark_style: ">
        <SP>The <VERB>mark_style</VERB> property value is used to select the
        type of mark to use when <VERB>mark_mode</VERB> property is
        <VERB>"on"</VERB>. The value should be an integer in [0 14] which
        stands for: dot, plus, cross, star, filled diamond, diamond, triangle
        up, triangle down, diamond plus, circle, asterisk, square, triangle
        right, triangle left and pentagram.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="mark_size_unit: ">
        <SP>This field contains the default <VERB>mark_size_unit</VERB>
        property value. If <VERB>mark_size_unit</VERB> is set to
        <VERB>"point"</VERB>, then the <VERB>mark_size</VERB> value is
        directly given in points. When <VERB>mark_size_unit</VERB> is set to
        <VERB>"tabulated"</VERB>, <VERB>mark_size</VERB> is computed relative
        to the font size array: therefore, its value should be an integer in
        [0 5] whith stands for 8pt, 10pt, 12pt, 14pt, 18pt and 24pt. Note that
        <LINK>plot3d</LINK> and pure scilab functions use
        <VERB>tabulated</VERB> mode as default ; when using the
        <LINK>surf</LINK> (or <LINK>plot</LINK> for 2D lines) function, the
        <VERB>point</VERB> mode is automatically enabled.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="mark_size: ">
        <SP>The <VERB>mark_size</VERB> property is used to select the type of
        size of the marks when <VERB>mark_mode</VERB> property is
        <VERB>"on"</VERB>. Its value should be an integer between 0 and 5
        whith stands for 8pt, 10pt, 12pt, 14pt, 18pt and 24pt.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="mark_foreground: ">
        <SP>This field contains the <VERB>mark_foreground</VERB> property
        value which is the marks' edge color. Its value should be a color
        index (relative to the current color_map).</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="mark_background: ">
        <SP>This field contains the <VERB>mark_background</VERB> property
        value which is the marks' face color. Its value should be a color
        index (relative to the current color_map).</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="data: ">
        <SP>This field defines a <VERB>tlist</VERB> 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
        <VERB>data.x</VERB>,<VERB>data.y</VERB> and <VERB>data.z</VERB>. The
        complementary field named <VERB>data.color</VERB> is available in case
        a real color vector or matrix is specified. If none,
        <VERB>data.color</VERB> is not listed. The surface is painted
        according to <VERB>color_mode </VERB>and <VERB>color_flag</VERB>
        properties. </SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="color_mode: ">
        <SP>an integer between <VERB>[-size(colormap) ; size(colormap)]</VERB>
        defining the color of the facet when <VERB>color_flag</VERB> value is
        <VERB>0</VERB>. As stated before, if<VERB> color_mode &gt; 0</VERB>,
        edges are drawn using <VERB>foreground</VERB> color. If
        <VERB>color_mode</VERB> is set to <VERB>0</VERB>, a mesh of the
        surface is drawn: front faces have no colors. Finally, when
        <VERB>color_mode &lt; 0</VERB>, front faces are painted with color
        <VERB>-color_mode</VERB> but no edges are displayed.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="color_flag: ">
        <SP>This field is used to specify the algorithm used to set facets'
        colors.</SP>

        <SP>Not that the rules on <VERB>color_mode</VERB>,
        <VERB>foreground</VERB> and <VERB>hiddencolor</VERB> are still applied
        to this case.</SP>

        <DESCRIPTION_INDENT>
          <DESCRIPTION_ITEM>
            <P><VERB>color_flag == 0</VERB></P>

            <DESCRIPTION_INDENT>
              <DESCRIPTION_ITEM>
                <P>All facets are painted using the color index and method
                defined by <VERB>color_mode</VERB> (see above).</P>
              </DESCRIPTION_ITEM>
            </DESCRIPTION_INDENT>
          </DESCRIPTION_ITEM>

          <DESCRIPTION_ITEM>
            <P><VERB>color_flag == 1</VERB></P>

            <DESCRIPTION_INDENT>
              <DESCRIPTION_ITEM>
                <P>All facets are painted using one color index per facet
                proportional to <VERB>z</VERB>. The minimum <VERB>z</VERB>
                value is painted using the index 1 color while the maximum
                <VERB>z</VERB> value is painted using highest color index. The
                edges of the facets can be additionnaly drawn depending on the
                value of <VERB>color_mode</VERB> (see above).</P>
              </DESCRIPTION_ITEM>
            </DESCRIPTION_INDENT>
          </DESCRIPTION_ITEM>

          <DESCRIPTION_ITEM>
            <P>The 3 remaining cases (<VERB>color_flag</VERB><VERB>== 2,3 or
            4</VERB>) are only available only with <VERB>Fac3d</VERB> entity.
            Then, the <VERB>data.color</VERB> value is used to set colors for
            facets (indices in the current colormap) if it exists. If not, the
            current <VERB>color_mode</VERB> is used to paint the facets.</P>
          </DESCRIPTION_ITEM>

          <DESCRIPTION_ITEM>
            <P><VERB>color_flag == 2 ('flat' shading)</VERB></P>

            <DESCRIPTION_INDENT>
              <DESCRIPTION_ITEM>
                <P>All facets are painted using the color index given in the
                <VERB>data.color</VERB> property (one color per facet is
                needed). Two cases are then possible :</P>
              </DESCRIPTION_ITEM>

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

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

          <DESCRIPTION_ITEM>
            <P><VERB>color_flag == 3 ('interpolated' shading)</VERB></P>

            <DESCRIPTION_INDENT>
              <DESCRIPTION_ITEM>
                <P>Facets painting results of interpolation of vertices
                colors. The indices of vertices color are given in the
                <VERB>data.color</VERB> property (one color per vertex is
                needed). Two cases are possible :</P>
              </DESCRIPTION_ITEM>

              <DESCRIPTION_ITEM>
                <P><VERB>data.color</VERB> contains a <VERB>colors</VERB>
                vector : then, there are too few data to complete the
                interpolated shading mode. Indeed, a color matrix of size
                (nf,n) (where <VERB>n</VERB> stands for the number of facets
                and <VERB>nf</VERB> 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 <VERB>nf</VERB> color indexes vertices
                defining the facet's boundary.</P>

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

          <DESCRIPTION_ITEM>
            <P><VERB>color_flag == 4 (Matlab-like 'flat' shading)</VERB></P>

            <DESCRIPTION_INDENT>
              <DESCRIPTION_ITEM>
                <P>Same as <VERB>color_flag==2</VERB> with a slight difference
                when <VERB>data.color</VERB> is a matrix. All facets are
                painted using the color index given in the
                <VERB>data.color</VERB> property (one color per facet is
                needed). Two cases are then possible :</P>
              </DESCRIPTION_ITEM>

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

                <P><VERB>data.color</VERB> contains a color matrix of size
                (nf,n) where <VERB>n</VERB> stands for the number of facets
                and <VERB>nf</VERB> for the number of points defining the
                polygonal facet. For the <VERB>nf</VERB> vertices defining
                each facet, the algorithm takes the<TT> color of the first
                vertex</TT> defining the patch (facet).</P>
              </DESCRIPTION_ITEM>
            </DESCRIPTION_INDENT>
          </DESCRIPTION_ITEM>
        </DESCRIPTION_INDENT>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="cdata_mapping: ">
        <SP><VERB>Specific to Fac3d handles</VERB>. A string with value
        <VERB>'scaled'</VERB> or <VERB>'direct'</VERB>. If a
        <VERB>data.color</VERB> is set, each index color data specifies a
        single value for each vertex. <VERB>cdata_mapping</VERB> determines
        wether those indices are scaled to map linearly into the current
        colormap (<VERB>'scaled'</VERB> mode) or point directly into this
        colormap (<VERB>'direct</VERB>' mode). This property is usefull when
        <VERB>color_flag</VERB> equals <VERB>2</VERB>,<VERB>3</VERB> or
        <VERB>4</VERB>.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="hiddencolor: ">
        <SP>This field contains the color index used to draw the backward
        faces of a surface. Its value should be a positive integer (color
        index relative to the current colormap). If it is a negative
        integer,the same color than the "visible" face is applied to the rear
        face.</SP>
      </DESCRIPTION_ITEM>

      <DESCRIPTION_ITEM label="user_data: ">
        <SP>This field can be use to store any scilab variable in the surface
        data structure, and to retreive it.</SP>
      </DESCRIPTION_ITEM>
    </DESCRIPTION_INDENT>
  </DESCRIPTION>

  <EXAMPLE><![CDATA[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,0,-1;6,6,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 and use surf command
subplot(211)
surf(z,'cdata_mapping','direct','facecol','interp')

subplot(212)
surf(t,t,z,'edgeco','b','marker','d','markersiz',9,'markeredg','red','markerfac','k')
e=gce();
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)


]]></EXAMPLE>

  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>set</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>get</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>delete</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>plot3d</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>plot3d1</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>plot3d2</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>surf</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>graphics_entities</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>

  <AUTHOR>Djalel ABDEMOUCHE &amp; F.Leray</AUTHOR>
</MAN>