Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - Français


comet3d

3D comet animated plot

Syntax

comet3d(z)
comet3d(x, y, z)
comet3d(x, y, z, Lf)
comet3d(x, y, fun)
comet3d(x, y, fun, Lf)
comet3d(...,"colors", c)

Parameters

x
a real vector or matrix. Default = 1:np, np being the number of points of the trajectory. As a matrix, each column defines the x coordinates of the trace of an individual comet.

y
a real vector (default value = 1:np) or matrix. As a matrix, each column defines the y coordinates of the trace of an individual comet.

z
a real vector of length np, or a matrix with np rows. As a matrix, each column defines the z coordinates of the trace of an individual comet. nc=size(z,"c") is the number of comets simultaneously drawn.

Lf
a real scalar in the interval[0,1[. Default value is 0.1: It defines the Leading fraction of the comet's trace. The k=Lf*np most recent points are plotted in thicker line.

fun
a scilab function with syntax z=fun(x,y).

c
nc colors of the nc comets traces. They may be specified as a vector of nc color indices or color names or "#RRGGBB" hexadecimal color codes. Or by a matrix (ncx3) of [r,g,b] vectors of Red-Green-Blue intensities in the [0,1] interval.

Description

If (x,y,z) are three vectors with the same number of elements, this function draws a 3D comet animated plot. The plot is made of three parts:

a head mark that shows the current (x(i),y(i),z(i)) position.
a body consisting in the k=round(Lf*np) most recent points of the trajectory, displayed as a thicker part of the trace.
a tail that shows the [x(1:i-k), y(1:i-k), z(1:i-k)] part of the curve.

if z is a matrix and x and y are vectors, then animated curves are drawn for each triple (x, y, z(:,j)).

if x,y,z are matrices with the same dimensions then animated curves are drawn for each triple (x(:,j), y(:,j), z(:,j)).

comet3d(x, y, fun,...) computes the z vector as z(i)=fun(x(i),y(i)).

comet3d(..,"colors",c) can be used to set the colors of each trajectory.

Examples

t = linspace(-%pi,%pi,500);
clf
comet3d(sin(5*t), sin(t), t.^2)
t = linspace(-%pi,%pi,500)';
clf
comet3d(sin(5*t), sin(t), [t.^2,ones(t)])
// 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"])
t = linspace(-%pi,%pi,500)';
function z=traj(x, y), z = 1.5*sin(x^2)*cos(y), endfunction
clf
comet3d(cos(t),sin(t),traj)

See also

  • comet — 2D comet animated plot
  • paramfplot2d — animation dans le plan d'une courbe définie par une fonction
  • realtime — sets the time unit
  • colors names — liste des noms de couleurs prédéfinies

History

VersionDescription
5.3.2 Function comet3d() introduced.
6.1.0 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.
Report an issue
<< bar3d 3d_plot contour >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jun 17 17:52:28 CEST 2024