<?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:ns3="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="xsegs" xml:lang="pt">
    <refnamediv>
        <refname>xsegs</refname>
        <refpurpose>desenha segmentos desconexos</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>xsegs(xv,yv,[style])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>xv,yv</term>
                <listitem>
                    <para>matrizes de mesmo tamanho </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>style</term>
                <listitem>
                    <para>
                        vetor ou escalar. Se <literal>style</literal> is a positive
                        scalar, it gives the color to use for all segments. Se
                        <literal>style</literal> for negativo, então a cor corrente é
                        utilizada. Se <literal>style</literal> for um vetor, então
                        <literal>style(i)</literal> fornece a cor a ser utilizada no
                        segmento <literal>i</literal>.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>
            <literal>xsegs</literal> desenha um conjunto de segmentos desconexos
            dados por <literal>xv</literal> e <literal>yv</literal>. Se
            <literal>xv</literal> e <literal>yv</literal> forem matrizes, serão
            considerados como vetores através da concatenação de suas colunas. As
            coordenadas dos dois pontos definindo um segmento são dadas por dois
            valores consecutivos de <literal>xv</literal> e
            <literal>yv</literal>:
        </para>
        <para>
            <literal>(xv(i),yv(i))--&gt;(xv(i+1),yv(i+1))</literal>.
        </para>
        <para>Por exemplo, utilizando matrizes de tamanho (2,n), os segmentos são
            definidos por:
        </para>
        <programlisting role=""><![CDATA[
xv=[xi_1 xi_2 ...; xf_1 xf_2 ...]
yv=[yi_1 yi_2 ...; yf_1 yf_2 ...]
 ]]></programlisting>
        <para>e os segmentos são
            <literal>(xi_k,yi_k)--&gt;(xf_k,yf_k)</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Exemplos</title>
        <programlisting role="example"><![CDATA[
x=2*%pi*(0:9)/10;
xv=[sin(x);9*sin(x)];
yv=[cos(x);9*cos(x)];
plot2d([-10,10],[-10,10],[-1,-1],"022")
xsegs(xv,yv,1:10)
 ]]></programlisting>
        <programlisting role="example"><![CDATA[

// 2D
plot2d([-10,10],[-10,10],[-1,-1],"022")
xsegs([9, -9],[9 , -9]) // Draw the line from X(9,9) to Y(-9, -9)
xsegs([5, -2],[4 , -1]) // Draw the line from X(5,4) to Y(-2, -1)
 ]]></programlisting>
        <programlisting role="example"><![CDATA[
// 3D
clf();
a=gca();
a.view="3d";
f=gcf();
f.color_map=rainbow(120);
alpha=2*%pi*(0:119)/40;
xv=[sin(alpha)/2;sin(alpha)/3];
yv=[cos(alpha)/2;cos(alpha)/3];
zv=[alpha/8;alpha/8];
xsegs(xv,yv,zv,1:120);
a.data_bounds = [min(xv) min(yv) min(zv); ...
                 max(xv) max(yv) max(zv)];
e = gce();
e.arrow_size = 0.4;

 ]]></programlisting>
    </refsection>
</refentry>
