How to display information

Plotting data

    Array<double> x = findgen(1001)/100;

    plot(x,sin(x));

    // A more sophisticated plot...

    // We create first a window to display the plot, ie a plotDisplay object.
    // parameters of the window declaration are the window size (x,y), the window title, and the axis names.

    plotDisplay display(400,300,"Multiple plots...", "Time", "Volt");
    plot(display,x,sin(x),red);                   // First plot added to the display
    plot(display,x,cos(x^2)*exp(-x/3),blue);      // Second plot added.
    activate(display);                            // activate makes the window alive...
                                                  // It can be resized, zoomed in (right click to draw a box), etc...

Showing images

The command display(image_name) opens a windows to display any 2D/3D/4D images. If the window is activated [activate(display(image_name))], press v to switch to 3D view, and use left and right arrows to navigate in time.

Printing and reading text

A convenient type of window can be used to display text and read from the keyboard (some keys are not supported yet...).

    // Terminal window, to display and read text

    Terminal trm;   // Opens a terminal window

    print(trm, "This is a terminal window");  // Print a string on the terminal
    // Read a string from keyboard
    string str;
    str = read(trm, "Enter some text: ");
    print(trm, "You entered: " + str, blue);

    Array<int> a;
    // Creates a simple 1D vector
    a = vect<int>(1,2,3,4,5,6);
    // Print array data
    print(trm,a,green);

    read(trm, "Hit enter to finish.", red);

Generated on Fri Oct 24 18:41:59 2008 for IDIL by  doxygen 1.5.5