* Bug 15392 fixed: comet() comet3d() with named|#RRGGBB|[r g b] colors 11/19711/16
Samuel GOUGEON [Tue, 30 Jan 2018 23:52:26 +0000 (00:52 +0100)]
  http://bugzilla.scilab.org/15392

  comet() updated page: http://bugzilla.scilab.org/attachment.cgi?id=5042

  Complies with iscolor() extension @ https://codereview.scilab.org/21197

Change-Id: Ifb9830a6c7946569de7355af0a204aa0b3ccc046

scilab/CHANGES.md
scilab/modules/graphics/help/en_US/2d_plot/comet.xml
scilab/modules/graphics/help/en_US/3d_plot/comet3d.xml
scilab/modules/graphics/help/images/comet_1.png [new file with mode: 0644]
scilab/modules/graphics/help/images/comet_2.png [new file with mode: 0644]
scilab/modules/graphics/help/ja_JP/2d_plot/comet.xml
scilab/modules/graphics/help/ja_JP/3d_plot/comet3d.xml
scilab/modules/graphics/help/ru_RU/2d_plot/comet.xml
scilab/modules/graphics/macros/comet.sci
scilab/modules/graphics/macros/comet3d.sci

index 2b5a9fd..b27f19f 100644 (file)
@@ -125,7 +125,7 @@ Help pages:
 -----------
 
 * overhauled / rewritten: `bitget`, `edit`
-* fixed / improved:  `bench_run` `M_SWITCH`
+* fixed / improved:  `bench_run` `M_SWITCH`, `comet`, `comet3d`
 
 User Interface improvements:
 ----------------------------
@@ -170,7 +170,7 @@ Bug Fixes
 ### Bugs fixed in 6.1.0:
 * [#2694](http://bugzilla.scilab.org/show_bug.cgi?id=2694): `bitget` did not accept positive integers of types int8, int16 or int32.
 * [#7724](http://bugzilla.scilab.org/show_bug.cgi?id=7724): When a figure is created in .auto_resize="on" mode, its .axes_size sets its .figure_size accordingly, not the reverse. But this was not documented.
-* [#7765](http://bugzilla.scilab.org/show_bug.cgi?id=7765): `champ1()` is useless. `champ().colored` is available for a long time. 
+* [#7765](http://bugzilla.scilab.org/show_bug.cgi?id=7765): `champ1()` is useless. `champ().colored` is available for a long time.
 * [#7967](http://bugzilla.scilab.org/show_bug.cgi?id=7967): The tricky size `[ny,nx]` of `meshgrid(x,y)` results and usages with graphics was not enough documented.
 * [#8307](http://bugzilla.scilab.org/show_bug.cgi?id=8307): `list2vec()` and `vec2list()` were located in the [optimization] module instead of in [data_structures], and were missing in the `See also` section of `list()`.
 * [#8784](http://bugzilla.scilab.org/show_bug.cgi?id=8784): Automatic self-adjusting blocks `SCALE_CSCOPE` & `SCALE_CMSCOPE` in Xcos.
@@ -203,6 +203,7 @@ Bug Fixes
 * [#15271](http://bugzilla.scilab.org/show_bug.cgi?id=15271): `bitget` needed to be upgraded.
 * [#15321](http://bugzilla.scilab.org/show_bug.cgi?id=15321): `lu()` was leaking memory.
 * [#15368](http://bugzilla.scilab.org/show_bug.cgi?id=15368): `freson()` silently returned frequencies not corresponding to a maximum, or returned [] instead of some still computable maxima frequencies.
+* [#15392](http://bugzilla.scilab.org/show_bug.cgi?id=15392): `comet` and `comet3d` did not allow specifying colors with colors names.
 * [#15425](http://bugzilla.scilab.org/show_bug.cgi?id=15425): The Kronecker product `a.*.b` failed when `a` or `b` or both are hypermatrices, with one or both being polynomials or rationals.
 * [#15451](http://bugzilla.scilab.org/show_bug.cgi?id=15451): The code was not adapted to use `lucene 4.10` in Debian.
 * [#15523](http://bugzilla.scilab.org/show_bug.cgi?id=15523): `%ODEOPTIONS(1)=2` didn't work with solvers 'rk' and 'rkf'
@@ -248,7 +249,7 @@ Bug Fixes
 * [#16118](http://bugzilla.scilab.org/show_bug.cgi?id=16118): `%s <> (1+%s)` returned %F.
 * [#16135](http://bugzilla.scilab.org/show_bug.cgi?id=16135): base2dec did not detect invalid numbers.
 * [#16139](http://bugzilla.scilab.org/show_bug.cgi?id=16139): `auread()` and `auwrite()` kept the sound file open and locked when returning on errors. They poorly handled the default .au sound file extension.
-* [#16143](http://bugzilla.scilab.org/show_bug.cgi?id=16143): `clc(n)` cleared n+1 lines instead of n>0. Thus, it was not possible to clear only one line. 
+* [#16143](http://bugzilla.scilab.org/show_bug.cgi?id=16143): `clc(n)` cleared n+1 lines instead of n>0. Thus, it was not possible to clear only one line.
 * [#16144](http://bugzilla.scilab.org/show_bug.cgi?id=16144): Addition of sparse matrices gave incorrect results.
 * [#16149](http://bugzilla.scilab.org/show_bug.cgi?id=16149): `fullpath` did not support symbolic links in paths
 * [#16152](http://bugzilla.scilab.org/show_bug.cgi?id=16152): For sparse or boolean sparse matrix `s`, `s([])` returned `[]` instead of `sparse([])`.
index 0a4487e..6c975ff 100644 (file)
@@ -2,8 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) Serge Steer
- *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2018-2019 - Samuel GOUGEON
  *
  * 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.
  * 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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en_US" xml:id="comet">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+          xml:lang="en_US" xml:id="comet">
     <refnamediv>
         <refname>comet</refname>
-        <refpurpose>2D comet animated plot. </refpurpose>
+        <refpurpose>2D comet animated plot</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
             comet(y)
-            comet(x,y)
-            comet(x,fun)
-            comet(x,y,p)
-            comet(x,fun,p)
-            comet(...,"colors",c)
+            comet(x, y)
+            comet(x, y, Lf)
+            comet(x, fun)
+            comet(x, fun, Lf)
+            comet(..., "colors",c)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>
-                        a real vector or matrix. If omitted, it is assumed to be the vector
-                        <literal>1:ny</literal> where <literal>ny</literal> is the
-                        number of curve points (see below).
-                    </para>
+                    a real vector or matrix. If omitted, it is assumed to be the vector
+                    <literal>1:np</literal> where <literal>np</literal> is the total number of
+                    curve points (see below). As a matrix, each column defines the abscissae
+                    of the trace of a separate comet.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>
-                        a real vector or matrix of length.
-                    </para>
+                    a real vector or matrix. As a matrix, each column defines the  ordinates
+                    of the trace of a separate comet.
+                    <literal>nc=size(y,"c")</literal> is the number of comets simultaneously drawn.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>p</term>
+                <term>Lf</term>
                 <listitem>
-                    <para>
-                        a real scalar in the interval<literal>[0 1[</literal>. Default value is 0.1.
-                    </para>
+                    a real scalar in the interval<literal>[0,1[</literal>. Default value is 0.1:
+                    It defines the Leading fraction of the comet's trace.
+                    The <literal>k=Lf*np</literal> most recent points are plotted in thicker line.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>fun</term>
                 <listitem>
-                    <para>
-                        a scilab function with syntax <literal>y=fun(x)</literal>.  <varname>fun</varname> can also be a polynomial or a rational fraction.
-                    </para>
+                    a scilab function with syntax <literal>y = fun(x)</literal>.
+                    <varname>fun</varname> can also be a polynomial or a rational fraction.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>c</term>
                 <listitem>
-                    <para>
-                        a vector of  <literal>ny</literal> color index.
-                    </para>
+                    <literal>nc</literal> colors of the <literal>nc</literal> comets traces.
+                    They may be specified as a vector of <literal>nc</literal> color indices or
+                    <link linkend="color_list">color names</link> or "#RRGGBB" hexadecimal
+                    color codes. Or by a matrix (ncx3) of <literal>[r,g,b]</literal> vectors of
+                    Red-Green-Blue intensities in the [0,1] interval.
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            If <literal>(x,y)</literal> are two vectors with the same number
-            of elements, this function draws a 2D comet animated plot
-            showing the progression of the curve
-            <literal>(x(1:k),y(1:k))</literal> for <literal>k</literal>
-            varying from <literal>1</literal> to
-            <literal>size(x,'*')</literal>.
+            If <literal>(x,y)</literal> are two vectors, this function draws a 2D comet animated
+            plot showing the progression of the curve <literal>(x(1:m),y(1:m))</literal> for
+            <literal>m</literal> varying from <literal>1</literal> to
+            <literal>np=length(x)</literal>.
         </para>
         <para>
             The plot is made of three parts:
-            <variablelist>
-                <varlistentry>
-                    <term>a head</term>
-                    <listitem>
-                        <para>
-                            mark that shows the current <literal>(x(i),y(i))</literal> position.
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>a body</term>
-                    <listitem>
-                        <para>
-                            that shows the trailing curve that follows the head: the
-                            <literal>(x(i-k:i),y(i-k:i))</literal> part of the curve.
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>a tail</term>
-                    <listitem>
-                        <para>
-                            that shows the  <literal>(x(1:i-k),y(1:i-k))</literal> part of the curve.
-                        </para>
-                    </listitem>
-                </varlistentry>
-            </variablelist>
-            <para>
-                <literal>comet(x,fun,...)</literal> is equivalent to <literal>comet(x,feval(x,fun),...)</literal>.
-            </para>
-            <para>
-                <literal>comet(...,p)</literal> can be used to set the
-                relative length of the body. <literal>k</literal> is defined
-                as <code>k = round(p*ny)</code>.
-            </para>
+            <table>
+                <tr><td><emphasis role="bold">a head</emphasis></td>
+                    <td>
+                        mark that shows the current <literal>(x(i),y(i))</literal> position.
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">a body</emphasis></td>
+                    <td>consisting in the <literal>k=round(Lf*np)</literal> most recent points
+                        of the trajectory, displayed as a thicker part of the trace.
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">a tail</emphasis></td>
+                    <td>
+                        that shows the  <literal>(x(1:i-k),y(1:i-k))</literal> part of the curve.
+                    </td>
+                </tr>
+            </table>
             <para>
-                If <varname>y</varname> is a matrix then animated curves
-                are drawn for each pair <literal>(x,y(:,l))</literal>.
-                In this case <literal>ny</literal> is the number of rows
-                of <varname>y</varname>.
+                <literal>comet(x,fun,...)</literal> is equivalent to
+                <literal>comet(x, feval(x,fun),...)</literal>.
             </para>
             <para>
-                If <varname>x</varname> and <varname>y</varname> are
-                matrices with identical sizes then animated curves are drawn
-                for each pair <literal>(x(:,l),y(:,l))</literal>.  In this
-                case <literal>ny</literal> is the number of rows of
+                If <varname>x</varname> and <varname>y</varname> are matrices with identical sizes,
+                then animated curves are drawn for each pair <literal>(x(:,j),y(:,j))</literal>.
+                In this case <literal>np</literal> is the number of rows of
                 <varname>x</varname> and <varname>y</varname>.
             </para>
-
             <para>
-                <literal>comet(...,"colors",c)</literal> can be used to set the colors of each curves.
+                <literal>comet(...,"colors",c)</literal> can be used to set the colors of each
+                trajectory.
             </para>
-
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500);
-clf();
-isoview; //set isoview axes
-comet(t.*sin(t), t.*cos(t))
+// One comet in spiral:
+t = linspace(0, 10*%pi, 500);
+clf, isoview
+comet(t.*sin(t), t.*cos(t), "colors", "orange")
     ]]></programlisting>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="../../images/comet_1.png"/>
+            </imageobject>
+        </inlinemediaobject>
+        <para/>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500)';
-clf();
+// Two simultaneous comets with default colors:
+t = linspace(0, 10*%pi, 500)';
+clf
 comet(t.*sin(t), [t.*sin(2*t) t.*sin(3*t)])
     ]]></programlisting>
+        <para/>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500)';
-clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)],"colors",[3 5])
+// Chosen colors:
+t = linspace(0, 10*%pi, 500)';
+clf
+comet(t.*sin(t), [t.*cos(t) t.*sin(2*t)], "colors", ["orange" "mag"])
     ]]></programlisting>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="../../images/comet_2.png"/>
+            </imageobject>
+        </inlinemediaobject>
+        <para/>
         <programlisting role="example"><![CDATA[
-function y=traj(x)
-  y=1.5*sin(x^2)
+function y = traj(x)
+    y = 1.5*sin(x^2)
 endfunction
-clf();
+clf
 comet(linspace(0,5,500),traj)
     ]]></programlisting>
+        <para/>
         <programlisting role="example"><![CDATA[
-clf();
+clf
 comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))
     ]]></programlisting>
     </refsection>
@@ -175,14 +176,17 @@ comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))
         <title>See also</title>
         <simplelist type="inline">
             <member>
-                <link linkend="color">color</link>
-            </member>
-            <member>
                 <link linkend="comet3d">comet3d</link>
             </member>
             <member>
                 <link linkend="paramfplot2d">paramfplot2d</link>
             </member>
+            <member>
+                <link linkend="realtime">realtime</link>
+            </member>
+            <member>
+                <link linkend="color_list">colors names</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
@@ -191,7 +195,14 @@ comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))
             <revision>
                 <revnumber>5.3.2</revnumber>
                 <revremark>
-                    Function <function>comet</function> introduced.
+                    Function comet() introduced.
+                </revremark>
+            </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revremark>
+                    Colors can now be specified also by their name, or by their "#RRGGBB" hexadecimal
+                    code, or by their [r g b] Red-Green-Blue intensities.
                 </revremark>
             </revision>
         </revhistory>
index 0ee350a..03d5376 100644 (file)
@@ -1,20 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- * Add some comments about XML file
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Serge Steer
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * 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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en_US" xml:id="comet3d">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+          xml:lang="en_US" xml:id="comet3d">
     <refnamediv>
         <refname>comet3d</refname>
-        <refpurpose>3D comet animated plot. </refpurpose>
+        <refpurpose>3D comet animated plot</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
             comet3d(z)
             comet3d(x, y, z)
+            comet3d(x, y, z, Lf)
             comet3d(x, y, fun)
-            comet3d(x, y, z, p)
-            comet3d(x, y, fun, p)
+            comet3d(x, y, fun, Lf)
             comet3d(...,"colors", c)
         </synopsis>
     </refsynopsisdiv>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>
-                        a real vector or matrix. If omitted, it is assumed to be the vector
-                        <literal>1:nz</literal> where <literal>nz</literal> is the
-                        number of curve points given by the <literal>z</literal>
-                        parameter.
-                    </para>
+                    a real vector or matrix. Default = <literal>1:np</literal>,
+                    <literal>np</literal> being the number of points of the trajectory.
+                    As a matrix, each column defines the x coordinates of the trace of an
+                    individual comet.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>
-                        a real vector or matrix. If omitted, it is assumed to be the vector
-                        <literal>1:nz</literal> where <literal>nz</literal> is the
-                        number of curve points given by the <literal>z</literal>
-                        parameter.
-                    </para>
+                    a real vector (default value = <literal>1:np</literal>) or matrix.
+                    As a matrix, each column defines the y coordinates of the trace of an
+                    individual comet.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>z</term>
                 <listitem>
-                    <para>
-                        a real vector of length <literal>nz</literal> or a matrix with  <literal>nz</literal> rows.
-                    </para>
+                    a real vector of length <literal>np</literal>, or a matrix with
+                    <literal>np</literal> rows. As a matrix, each column defines the z
+                    coordinates of the trace of an individual comet.
+                    <literal>nc=size(z,"c")</literal> is the number of comets simultaneously drawn.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>p</term>
+                <term>Lf</term>
                 <listitem>
-                    <para>
-                        a real scalar in the interval<literal>[0 1[</literal>. Default value is 0.1.
-                    </para>
+                    a real scalar in the interval<literal>[0,1[</literal>. Default value is 0.1:
+                    It defines the Leading fraction of the comet's trace.
+                    The <literal>k=Lf*np</literal> most recent points are plotted in thicker line.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>fun</term>
                 <listitem>
-                    <para>
-                        a scilab function with syntax <literal>z=fun(x,y)</literal>.
-                    </para>
+                    a scilab function with syntax <literal>z=fun(x,y)</literal>.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>c</term>
                 <listitem>
-                    <para>
-                        a vector of  <literal>ny</literal> color index.
-                    </para>
+                    <literal>nc</literal> colors of the <literal>nc</literal> comets traces.
+                    They may be specified as a vector of <literal>nc</literal> color indices or
+                    <link linkend="color_list">color names</link> or "#RRGGBB" hexadecimal
+                    color codes. Or by a matrix (ncx3) of <literal>[r,g,b]</literal> vectors of
+                    Red-Green-Blue intensities in the [0,1] interval.
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            If <literal>(x,y,z)</literal> are three vectors with the same number of elements, this function draws a 3D comet
-            animated plot. The plot is made of three parts:
-            <variablelist>
-                <varlistentry>
-                    <term>ahead</term>
-                    mark that shows the current <literal>(x(i),y(i),z(i))</literal> position.
-                    <listitem><para>
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>abody</term> that shows the trailing curve that
-                    follows the head: the
-                    <literal>(x(i-k:i),y(i-k:i),z(i-k:i))</literal>) part of the curve.
-                    <listitem><para>
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>atail</term>
-                    that shows the  <literal>(x(1:i-k),y(1:i-k),z(1:i-k))</literal>  part of the curve.
-                    <listitem><para>
-                        </para>
-                    </listitem>
-                </varlistentry>
-            </variablelist>
+            If <literal>(x,y,z)</literal> are three vectors with the same number of elements, this
+            function draws a 3D comet animated plot. The plot is made of three parts:
+            <table>
+                <tr><td><emphasis role="bold">a head</emphasis></td>
+                    <td>
+                        mark that shows the current <literal>(x(i),y(i),z(i))</literal> position.
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">a body</emphasis></td>
+                    <td>consisting in the <literal>k=round(Lf*np)</literal> most recent points
+                        of the trajectory, displayed as a thicker part of the trace.
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">a tail</emphasis></td>
+                    <td>
+                    that shows the  <literal>[x(1:i-k), y(1:i-k), z(1:i-k)]</literal> part of the curve.
+                    </td>
+                </tr>
+            </table>
             <para>
-                if <literal>z</literal> is a matrix and
-                <literal>(x,y)</literal> are vectors then animated curves
-                are drawn for each triple <literal>(x,y,z(:,l))</literal>.
-                in this case <literal>nz</literal> is the number of rows of
-                <literal>z</literal>.
+                if <literal>z</literal> is a matrix and <literal>x</literal> and <literal>y</literal>
+                are vectors, then animated curves are drawn for each triple
+                <literal>(x, y, z(:,j))</literal>.
             </para>
             <para>
                 if <literal>x,y,z</literal> are matrices with the same dimensions then animated curves
-                are drawn for each triple <literal>(x(:,l),y(:,l),z(:,l))</literal>.
+                are drawn for each triple <literal>(x(:,j), y(:,j), z(:,j))</literal>.
             </para>
-
             <para>
-                <literal>comet3d(x,y,fun,...)</literal> computes the
-                <literal>z</literal> vector as
-                <literal>z(i)=fun(x(i),y(i))</literal>
+                <literal>comet3d(x, y, fun,...)</literal> computes the <literal>z</literal> vector as
+                <literal>z(i)=fun(x(i),y(i))</literal>.
             </para>
             <para>
-                <literal>comet3d(...,p)</literal> can be used to set the
-                relative length of the body. <literal>k</literal> is defined
-                as <literal>k = round(p*nz)</literal>.
+                <literal>comet3d(..,"colors",c)</literal> can be used to set the colors of each
+                trajectory.
             </para>
-
         </para>
     </refsection>
     <refsection>
@@ -144,10 +146,16 @@ clf
 comet3d(sin(5*t), sin(t), [t.^2,ones(t)])
     ]]></programlisting>
         <programlisting role="example"><![CDATA[
+// Chosen colors:
+t = linspace(0, 10*%pi, 500)';
+clf, gca().rotation_angles = [26, 112];
+comet3d(t.*sin(t), t, [t.*sin(2*t) t.*sin(3*t)], "colors", ["orange" "red"])
+    ]]></programlisting>
+        <programlisting role="example"><![CDATA[
 t = linspace(-%pi,%pi,500)';
-function z=traj(x,y),z=1.5*sin(x^2)*cos(y),endfunction
+function z = traj(x,y), z = 1.5*sin(x^2)*cos(y), endfunction
 clf
-comet3d(cos(t), sin(t), traj)
+comet3d(cos(t),sin(t),traj)
     ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -156,6 +164,15 @@ comet3d(cos(t), sin(t), traj)
             <member>
                 <link linkend="comet">comet</link>
             </member>
+            <member>
+                <link linkend="paramfplot2d">paramfplot2d</link>
+            </member>
+            <member>
+                <link linkend="realtime">realtime</link>
+            </member>
+            <member>
+                <link linkend="color_list">colors names</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
@@ -163,7 +180,14 @@ comet3d(cos(t), sin(t), traj)
         <revhistory>
             <revision>
                 <revnumber>5.3.2</revnumber>
-                <revremark>Function comet3d introduced</revremark>
+                <revremark>Function comet3d() introduced.</revremark>
+            </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revremark>
+                    Colors can now be specified also by their name, or by their "#RRGGBB" hexadecimal
+                    code, or by their [r g b] Red-Green-Blue intensities.
+                </revremark>
             </revision>
         </revhistory>
     </refsection>
diff --git a/scilab/modules/graphics/help/images/comet_1.png b/scilab/modules/graphics/help/images/comet_1.png
new file mode 100644 (file)
index 0000000..01b7935
Binary files /dev/null and b/scilab/modules/graphics/help/images/comet_1.png differ
diff --git a/scilab/modules/graphics/help/images/comet_2.png b/scilab/modules/graphics/help/images/comet_2.png
new file mode 100644 (file)
index 0000000..dbc1ecb
Binary files /dev/null and b/scilab/modules/graphics/help/images/comet_2.png differ
index 669bf26..5d542df 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) Serge Steer
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * 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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="comet">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+          xml:lang="ja" xml:id="comet">
     <refnamediv>
         <refname>comet</refname>
-        <refpurpose>2次元 comet アニメーションプロット. </refpurpose>
+        <refpurpose>2次元 comet アニメーションプロット</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>呼び出し手順</title>
-        <synopsis>comet(y)</synopsis>
-        <synopsis>comet(x,y)</synopsis>
-        <synopsis>comet(x,fun)</synopsis>
-        <synopsis>comet(x,y,p)</synopsis>
-        <synopsis>comet(x,fun,p)</synopsis>
-        <synopsis>comet(...,"colors",c)</synopsis>
+        <synopsis>
+            comet(y)
+            comet(x, y)
+            comet(x, y, Lf)
+            comet(x, fun)
+            comet(x, fun, Lf)
+            comet(..., "colors",c)
+        </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>パラメータ</title>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>
-                        実数ベクトルまたは行列. 省略された場合,
-                        ベクトル <literal>1:ny</literal> が指定されたと仮定されます.
-                        ただし,<literal>ny</literal> は曲線の点の数(下記参照)です.
-                    </para>
+                    実数ベクトルまたは行列. 省略された場合,
+                    ベクトル <literal>1:np</literal> が指定されたと仮定されます.
+                    ただし,<literal>np</literal> は曲線の点の数(下記参照)です.
+                    行列として、各列は別々の彗星の軌跡の水平座標を定義します。
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>
-                        長さの実数ベクトルまたは行列.
-                    </para>
+                    長さの実数ベクトルまたは行列. 行列として、各列は別々の彗星の軌跡の縦座標を定義します。
+                    <literal>nc=size(y,"c")</literal>  は、同時に描画される彗星の数です。
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>p</term>
+                <term>Lf</term>
                 <listitem>
-                    <para>
-                        範囲 <literal>[0 1[</literal> の実数スカラー.
-                        デフォルト値は 0.1です.
-                    </para>
+                    範囲 <literal>[0 1[</literal> の実数スカラー. デフォルト値は 0.1です.
+                    これは、彗星の痕跡のLeading fractionを定義します。最近の点は太い線でプロットされています
+                    (<literal>k=Lf*np</literal>)。
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>fun</term>
                 <listitem>
-                    <para>
-                        呼び出し手順  <literal>y=fun(x)</literal> のScilab関数.
-                        <varname>fun</varname> は多項式または有理数とすることもできます.
-                    </para>
+                    呼び出し手順  <literal>y=fun(x)</literal> のScilab関数.
+                    <varname>fun</varname> は多項式または有理数とすることもできます.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>c</term>
                 <listitem>
-                    <para>
-                        <literal>ny</literal> 色添字のベクトル.
-                    </para>
+                    <literal>nc</literal> colors of the <literal>nc</literal> comets traces.
+                    They may be specified as a vector of <literal>nc</literal> color indices or
+                    <link linkend="color_list">color names</link> or "#RRGGBB" hexadecimal
+                    color codes. Or by a matrix (ncx3) of <literal>[r,g,b]</literal> vectors of
+                    Red-Green-Blue intensities in the [0,1] interval.
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
         <para>
             <literal>(x,y)</literal> が同じ要素数のベクトルの場合,
             この関数は,
-            <literal>k</literal>を<literal>1</literal> から
-            <literal>size(x,'*')</literal>まで変えて
-            曲線<literal>(x(1:k),y(1:k))</literal>の漸進を示す
+            <literal>m</literal>を<literal>1</literal> から
+            <literal>np=length(x)</literal>まで変えて
+            曲線<literal>(x(1:m), y(1:m))</literal>の漸進を示す
             2次元アニメーションプロットを描画します.
         </para>
         <para>
             このプロットは以下の3つの部分から構成されます:
-            <variablelist>
-                <varlistentry>
-                    <term>ヘッド</term>
-                    <listitem>
-                        <para>
-                            カレントの位置<literal>(x(i),y(i))</literal>を示すマーカ.
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>ボディ</term>
-                    <listitem>
-                        <para>
-                            ヘッドにつらなる曲線を表示します:曲線の一部
-                            <literal>(x(i-k:i),y(i-k:i))</literal>.
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>テール</term>
-                    <listitem>
-                        <para>
-                            曲線の<literal>(x(1:i-k),y(1:i-k))</literal>の部分を表示.
-                        </para>
-                    </listitem>
-                </varlistentry>
-            </variablelist>
-            <para>
-                <literal>comet(x,fun,...)</literal>  は, <literal>comet(x,feval(x,fun),...)</literal> と等価です.
-            </para>
-            <para>
-                <literal>comet(...,p)</literal> はボディの相対的な長さを設定する
-                際に使用することができます.
-                <literal>k</literal> は
-                <literal>k = round(p*ny)</literal>のように定義できます.
-            </para>
-            <para>
-                <varname>y</varname> が行列の場合,
-                曲線のアニメーション表示が,
-                <literal>(x,y(:,l))</literal>の各組について描画されます.
-                この場合, <literal>ny</literal> は<varname>y</varname>の
-                行の数です.
-            </para>
-            <para>
-                <varname>x</varname> および <varname>y</varname> は
-                同じ大きさの行列の場合,
-                各組  <literal>(x(:,l),y(:,l))</literal> 毎に.
-                アニメーション表示された曲線が描画されます.
-                この場合, <literal>ny</literal>は
-                <varname>x</varname>および  <varname>y</varname>の
-                行の数です.
-            </para>
-            <para>
-                <literal>comet(...,"colors",c)</literal> は
-                各曲線の色を設定する際に使用できます.
-            </para>
+            <table>
+                <tr><td><emphasis role="bold">ヘッド</emphasis></td>
+                    <td>カレントの位置<literal>(x(i),y(i))</literal>を示すマーカ.</td>
+                </tr>
+                <tr><td><emphasis role="bold">ボディ</emphasis></td>
+                    <td>
+                        軌跡の最も最近の点である<literal>k=round(Lf*np)</literal>
+                        で構成され、トレースのより厚い部分として表示されます。
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">テール</emphasis></td>
+                    <td>
+                        曲線の<literal>(x(1:i-k),y(1:i-k))</literal>の部分を表示.
+                    </td>
+                </tr>
+            </table>
+        </para>
+        <para>
+            <literal>comet(x,fun,...)</literal> は, <literal>comet(x,feval(x,fun),...)</literal>
+            と等価です.
+        </para>
+        <para>
+            <varname>x</varname> および <varname>y</varname> は
+            同じ大きさの行列の場合, 各組  <literal>(x(:,l),y(:,l))</literal> 毎に.
+            アニメーション表示された曲線が描画されます.
+            この場合, <literal>np</literal>は
+            <varname>x</varname>および  <varname>y</varname>の 行の数です.
+        </para>
+        <para>
+            <literal>comet(...,"colors",c)</literal> は各曲線の色を設定する際に使用できます.
         </para>
     </refsection>
     <refsection>
         <title>例</title>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500);
-clf();set(gca(),"isoview","on"); // 等軸に設定
-comet(t.*sin(t),t.*cos(t))
+// One comet in spiral:
+t = linspace(0, 10*%pi, 500);
+clf, isoview
+comet(t.*sin(t), t.*cos(t), "colors", "orange")
     ]]></programlisting>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="../../images/comet_1.png"/>
+            </imageobject>
+        </inlinemediaobject>
+        <para/>
         <programlisting role="example"><![CDATA[
+// Two simultaneous comets with default colors:
 t = linspace(0,10*%pi,500)';
-clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)])
+clf
+comet(t.*sin(t), [t.*sin(2*t) t.*sin(3*t)])
     ]]></programlisting>
+        <para/>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500)';
-clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)],"colors",[3 5])
+// Chosen colors:
+clf
+comet(t.*sin(t), [t.*cos(t) t.*sin(2*t)], "colors", ["orange" "mag"])
     ]]></programlisting>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="../../images/comet_2.png"/>
+            </imageobject>
+        </inlinemediaobject>
+        <para/>
         <programlisting role="example"><![CDATA[
-function y=traj(x),y=1.5*sin(x^2),endfunction
-clf();comet(linspace(0,5,500),traj)
+function y = traj(x)
+  y = 1.5*sin(x^2)
+endfunction
+clf
+comet(linspace(0,5,500),traj)
     ]]></programlisting>
+        <para/>
         <programlisting role="example"><![CDATA[
-clf();comet(linspace(-2,4,500),(%s-3)/(%s^3+2*%s^2+1))
+clf
+comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))
     ]]></programlisting>
     </refsection>
     <refsection>
         <title>参照</title>
         <simplelist type="inline">
             <member>
-                <link linkend="color">color</link>
-            </member>
-            <member>
                 <link linkend="comet3d">comet3d</link>
             </member>
             <member>
                 <link linkend="paramfplot2d">paramfplot2d</link>
             </member>
+            <member>
+                <link linkend="realtime">realtime</link>
+            </member>
+            <member>
+                <link linkend="color_list">colors names</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
@@ -188,7 +195,13 @@ clf();comet(linspace(-2,4,500),(%s-3)/(%s^3+2*%s^2+1))
             <revision>
                 <revnumber>5.3.2</revnumber>
                 <revremark>
-                    関数 <function>comet</function> が導入されました.
+                    関数 comet() が導入されました.
+                </revremark>
+            </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revremark>
+                  色は、名前、"#RRGGBB"の16進コード、または赤緑青の強度で指定することもできるようになりました。
                 </revremark>
             </revision>
         </revhistory>
index 41eca56..f715c68 100644 (file)
@@ -1,20 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- * Add some comments about XML file
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) Serge Steer
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * 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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="ja" xml:id="comet3d">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+          xml:lang="ja" xml:id="comet3d">
     <refnamediv>
         <refname>comet3d</refname>
-        <refpurpose>3次元 comet アニメーションプロット. </refpurpose>
+        <refpurpose>3次元 comet アニメーションプロット</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>呼び出し手順</title>
         <synopsis>
             comet3d(z)
             comet3d(x, y, z)
+            comet3d(x, y, z, Lf)
             comet3d(x, y, fun)
-            comet3d(x, y, z, p)
-            comet3d(x, y, fun, p)
+            comet3d(x, y, fun, Lf)
             comet3d(...,"colors", c)
         </synopsis>
     </refsynopsisdiv>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>
-                        実数ベクトルまたは行列. 省略された場合,
-                        ベクトル  <literal>1:nz</literal> が使用されます.
-                        ただし,  <literal>nz</literal> は<literal>z</literal>パラメータ
-                        で指定される曲線の点の数です.
-                    </para>
+                    実数ベクトルまたは行列. 省略された場合,
+                    ベクトル <literal>1:np</literal> が指定されたと仮定されます.
+                    ただし,<literal>np</literal> は曲線の点の数(下記参照)です.
+                    行列として、各列は別々の彗星の軌跡の水平座標を定義します.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>
-                        実数ベクトルまたは行列. 省略された場合,
-                        ベクトル  <literal>1:nz</literal> が使用されます.
-                        ただし,  <literal>nz</literal> は<literal>z</literal>パラメータ
-                        で指定される曲線の点の数です.
-                    </para>
+                    実数ベクトル(デフォルト値<literal>=1:np</literal>)または行列.
+                    行列として、各列は、個々の彗星の痕跡のy座標を定義します.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>z</term>
                 <listitem>
-                    <para>
-                        長さ <literal>nz</literal> の実数ベクトル, または,
-                        <literal>nz</literal> 行の行列.
-                    </para>
+                    長さがnpの実数ベクトル、またはnp個の行を持つ行列.
+                    行列として、各列は個々の彗星のトレースのz座標を定義します. <literal>nc=size(z,"c")</literal>
+                    は、同時に描画される彗星の数です.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>p</term>
+                <term>Lf</term>
                 <listitem>
-                    <para>
-                        範囲 <literal>[0 1[</literal> の実数スカラー.
-                        デフォルト値は 0.1.
-                    </para>
+                    範囲 <literal>[0 1[</literal> の実数スカラー. デフォルト値は 0.1です.
+                    これは、彗星の痕跡のLeading fractionを定義します。最近の点は太い線でプロットされています
+                    (<literal>k=Lf*np</literal>)。
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>fun</term>
                 <listitem>
-                    <para>
-                        呼び出し手順 <literal>z=fun(x,y)</literal> のScilab関数.
-                    </para>
+                    呼び出し手順 <literal>z=fun(x,y)</literal> のScilab関数.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>c</term>
                 <listitem>
-                    <para>
-                        <literal>ny</literal> 色の添字のベクトル.
-                    </para>
+                    <literal>nc</literal> colors of the <literal>nc</literal> comets traces.
+                    They may be specified as a vector of <literal>nc</literal> color indices or
+                    <link linkend="color_list">color names</link> or "#RRGGBB" hexadecimal
+                    color codes. Or by a matrix (ncx3) of <literal>[r,g,b]</literal> vectors of
+                    Red-Green-Blue intensities in the [0,1] interval.
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
             <literal>(x,y,z)</literal>が要素数が同じ3つのベクトルの場合,
             この関数は3次元cometアニメーションプロットを描画します.
             このプロットは以下の3つの部分から構成されます:
-            <variablelist>
-                <varlistentry>
-                    <term>ヘッド</term>
-                    カレントの位置<literal>(x(i),y(i),z(i))</literal>を示すマーカ.
-                    <listitem><para>
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>ボディー</term> ヘッドに続く尾の曲線を示す:
-                    曲線の一部
-                    <literal>(x(i-k:i),y(i-k:i),z(i-k:i))</literal>)
-                    <listitem><para>
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>テール</term>
-                    曲線の一部<literal>(x(1:i-k),y(1:i-k),z(1:i-k))</literal> を示す.
-                    <listitem><para>
-                        </para>
-                    </listitem>
-                </varlistentry>
-            </variablelist>
-            <para>
-                <literal>z</literal> が行列,
-                <literal>(x,y)</literal> がベクトルの場合,
-                アニメーション表示される曲線は各<literal>(x,y,z(:,l))</literal>
-                の組について描画されます.
-                この場合,
-                <literal>nz</literal> は <literal>z</literal>の行の数となります.
-            </para>
-            <para>
-                <literal>x,y,z</literal> が同じ次元の行列の場合,
-                アニメーション表示される曲線は,
-                各組<literal>(x(:,l),y(:,l),z(:,l))</literal>について
-                描画されます.
-            </para>
-            <para>
-                <literal>comet3d(x,y,fun,...)</literal> は,
-                <literal>z</literal> ベクトルを
-                <literal>z(i)=fun(x(i),y(i))</literal>により
-                計算します.
-            </para>
-            <para>
-                <literal>comet3d(...,p)</literal> は,
-                ボディの相対長を設定するために使用することができます.
-                <literal>k</literal> は,
-                <literal>k = round(p*nz)</literal>により定義されます.
-            </para>
+            <table>
+                <tr><td><emphasis role="bold">ヘッド</emphasis></td>
+                    <td>カレントの位置<literal>[x(i), y(i), z(i)]</literal>を示すマーカ.</td>
+                </tr>
+                <tr><td><emphasis role="bold">ボディ</emphasis></td>
+                    <td>
+                        軌跡の最も最近の点である<literal>k=round(Lf*np)</literal>
+                        で構成され、トレースのより厚い部分として表示されます。
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">テール</emphasis></td>
+                    <td>
+                        曲線の一部<literal>[x(1:i-k), y(1:i-k), z(1:i-k)]</literal> を示す.
+                    </td>
+                </tr>
+            </table>
+        </para>
+        <para>
+            <literal>z</literal> が行列, <literal>(x, y)</literal> がベクトルの場合,
+            アニメーション表示される曲線は各<literal>(x, y, z(:,j))</literal> の組について描画されます.
+        </para>
+        <para>
+            <literal>x,y,z</literal> が同じ次元の行列の場合, アニメーション表示される曲線は, 各組
+            <literal>(x(:,j), y(:,j), z(:,j))</literal>について描画されます.
+        </para>
+        <para>
+            <literal>comet3d(x, y, fun,...)</literal> は, <literal>z</literal> ベクトルを
+            <literal>z(i)=fun(x(i),y(i))</literal>により 計算します.
+        </para>
+        <para>
+            <literal>comet3d(..., "colors", c)</literal> は 各曲線の色を設定する際に使用できます.
         </para>
     </refsection>
     <refsection>
         <programlisting role="example"><![CDATA[
 t = linspace(-%pi,%pi,500);
 clf
-comet3d(sin(5*t), sin(t), t^2)
+comet3d(sin(5*t), sin(t), t.^2)
     ]]></programlisting>
         <programlisting role="example"><![CDATA[
 t = linspace(-%pi,%pi,500)';
 clf
-comet3d(sin(5*t), sin(t), [t^2,ones(t)])
+comet3d(sin(5*t), sin(t), [t.^2,ones(t)])
+    ]]></programlisting>
+        <programlisting role="example"><![CDATA[
+// Chosen colors:
+t = linspace(0, 10*%pi, 500)';
+clf, gca().rotation_angles = [26, 112];
+comet3d(t.*sin(t), t, [t.*sin(2*t) t.*sin(3*t)], "colors", ["orange" "red"])
     ]]></programlisting>
         <programlisting role="example"><![CDATA[
 t = linspace(-%pi,%pi,500)';
-function z=traj(x,y),z=1.5*sin(x^2)*cos(y),endfunction
+function z = traj(x,y), z = 1.5*sin(x^2)*cos(y), endfunction
 clf
-comet3d(cos(t), sin(t), traj)
+comet3d(cos(t),sin(t),traj)
     ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -162,6 +160,15 @@ comet3d(cos(t), sin(t), traj)
             <member>
                 <link linkend="comet">comet</link>
             </member>
+            <member>
+                <link linkend="paramfplot2d">paramfplot2d</link>
+            </member>
+            <member>
+                <link linkend="realtime">realtime</link>
+            </member>
+            <member>
+                <link linkend="color_list">colors names</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
@@ -169,7 +176,13 @@ comet3d(cos(t), sin(t), traj)
         <revhistory>
             <revision>
                 <revnumber>5.3.2</revnumber>
-                <revremark>関数 comet3d が導入されました.</revremark>
+                <revremark>関数 comet3d() が導入されました.</revremark>
+            </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revremark>
+                  色は、名前、"#RRGGBB"の16進コード、または赤緑青の強度で指定することもできるようになりました。
+                </revremark>
             </revision>
         </revhistory>
     </refsection>
index 148270c..4e9f74d 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) Serge Steer
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * 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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="ru" xml:id="comet">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+          xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+          xml:lang="ru" xml:id="comet">
     <refnamediv>
         <refname>comet</refname>
         <refpurpose>двумерный график с анимированной кометой</refpurpose>
@@ -22,9 +26,9 @@
         <synopsis>
            comet(y)
            comet(x, y)
+           comet(x, y, Lf)
            comet(x, fun)
-           comet(x, y, p)
-           comet(x, fun, p)
+           comet(x, fun, Lf)
            comet(...,"colors",c)
         </synopsis>
     </refsynopsisdiv>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>
-                        вещественный вектор или матрица. Если не указать, то
-                        предполагается, что это вектор <literal>1:ny</literal>,
-                        где <literal>ny</literal> - это количество точек кривой
-                        (см. ниже).
-                    </para>
+                    вещественный вектор или матрица. Если не указать, то предполагается,
+                    что это вектор <literal>1:np</literal>, где <literal>np</literal> -
+                    это количество точек кривой (см. ниже). В качестве матрицы каждый столбец
+                    определяет абсциссы следа отдельной кометы.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>
-                        вещественный вектор или матрица.
-                    </para>
+                    вещественный вектор или матрица. В качестве матрицы каждый столбец
+                    определяет ординаты следа отдельной кометы.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>p</term>
+                <term>Lf</term>
                 <listitem>
-                    <para>
-                        вещественный скаляр на интервале <literal>[0 1[</literal>.
-                        Значение по умолчанию <literal>0.1</literal>.
-                    </para>
+                    вещественный скаляр на интервале <literal>[0 1[</literal>. Значение по
+                    умолчанию <literal>0.1</literal>. Он определяет ведущую часть следа кометы.
+                    Самые последние точки <literal>k=Lf*np</literal> отображаются в более
+                    толстой строке.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>fun</term>
                 <listitem>
-                    <para>
-                        Scilab-функция с последовательностью вызова
-                        <literal>y=fun(x)</literal>.  <varname>fun</varname>
-                        также может быть полиномом или рациональной дробью.
-                    </para>
+                    Scilab-функция с последовательностью вызова <literal>y=fun(x)</literal>.
+                    <varname>fun</varname> также может быть полиномом или рациональной дробью.
+                    <para/>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>c</term>
                 <listitem>
-                    <para>
-                        вектор из <literal>ny</literal> индексов цветов.
-                    </para>
+                    <literal>nc</literal> цвета <literal>nc</literal> хвостов комет.
+                    Они могут определяться в виде вектора <literal>nc</literal> индексов цветов или
+                    <link linkend="color_list">названий цветов</link> либо шестнадцатеричных кодов
+                    цветов "#RRGGBB". Либо матрицей (ncx3) из векторов <literal>[r,g,b]</literal>
+                    интенсивности Красного-Зелёного-Синего в интервале [0,1].
+                    <para/>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Описание</title>
         <para>
-            Если <literal>(x,y)</literal> являются двумя векторами с
-            одинаковым количеством элементов, то эта фукнция нарисует
-            двумерный график с анимированной кометой, показывающей
-            движение кривой <literal>(x(1:k),y(1:k))</literal> для
+            Если <literal>(x,y)</literal> являются двумя векторами с одинаковым количеством
+            элементов, то эта функция нарисует двумерный график с анимированной кометой,
+            показывающей движение кривой <literal>(x(1:k),y(1:k))</literal> для
             <literal>k</literal>, меняющейся от <literal>1</literal> до
-            <literal>size(x,'*')</literal>.
+            <literal>np=length(x)</literal>.
         </para>
         <para>
             График строится из трёх частей:
-            <variablelist>
-                <varlistentry>
-                    <term>голова</term>
-                    <listitem>
-                        <para>
-                            метка, которая показыает текущее положение
-                            <literal>(x(i),y(i))</literal>.
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>тело</term>
-                    <listitem>
-                        <para>
-                            показывает бегущую кривую,
-                            следующую за головой:
-                            <literal>(x(i-k:i),y(i-k:i))</literal>
-                            часть кривой.
-                        </para>
-                    </listitem>
-                </varlistentry>
-                <varlistentry>
-                    <term>хвост</term>
-                    <listitem>
-                        <para>
-                            показывает часть кривой <literal>(x(1:i-k),y(1:i-k))</literal>.
-                        </para>
-                    </listitem>
-                </varlistentry>
-            </variablelist>
+            <table>
+                <tr><td><emphasis role="bold">голова</emphasis></td>
+                    <td>
+                        метка, которая показывает текущее положение <literal>(x(i),y(i))</literal>.
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">тело</emphasis></td>
+                    <td>
+                        состоящее из <literal>k=round(Lf*np)</literal> самых последних точек
+                        траектории, отображаемое как более толстая часть трассы.
+                    </td>
+                </tr>
+                <tr><td><emphasis role="bold">хвост</emphasis></td>
+                    <td>
+                        показывает часть кривой <literal>(x(1:i-k),y(1:i-k))</literal>.
+                    </td>
+                </tr>
+            </table>
             <para>
-                Инструкция <literal>comet(x, fun,...)</literal>
-                эквивалентна инструкции <literal>comet(x, feval(x,fun),...)</literal>.
-            </para>
-            <para>
-                <literal>comet(...,p)</literal> может быть использована для установки
-                относительной длины тела. <literal>k</literal> определяется как
-                <code>k = round(p*ny)</code>.
-            </para>
-            <para>
-                Если <varname>y</varname> является матрицей, то для каждой пары
-                <literal>(x,y(:,l))</literal> строятся анимированные кривые. В
-                этом случае <literal>ny</literal> - это количество строк матрицы
-                <varname>y</varname>.
+                Инструкция <literal>comet(x, fun,...)</literal> эквивалентна инструкции
+                <literal>comet(x, feval(x,fun),...)</literal>.
             </para>
             <para>
                 Если <varname>x</varname> и <varname>y</varname> - матрицы
                 одинаковых размеров, то анимированные кривые строятся для каждой пары
-                <literal>(x(:,l),y(:,l))</literal>. В этом случае <literal>ny</literal>
+                <literal>(x(:,l),y(:,l))</literal>. В этом случае <literal>np</literal>
                 - это количество строк матриц <varname>x</varname> и <varname>y</varname>.
             </para>
             <para>
                 <literal>comet(...,"colors",c)</literal> может быть использована для
-                установки цвета для каждой из кривых.
+                установки цвета для каждой из траекторий.
             </para>
         </para>
     </refsection>
     <refsection>
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500);
-isoview("on");  // установка равновеликого масштаба осей
-comet(t.*sin(t),t.*cos(t))
+// Одна комета по спирали:
+t = linspace(0, 10*%pi, 500);
+clf, isoview
+comet(t.*sin(t), t.*cos(t), "colors", "orange")
     ]]></programlisting>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="../../images/comet_1.png"/>
+            </imageobject>
+        </inlinemediaobject>
+        <para/>
         <programlisting role="example"><![CDATA[
+// Две одновременные кометы с цветами по умолчанию :
 t = linspace(0,10*%pi,500)';
-clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)])
+clf
+comet(t.*sin(t), [t.*sin(2*t) t.*sin(3*t)])
     ]]></programlisting>
+        <para/>
         <programlisting role="example"><![CDATA[
-t = linspace(0,10*%pi,500)';
-clf();comet(t.*sin(t),[t.*sin(2*t) t.*sin(3*t)],"colors",[3 5])
+// Выбранные цвета :
+t = linspace(0, 10*%pi, 500)';
+clf
+comet(t.*sin(t), [t.*cos(t) t.*sin(2*t)], "colors", ["orange" "mag"])
     ]]></programlisting>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="../../images/comet_2.png"/>
+            </imageobject>
+        </inlinemediaobject>
+        <para/>
         <programlisting role="example"><![CDATA[
-function y=traj(x),y=1.5*sin(x^2),endfunction
-clf();comet(linspace(0,5,500),traj)
+function y = traj(x)
+  y = 1.5*sin(x^2)
+endfunction
+clf
+comet(linspace(0,5,500),traj)
     ]]></programlisting>
+        <para/>
         <programlisting role="example"><![CDATA[
-clf();comet(linspace(-2,4,500),(%s-3)/(%s^3+2*%s^2+1))
+clf
+comet(linspace(-2,4,500), (%s-3)/(%s^3+2*%s^2+1))
     ]]></programlisting>
     </refsection>
     <refsection role="see also">
         <title>Смотрите также</title>
         <simplelist type="inline">
             <member>
-                <link linkend="color">color</link>
-            </member>
-            <member>
                 <link linkend="comet3d">comet3d</link>
             </member>
             <member>
                 <link linkend="paramfplot2d">paramfplot2d</link>
             </member>
+            <member>
+                <link linkend="realtime">realtime</link>
+            </member>
+            <member>
+                <link linkend="color_list">названия цветов</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
@@ -191,7 +198,14 @@ clf();comet(linspace(-2,4,500),(%s-3)/(%s^3+2*%s^2+1))
             <revision>
                 <revnumber>5.3.2</revnumber>
                 <revremark>
-                    Введена функция <function>comet</function>.
+                    Введена функция comet().
+                </revremark>
+            </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revremark>
+                  Цвета теперь могут быть указаны также их именами или шестнадцатеричными кодами
+                  «#RRGGBB» или их интенсивностью [r g b] Красный-Зелёный-Синий.
                 </revremark>
             </revision>
         </revhistory>
index f1373b5..68476dc 100644 (file)
@@ -1,7 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2011 - INRIA - Serge Steer <serge.steer@inria.fr>
-//
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2018 - Samuel GOUGEON
 //
 // 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.
 // along with this program.
 
 function comet(varargin)
-    //Comet-like trajectory.
-    //   comet(y) displays an animated comet plot of the vector y.
-    //   comet(x,y) displays an animated comet plot of vector y vs. x.
-    //   comet(x,y,p) uses a comet of length p*size(y,'*').  Default is p = 0.1.
-
-    //   Example:
-    //       t = linspace(0,10*%pi,500);
-    //       clf();comet(t.*sin(t),t.*cos(t))
-    //
-    //       function y=traj(x),y=1.5*sin(x^2),endfunction
-    //       clf();comet(linspace(0,5,500),traj)
+    // Comet-like trajectory.
+    // comet(y)
+    // comet(x, y)
+    // comet(x, y, Lf)     // Lf: Leading fraction
+    // comet(x, fun)       // fun: function identifier, polynomial, rational
+    // comet(x, fun, Lf)
+    // comet(..., "colors",c) // c: -1, 4, "orange", "ma", "#RRGGBB", [r g b]
     //
-    //       clf();comet(linspace(-2,4,500),(%s-3)/(%s^3+2*%s^2+1))
+    // History:
+    //  2018: colors as "name" "nam" "#RRGGBB" or [r g b] now allowed
 
-    nv=size(varargin)
-    if nv>=3&varargin(nv-1)=="colors" then
-        c=round(varargin(nv))
-        if type(c)<>1|~isreal(c) then
-            error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet",nv))
+    nv = size(varargin)
+    if nv >= 3 & varargin(nv-1)=="colors" then
+        c = iscolor( varargin(nv))
+        if or(isnan(c))
+            msg = "%s: Argument #%d: Wrong color specification.\n";
+            error(msprintf(msg, "comet", nv))
         end
-        varargin=list(varargin(1:$-2))
+        if size(c,2)==3
+            c = addcolor(c)
+        end
+        varargin = list(varargin(1:$-2))
     else
-        c=[]
+        c = []
     end
+
     select size(varargin)
     case 1 then //y
         y=varargin(1)
@@ -50,10 +52,12 @@ function comet(varargin)
     case 3 then  //x,y,p
         [x,y,p]=varargin(1:3)
     else
-        error(msprintf(_("%s: Wrong number of input arguments: %d to %d expected.\n"),"comet",1,3))
+        msg = _("%s: Wrong number of input arguments: %d to %d expected.\n");
+        error(msprintf(msg, "comet", 1, 5))
     end
     if type(x)<>1|~isreal(x) then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet",1))
+        msg = _("%s: Wrong type for argument #%d: Real vector expected.\n");
+        error(msprintf(msg, "comet", 1))
     end
     if type(y)==13 then //a function
         prot=funcprot();funcprot(0)
@@ -65,13 +69,16 @@ function comet(varargin)
         y=horner(y,x)
     end
     if type(y)<>1|~isreal(y) then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet",2))
+        msg = _("%s: Wrong type for argument #%d: Real vector expected.\n");
+        error(msprintf(msg, "comet", 2))
     end
     if type(p)<>1|~isreal(p)|size(p,"*")>1 then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real scalar expected.\n"),"comet",3))
+        msg = _("%s: Wrong type for argument #%d: Real scalar expected.\n");
+        error(msprintf(msg, "comet", 3))
     end
     if p<0|p>=1 then
-        error(msprintf(_("%s: Wrong value for input argument #%d: Must be in the interval %s.\n"),"comet",3,"[0 1["))
+        msg = _("%s: Wrong value for input argument #%d: Must be in the interval %s.\n");
+        error(msprintf(msg, "comet", 3, "[0 1["))
     end
 
     if or(size(x)==1) then
@@ -79,14 +86,16 @@ function comet(varargin)
         n=size(x,1)
         if or(size(y)==1) then
             if n<>size(y,"*") then
-                error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"comet",1,2))
+                msg = _("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n");
+                error(msprintf(msg, "comet", 1, 2))
             end
             y=y(:)
             m=1
         else
             m=size(y,2)
             if size(y,1)<>n then
-                error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same number of rows expected.\n"),"comet",1,2))
+                msg = _("%s: Incompatible input arguments #%d and #%d: Same number of rows expected.\n")
+                error(msprintf(msg, "comet", 1, 2))
             end
             x=x*ones(1,m)
         end
@@ -94,22 +103,21 @@ function comet(varargin)
         n=size(x,1)
         m=size(x,2)
         if or(size(y)<>size(x)) then
-            error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"comet",1,2))
+            msg = _("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n")
+            error(msprintf(msg, "comet", 1, 2))
         end
     end
-    fig=gcf();
+    fig = gcf();
     if c==[] then
-        c=1:m
+        c = 1:m
     else
-        if size(c,"*")<>m then
-            error(msprintf(_("%s: Wrong size for argument #%d: %d expected.\n"),"comet",nv,m))
-        end
-        if min(c)<1|max(c)>size(fig.color_map,1) then
-            error(msprintf(_( "%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),"comet",nv,"1,...,"+string(size(fig.color_map,1))))
+        if size(c,"*") <> m then
+            msg = _("%s: Wrong size for argument #%d: %d expected.\n")
+            error(msprintf(msg, "comet", nv, m))
         end
     end
-    axes=gca();
 
+    axes = gca();
     if axes.children==[] then
         axes.data_bounds=[min(x) min(y);max(x) max(y)];
         axes.axes_visible="on";
index 59e05e3..c25d172 100644 (file)
@@ -1,7 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2011 - INRIA - Serge Steer <serge.steer@inria.fr>
-//
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
+// Copyright (C) 2018 - 2019 - Samuel GOUGEON
 //
 // 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.
 // along with this program.
 
 function comet3d(varargin)
-    //Comet-like trajectory.
-    //   comet(y) displays an animated comet plot of the vector y.
-    //   comet(x,y) displays an animated comet plot of vector y vs. x.
-    //   comet(x,y,p) uses a comet of length p*size(y,'*').  Default is p = 0.1.
-
-    //   Example:
-    //       t = linspace(-%pi,%pi,500);
-    //       clf();comet3d(sin(5*t),sin(t),t^2)
-    //
-    //       function z=traj(x,y),z=1.5*sin(x^2)*cos(y),endfunction
-    //       clf();comet3d(cos(t),sin(t),traj)
+    // 3D Comet-like trajectory.
+    // comet3d(z)
+    // comet3d(x, y, z)
+    // comet3d(x, y, z, Lf)     // Lf: Leading fraction
+    // comet3d(x, y, fun)       // fun: function identifier, polynomial, rational
+    // comet3d(x, y, fun, Lf)
+    // comet3d(...,"colors", c) // c: -1, 4, "orange", "ma", "#RRGGBB", [r g b]
     //
-    nv=size(varargin)
-    if nv>=3&varargin(nv-1)=="colors" then
-        c=round(varargin(nv))
-        if type(c)<>1|~isreal(c) then
-            error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet3d",nv))
+    // History:
+    //  2018: colors as "name" "nam" "#RRGGBB" or [r g b] now allowed
+
+    nv = size(varargin)
+    if nv >= 3 & varargin(nv-1)=="colors" then
+        c = iscolor( varargin(nv))
+        if or(isnan(c))
+            msg = "%s: Argument #%d: Wrong color specification.\n";
+            error(msprintf(msg, "comet", nv))
         end
-        varargin=list(varargin(1:$-2))
+        if size(c,2)==3
+            c = addcolor(c)
+        end
+        varargin = list(varargin(1:$-2))
     else
-        c=[]
+        c = []
     end
-    select size(varargin)
 
+    select size(varargin)
     case 1 then //z
-        z=varargin(1)
+        z = varargin(1)
         if or(size(z)==1) then
-            x=1:size(z,"*")
+            x = 1:size(z,"*")
         else
-            x=1:size(z,1)
+            x = 1:size(z,1)
         end
-        y=x
-        p=0.1
+        y = x
+        p = 0.1
     case 3 then  //x,y,z
-        [x,y,z]=varargin(1:3)
-        p=0.1
+        [x,y,z] = varargin(1:3)
+        p = 0.1
     case 4 then  //x,y,z,p
-        [x,y,z,p]=varargin(1:4)
+        [x,y,z,p] = varargin(1:4)
     else
-        error(msprintf(_("%s: Wrong number of input arguments: %d or %d to %d expected.\n"),"comet3d",1,3,4))
+        msg = _("%s: Wrong number of input arguments: %d or %d to %d expected.\n")
+        error(msprintf(msg, "comet3d", 1, 3, 6))
     end
 
 
-    if type(x)<>1|~isreal(x) then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet3d",1))
+    if type(x) <> 1 | ~isreal(x) then
+        msg = _("%s: Wrong type for argument #%d: Real vector expected.\n")
+        error(msprintf(msg, "comet3d", 1))
     end
     if type(y)<>1|~isreal(x) then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet3d",1))
+        msg = _("%s: Wrong type for argument #%d: Real vector expected.\n")
+        error(msprintf(msg, "comet3d", 1))
     end
 
     if (type(z)<>1|~isreal(z))&type(z)<>13 then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real vector expected.\n"),"comet3d",3))
+        msg = _("%s: Wrong type for argument #%d: Real vector expected.\n")
+        error(msprintf(msg, "comet3d", 3))
     end
 
-
     if type(z)==13 then
-        x=x(:);y=y(:)
-        n=size(x,"*")
-        m=1
-        if n<>size(y,"*") then
-            error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"comet3d",1,2))
+        x = x(:);
+        y = y(:)
+        n = size(x,"*")
+        m = 1
+        if n <> size(y,"*") then
+            msg = _("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n")
+            error(msprintf(msg, "comet3d", 1, 2))
         end
         prot=funcprot();funcprot(0)
         zz=z;
@@ -82,113 +90,121 @@ function comet3d(varargin)
         funcprot(prot)
     else
         if or(size(z)==1) then
-            m=1
-            z=z(:)
-            n=size(z,"*")
+            m = 1
+            z = z(:)
+            n = size(z,"*")
         else
-            [n,m]=size(z)
+            [n, m] = size(z)
         end
         if or(size(x)==1) then
-            x=x(:)
+            x = x(:)
             if size(x,"*")<>n then
-                error(msprintf(_("%s: Wrong size for argument #%d: %d expected.\n"),"comet3d",1,n))
+                msg = _("%s: Wrong size for argument #%d: %d expected.\n")
+                error(msprintf(msg, "comet3d", 1, n))
             end
-            x=x*ones(1,m)
+            x = x*ones(1,m)
         else
             if or(size(x)<>size(z)) then
-                error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"comet3d",1,3))
+                msg = _("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n")
+                error(msprintf(msg, "comet3d", 1, 3))
             end
         end
         if or(size(y)==1) then
-            y=y(:)
+            y = y(:)
             if size(y,"*")<>n then
-                error(msprintf(_("%s: Wrong size for argument #%d: %d expected.\n"),"comet3d",2,n))
+                msg = _("%s: Wrong size for argument #%d: %d expected.\n")
+                error(msprintf(msg, "comet3d", 2, n))
             end
-            y=y*ones(1,m)
+            y = y*ones(1,m)
         else
             if or(size(y)<>size(z)) then
-                error(msprintf(_("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n"),"comet3d",2,3))
+                msg = _("%s: Incompatible input arguments #%d and #%d: Same sizes expected.\n")
+                error(msprintf(msg, "comet3d", 2, 3))
             end
 
         end
     end
 
 
-    if type(p)<>1|~isreal(p)|size(p,"*")>1 then
-        error(msprintf(_("%s: Wrong type for argument #%d: Real scalar expected.\n"),"comet3d",3))
+    if type(p) <> 1 | ~isreal(p) | size(p,"*") > 1 then
+        msg = _("%s: Wrong type for argument #%d: Real scalar expected.\n")
+        error(msprintf(msg, "comet3d", 3))
     end
-    if p<0|p>=1 then
-        error(msprintf(_("%s: Wrong value for input argument #%d: Must be in the interval %s.\n"),"comet3d",3,"[0 1["))
+    if p<0 | p >= 1 then
+        msg = _("%s: Wrong value for input argument #%d: Must be in the interval %s.\n")
+        error(msprintf(msg, "comet3d", 3, "[0 1["))
     end
-    fig=gcf();
+    fig = gcf();
     if c==[] then
-        c=1:m
+        c = 1:m
     else
-        if size(c,"*")<>m then
-            error(msprintf(_("%s: Wrong size for argument #%d: %d expected.\n"),"comet",nv,m))
-        end
-        if min(c)<1|max(c)>size(fig.color_map,1) then
-            error(msprintf(_( "%s: Wrong value for input argument #%d: Must be in the set {%s}.\n"),"comet",nv,"1,...,"+string(size(fig.color_map,1))))
+        if size(c,"*") <> m then
+            msg = _("%s: Wrong size for argument #%d: %d expected.\n")
+            error(msprintf(msg, "comet", nv, m))
         end
     end
-    axes=gca();
-    axes.view="3d"
+    axes = gca();
+    axes.view = "3d"
 
 
     if axes.children==[] then
-        axes.data_bounds=[min(x) min(y) min(z);max(x) max(y) max(z)];
-        axes.axes_visible="on";
-        axes.box="on";
+        axes.data_bounds = [min(x) min(y) min(z);max(x) max(y) max(z)];
+        axes.axes_visible = "on";
+        axes.box = "on";
     else
-        axes.data_bounds=[min(axes.data_bounds(1,:), [min(x) min(y) min(z)]);
+        axes.data_bounds = [min(axes.data_bounds(1,:), [min(x) min(y) min(z)]);
         max(axes.data_bounds(2,:), [max(x) max(y) max(z)])];
     end
     //create the head, body and tail polylines
     drawlater()
-    for l=1:m
-        xpoly([],[]);tail(l)=gce();
-        tail(l).foreground=c(l);
-
-        xpoly([],[]);body(l)=gce();
-        body(l).foreground=c(l); body(l).thickness=2;
-        xpoly([],[],"marks");head(l)=gce();
-        head(l).mark_size_unit="point";
-        head(l).mark_size=6;
-        head(l).mark_style=9;
-        head(l).mark_foreground=c(l);
+    for l = 1:m
+        xpoly([],[]);
+        tail(l) = gce();
+        tail(l).foreground = c(l);
+
+        xpoly([],[]);
+        body(l) = gce();
+        body(l).foreground = c(l);
+        body(l).thickness = 2;
+        xpoly([], [], "marks");
+        head(l) = gce();
+        head(l).mark_size_unit = "point";
+        head(l).mark_size = 6;
+        head(l).mark_style = 9;
+        head(l).mark_foreground = c(l);
     end
     show_window();
 
     function anim()
         //animation loop
         k = round(p*n);
-        step=ceil(n/200); //used to speed up the drawing
+        step = ceil(n/200); //used to speed up the drawing
 
-        for i=1:n
-            for l=1:m
-                head(l).data=[x(i,l),y(i,l),z(i,l)];
-                if i<=k then
-                    body(l).data= [body(l).data;[x(i,l),y(i,l),z(i,l)]];
+        for i = 1:n
+            for l = 1:m
+                head(l).data = [x(i,l),y(i,l),z(i,l)];
+                if i <= k then
+                    body(l).data = [body(l).data;[x(i,l),y(i,l),z(i,l)]];
                 else
-                    body(l).data= [body(l).data(2:$,:);[x(i,l),y(i,l),z(i,l)]];
-                    tail(l).data=[ tail(l).data;[x(i-k,l),y(i-k,l),z(i-k,l)]];
+                    body(l).data = [body(l).data(2:$,:);[x(i,l),y(i,l),z(i,l)]];
+                    tail(l).data =[ tail(l).data;[x(i-k,l),y(i-k,l),z(i-k,l)]];
                 end
             end
             if modulo(i,step)==0 then
-                fig.immediate_drawing = "on"
-                fig.immediate_drawing = "off"
+                fig.immediate_drawing = "on";
+                fig.immediate_drawing = "off";
             end
         end
         drawnow(),drawlater()
 
-        for i=n:n+k
-            for l=1:m
-                body(l).data= body(l).data(2:$,:);
-                tail(l).data=[ tail(l).data;[x(i-k,l),y(i-k,l),z(i-k,l)]];
+        for i = n:n+k
+            for l = 1:m
+                body(l).data = body(l).data(2:$,:);
+                tail(l).data = [tail(l).data;[x(i-k,l),y(i-k,l),z(i-k,l)]];
             end
             if modulo(i,step)==0 then
-                fig.immediate_drawing = "on"
-                fig.immediate_drawing = "off"
+                fig.immediate_drawing = "on";
+                fig.immediate_drawing = "off";
             end
         end
         delete(body)