manpagez: man pages & more
info mathgl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4 General concepts

The set of MathGL features is rather reach – just the number of basic graphics types is more than 40. Also there are functions for data handling, plot setup and so on. In spite of it I tried to keep the similar style in function names and in the order of arguments. Mostly it is regarded for different drawing functions.

There are six most general (base) concepts:

  1. Any picture is created in memory firstly. The internal (memory) representation can be different: bitmap picture or the list of vector primitives. After it user may decide what he want: save to file, display on the screen, run animation, do additional editing and so on. This approach provides high portability of the program – the source code will produce exactly the same picture in any OS. Another big positive consequence is the ability to create the picture in console program (without window creating)!
  2. Every plot settings (style of lines, font, color scheme) are specified by string. It provides convenience for user/programmer – short string with parameters is more comprehensible than a large set of parameters. Also it provides portability – the strings are the same in any OS so that it is not comprehensible to think about type of arguments.
  3. All functions have “simplified” and “advanced” forms. It is done for user convenience. One needs to specify the only one data array in “simplified” form and will see the result. But one may set parametric dependence of coordinates and produce rather complex curves and surfaces in “advanced” form. In both cases the order of function arguments are the same: firstly data arrays, secondly the string with plot parameters, and later optional arguments for plot tunning.
  4. All data arrays for plotting are encapsulated in class mglData class. It reduces the number of errors with memory working and provide the uniform interface for data of different types (float, double and so on) or for formulas plotting.
  5. All plots are vector plot. The MathGL library is intended for handling scientific data which have vectorial nature (there are lines, faces, matrices and so on). As result vectorial representation is used in any cases! In addition the vectorial representation allows one to scale easily the plot – change the canvas size by 2 times and the picture will proportionally scaled.
  6. New drawing never clears things drawn already. This, in some sense, is unexpected, idea allows to create a lot of “combined” graphics. For example, for making a surface with contour lines one need to call the function of surface plotting and the function of contour lines plotting (in any order). At this the special functions (as it done in Matlab and some other plotting system) for making this “combined” plots are useless. Much more examples of such plots can be found in section Hints and in home site (http://mathgl.sf.net/index.html).

Except general concept I want consider on some non-trivial or non-usual general ideas – plot positioning, axis specification and curvilinear coordinates, styles for lines, text and color scheme.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2026
Individual documents may contain additional copyright information.