<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) ENPC - Jean-Philippe Chancelier
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="xfpolys" xml:lang="pt">
    <refnamediv>
        <refname>xfpolys</refname>
        <refpurpose>preenche um conjunto de polígonos</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>xfpolys(xpols,ypols,[fill])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>xpols,ypols</term>
                <listitem>
                    <para>matrizes de mesmo tamanho (p,n) (pontos dos polígonos).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>fill</term>
                <listitem>
                    <para>vetor de tamanho n ou tamanho (p,n)</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>
            <literal>xfpolys</literal> preenche um conjunto de polígonos de
            mesmo tamanho definidos pelas matrizes <literal>xpols</literal> e
            <literal>ypols</literal>. As coordenadas de cada polígono são armazenadas
            em uma coluna de <literal>xpols</literal> e
            <literal>ypols</literal>.
        </para>
        <para>Os polígonos podem ser preenchidos por uma dada cor (preenchimento
            monótono) ou pintados com cores interpoladas (preenchimento por
            graduação).
        </para>
        <variablelist>
            <varlistentry>
                <term>preenchimento monótono</term>
                <listitem>
                    <para>
                        Neste caso, <literal>fill</literal> deve ser um vetor de
                        tamanho <literal>n</literal>. O padrão para preenchimento de um
                        polígono de número i é dado por <literal>fill(i)</literal>:
                    </para>
                    <itemizedlist>
                        <listitem>
                            <para>
                                se <literal>fill(i)&lt;0</literal>, o polígono é
                                preenchido com padrão de identificador
                                <literal>-fill(i)</literal>.
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                se <literal>fill(i)=0</literal>, o polígono é desenhado no
                                estilo de traço (ou cor) corrente e não é preenchido.
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                se <literal>fill(i)&gt;0</literal>, o polígono é
                                preenchido com padrão de identificador
                                <literal>fill(i)</literal>. Então seu contorno é desenhado com o
                                estilo de traço (ou cor) corrente e fechado, se
                                necessário.
                            </para>
                        </listitem>
                    </itemizedlist>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>preenchimento interpolado</term>
                <listitem>
                    <para>
                        Neste caso, <literal>fill</literal> deve ser uma matriz com o
                        mesmo mesmo tamanho de <literal>xpols</literal> e
                        <literal>ypols</literal>. Note que <literal>p</literal> deve ser
                        igual a 3 ou 4.
                    </para>
                    <para>
                        <literal>fill(k,i)</literal> fornece a cor da
                        <literal>k</literal> -ésima borda do polígono
                        <literal>i</literal>.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Exemplos</title>
        <programlisting role="example"><![CDATA[
a=gca();
a.data_bounds=[0,-10;210,40];
a.foreground=color('red');
x1=[0,10,20,30,20,10,0]';
y1=[15,30,30,15,0,0,15]';
xpols=[x1 x1 x1 x1];
xpols=xpols+[0,60,120,180].*.ones(x1);
ypols=[y1 y1 y1 y1];
xfpolys(xpols,ypols,[-1,0,1,2])
 ]]></programlisting>
        <scilab:image>
            a=gca();
            a.data_bounds=[0,-10;210,40];
            a.foreground=color('red');
            x1=[0,10,20,30,20,10,0]';
            y1=[15,30,30,15,0,0,15]';
            xpols=[x1 x1 x1 x1];
            xpols=xpols+[0,60,120,180].*.ones(x1);
            ypols=[y1 y1 y1 y1];
            xfpolys(xpols,ypols,[-1,0,1,2])
        </scilab:image>

        <programlisting role="example"><![CDATA[
// cores interpoladas
clf()
f=gcf();
a=gca();
a.data_bounds=[0,-10;40,30];
isoview();
x1=[0,10,20,10]';
y1=[10,0,10,20]';
c=linspace(2,100,4)';
xpols=[x1 x1+20 x1+10 x1+10];
ypols=[y1 y1    y1+10 y1-10];
cols= [c c($:-1:1) c([3 4 1 2]) c]
f.color_map=jet(max(cols));
xfpolys(xpols,ypols,cols)
 ]]></programlisting>
        <scilab:image>
            f=gcf();
            a=gca();
            a.data_bounds=[0,-10;40,30];
            isoview();
            x1=[0,10,20,10]';
            y1=[10,0,10,20]';
            c=linspace(2,100,4)';
            xpols=[x1 x1+20 x1+10 x1+10];
            ypols=[y1 y1    y1+10 y1-10];
            cols= [c c($:-1:1) c([3 4 1 2]) c]
            f.color_map=jet(max(cols));
            xfpolys(xpols,ypols,cols)
        </scilab:image>
        <programlisting role="example"><![CDATA[
// cores interpoladas
clf()
f=gcf();
x11=[0;20;20;0];
y11=[10;10;30;30];
c11=[10;10;30;30];
x12=x11;
y12=y11+20;
c12=[20;20;1;1];
c12=[30;30;10;10];
x21=[0;30;30;0]+22;
y21=[20;20;30;30];
c21=[20;20;30;30];
x22=x21;
y22=y21+10;
c22=[30;30;20;20];
x31=[0;40;40;0]+55;
y31=[0;0;30;30];
c31=[0;0;30;30];
x32=x31;
y32=y31+30;
c32=[30;30;0;0];
X=[x11 x12 x21 x22 x31 x32];
Y=[y11 y12 y21 y22 y31 y32];
C=([c11 c12 c21 c22 c31 c32]+1)*5;
a=gca();
isoview();
a.data_bounds=[min(X),min(Y);max(X),max(Y)];
f=gcf();
f.color_map=gray(max(C));
xfpolys(X,Y,C)
 ]]></programlisting>
        <scilab:image>
            clf()
            f=gcf();
            x11=[0;20;20;0];
            y11=[10;10;30;30];
            c11=[10;10;30;30];
            x12=x11;
            y12=y11+20;
            c12=[20;20;1;1];
            c12=[30;30;10;10];
            x21=[0;30;30;0]+22;
            y21=[20;20;30;30];
            c21=[20;20;30;30];
            x22=x21;
            y22=y21+10;
            c22=[30;30;20;20];
            x31=[0;40;40;0]+55;
            y31=[0;0;30;30];
            c31=[0;0;30;30];
            x32=x31;
            y32=y31+30;
            c32=[30;30;0;0];
            X=[x11 x12 x21 x22 x31 x32];
            Y=[y11 y12 y21 y22 y31 y32];
            C=([c11 c12 c21 c22 c31 c32]+1)*5;
            a=gca();
            isoview();
            a.data_bounds=[min(X),min(Y);max(X),max(Y)];
            f=gcf();
            f.color_map=gray(max(C));
            xfpolys(X,Y,C)
        </scilab:image>
    </refsection>
    <refsection role="see also">
        <title>Ver Também</title>
        <simplelist type="inline">
            <member>
                <link linkend="xfpoly">xfpoly</link>
            </member>
            <member>
                <link linkend="xpoly">xpoly</link>
            </member>
            <member>
                <link linkend="xpolys">xpolys</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
