[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MathGL library have interface for a set of languages. Most of them are based on C interface via SWIG tool. There are Python, Java, Octave, Lisp, C#, Guile, Lua, Modula 3, Ocaml, Perl, PHP, Pike, R, Ruby, Tcl. Also there is Fortran interface which have similar set of functions but slightly different type of arguments (integers instead of pointers). The C interface functions are described in C interface. Some of languages listed above support classes (like Python). So for them the special wrapper was written. These classes and functions are described in Python interface. Finally the special command language MGL was written for faster access to C++ plotting functions. Corresponding scripts can be executed separately (by UDAV, mgl2png, mgl2eps and so on) or from the C++ code (see section mglParse class). These commands are described in MGL interface.
C interface is base for many other interfaces. It contain pure C functions for most of methods of MathGL classes. In difference from C++ classes, C functions must have argument HMGL (for graphics) and/or HMDT (for data arrays) which specify the object for drawing or manipulating (changing). So, firstly user have to create this object by function mgl_create_*()
and have to delete it after using by function mgl_delete_*()
.
All C functions are described in header file #include <mgl/mgl_c.h>
and use variable of types:
HMGL
— Pointer to class mglGraph
(see section MathGL core).
HMDT
— Pointer to class mglData
(see section mglData class).
HMPR
— Pointer to class mglParse
(see section mglParse class)..
These variables contain identifiers for graphics drawing objects and for data objects.
Fortran functions/subroutines have the same names as C functions. However, there is a difference. Variable of types HMGL, HMDT
must be integer with sufficient size (integer*4
for 32-bit operating system or integer*8
for 64-bit operating system). All C functions are subroutines in Fortran which should be called by operator call
. The exceptions are functions which return variables of types HMGL
or HMDT
. These functions should be declared as integer in Fortran code. Also one should keep in mind that strings in Fortran are denoted by '
sign but not "
one.
For compiling Fortran program you should specify AT&T calling conversion (it is default for gfortran, g77 and so on). The internal difference of AT&T interface from C interface is that the symbol ’_’ is added at the end of function name, and string length(s) is passed at the end of argument list. For example:
void mgl_fplot(HMGL graph, const char *fy, const char *stl, int n);
void mgl_fplot_(uintptr_t *graph, const char *fy, const char *stl, int *n, int ly, int ls);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several group of functions.
HMGL
mgl_create_graph_zb (int
width, int
height)Create the instance of class mglGraphZB with specified sizes.
HMGL
mgl_create_graph_glut (int (*
draw)(HMGL gr, void *p)
, const char *
title, void *
par)Create the instance of class mglGraphGLUT and connected GLUT window. Only one GLUT window can be opened at once. Arguments description can be found in mglGraphAB class.
HMGL
mgl_create_graph_fltk (int (*
draw)(HMGL gr, void *p)
, const char *
title, void *
par)Create the instance of class mglGraphFLTK and connected FLTK window. Several windows can be opened at the same time. However user must call mgl_fltk_run()
function to start the message handling circle. Arguments description can be found in mglGraphAB class. Note, that draw can be NULL
for displaying static bitmaps only (no animation or slides).
HMGL
mgl_create_graph_qt (int (*
draw)(HMGL gr, void *p)
, const char *
title, void *
par)Create the instance of class mglGraphQT and connected Qt window. Several windows can be opened at the same time. However user must call mgl_qt_run()
function to start the message handling circle. Arguments description can be found in mglGraphAB class. Note, that draw can be NULL
for displaying static bitmaps only (no animation or slides).
void
mgl_fltk_run ()Start FLTK message handling cycle. A normal program will end main() function with return mgl_fltk_run();
.
void
mgl_fltk_thread ()Start FLTK message handling cycle. In difference of mgl_fltk_run()
the loop is started in separate thread so that program continues immediately.
void
mgl_qt_run ()Start Qt message handling cycle. A normal program will end main() function with return mgl_qt_run();
. Alternatively user may setup Qt application by direct Qt functions calls.
void
mgl_qt_thread ()Start Qt message handling cycle. In difference of mgl_qt_run()
the loop is started in separate thread so that program continues immediately.
void
mgl_set_show_mouse_pos (HMGL
graph, int
enable)Switch to show or not in the widget the last mouse click position.
void
mgl_get_last_mouse_pos (HMGL
graph, float *
x, float *
y, float *
z)Last position of mouse click.
void
mgl_calc_xyz (HMGL
graph, int
xs, int
ys, float *
x, float *
y, float *
z)Calculate 3D coordinate {x,y,z} for screen point {xs,ys}. At this moment it ignore perspective and transformation formulas (curvilinear coordinates). The calculation are done for the last used InPlot (see section Transformation matrix).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions allow one to parse MGL script from the program.
HMPR
mgl_create_parser ()Create parser.
void
mgl_delete_parser (HMPR
p)Delete parser
void
mgl_add_param (HMPR
p, int
id, const char *
val)void
mgl_add_paramw (HMPR
p, int
id, const wchar_t *
val)Add script parameter id with value val (used in string as ’\$0’,’\$1’ \ldots ’\$9’).
const HMDT
mgl_add_var (HMPR
p, const char *
name)Add variable with name if it is not exists. Return the created or found variable. NOTE!!! You must not delete obtained data arrays. Use this function to put external data array to the script or get the data from the script.
const HMDT
mgl_find_var (HMPR
p, const char *
name)Find variable with name and return it (or NULL
if variable is absent). NOTE!!! You must not delete obtained data arrays. Use this function to put external data array to the script or get the data from the script.
int
mgl_parse (HMGL
gr, HMPR
p, const char *
str, int
pos)int
mgl_parsew (HMGL
gr, HMPR
p, const wchar_t *
str, int
pos)Parse and draw (using gr) the string str with MGL commands. Returns the value depending on an error presence in the string str: 0 - no error, 1 - wrong command argument(s), 2 - unknown command, 3 - string is too long.
void
mgl_parse_text (HMGL
gr, HMPR
p, const char *
text)void
mgl_parsew_text (HMGL
gr, HMPR
p, const wchar_t *
text)Function parse and execute line-by-line MGL script in string text. Lines are separated by ‘\n’ symbol as usual. If error is not NULL
then this function will be called for all warnings, information and other messages. Also this function support the for|next
MGL commands.
void
mgl_restore_once (HMPR
p)Restore ’once’ state (for data reloading on next parsing).
void
mgl_parser_allow_setsize (HMPR
p, int
a)Allow to parse ’setsize’ command or not.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Functions and variables in this group influences on overall graphics appearance. So all of them should be placed before any actual plotting function calls.
void
mgl_set_def_param (HMGL
gr)Restore initial values for all of parameters except described in Zooming.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several functions for setup transparency. The general function is Alpha()
which switch on/off the transparency for overall plot. It influence only for graphics which created after Alpha()
call. Variable AlphaDef
specify the default value of alpha-channel. You may switch off transparency of selected plot by variable Transparent
. Finally, variable TranspType
set the kind of transparency. See section Transparent surface sample, for sample code and picture.
void
mgl_set_alpha (HMGL
gr, int
enable)Sets the transparency on/off. It is recommended to call this function before any plotting command. Default value is transparency off. Use mgl_set_transp(false)
in particular plot to disable its transparency.
void
mgl_set_alpha_default (HMGL
gr, float
alpha)Default value of alpha channel (transparency) for all plotting functions.
void
mgl_set_transp (HMGL
gr, int
enable)Temporary switches transparency on/off for the plot.
void
mgl_set_transp_type (HMGL
gr, int
enable)This variable set the transparency type. Normal transparency (‘0’) – below things is less visible than upper ones. It does not look well in OpenGL mode (mglGraphGL) for several surfaces. Glass-like transparency (‘1’) – below and upper things are commutable and just decrease intensity of light by RGB channel. Lamp-like transparency (‘2’) – below and upper things are commutable and are the source of some additional light. I recommend to set mgl_set_alpha_default(0.3)
or less for lamp-like transparency.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several functions for setup lighting. The general function is mgl_set_light()
which switch on/off the lighting for overall plot. It influence only for graphics which created after mgl_set_light()
call. Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0
with white color, located at top of the plot.
void
mgl_set_light (HMGL
gr, int
enable)Sets the using of light on/off for overall plot. It is recommended to call this function before any plotting command. Default value is lightning off.
void
mgl_set_light_n (HMGL
gr, int
n, int
enable)Switch on/off n-th light source separately.
void
mgl_add_light (HMGL
gr, int
n, float
x, float
y, float
z, char
c)void
mgl_add_light_rgb (HMGL
gr, int
n, float
x, float
y, float
z, int
infty, float
r, float
g, float
b, float
i)The function adds a light source with identification n at position {x, y, z}. The color of light is defined by character c or by RGB values {r, g, b}. The brightness of light is i which must be in range [0,1]. Flag infty=true
puts the source to infinite distance (for the faster drawing). It is recommended to call this function before any plotting command.
void
mgl_set_ambbr (HMGL
gr, float
bright)Sets the brightness of ambient light. The value should be in range [0,1]. Initial value is 0.5
. It is recommended to call this function before any plotting command.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_set_fog (HMGL
gr, float
d, float
dz)Function imitate a fog in the plot. Fog start from relative distance dz from view point and its density growths exponentially in depth. So that the fog influence is determined by law ~ 1-exp(-d*z). Here z is normalized to 1 depth of the plot. If value d=0
then the fog is absent. See section Surface in fog sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions control the default (initial) values for most graphics parameters including sizes of markers, arrows, linewidth and so on. As any other settings these ones will influence only on plots created after the settings change.
void
mgl_set_bar_width (HMGL
gr, float
val)Relative width of rectangles in Bars plot. Default value is 0.7
.
void
mgl_set_mark_size (HMGL
gr, float
val)The size of marks for 1D plotting (Pure C). Default value is 0.02
.
void
mgl_set_arrow_size (HMGL
gr, float
val)The size of arrows for 1D plotting (Pure C), lines and curves. Default value is 0.03
.
void
mgl_set_base_line_width (HMGL
gr, float
val)The variable define the base width for all lines. The value <1 is ignored. Increase of this variables is actual for large bitmap pictures. Default value is 1
.
void
mgl_set_tick_len (HMGL
gr, float
val, float
stt)The relative length of axis ticks. Default value is 0.1
. Parameter stt>0 set relative length of subticks which is in sqrt(1+stt)
times smaller.
void
mgl_set_tick_stl (HMGL
gr, const char *
stl, const char *
sub)The line style of axis ticks (stl) and subticks (sub). If stl is empty then default style is used (‘k’ or ‘w’ depending on transparency type). If sub is empty then ticks style is used (i.e. stl).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions control the overall zooming of the picture or the sub-picture. Normally you can use these variables and functions for removing “white” spaces around a plot.
void
mgl_set_plotfactor (HMGL
gr, float
val)Sets the factor of plot size. It is not recommended to set it lower then 1.6. This is some anlogue of function Zoom() but applied not to overall image but for each InPlot. Use negative value to enable automatic PlotFactor
selection.
void
mgl_set_zoom (HMGL
gr, float
x1, float
y1, float
x2, float
y2)Changes the scale of graphics that correspond to zoom in/out of the picture. After function call the current plot will be cleared and further the picture will contain plotting from its part [x1,x2]*[y1,y2]. Here picture coordinates x1, x2, y1, y2 changes from 0 to 1. Use Zoom(0,0,1,1)
to return default view.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions set the condition when the points are excluded (cutted) from the drawing.
void
mgl_set_cut (HMGL
gr, int
val)Determines how points outside bounding box are drawn. If it is true
then points are excluded from plot (it is default) otherwise the points are projected to edges of bounding box.
void
mgl_set_cut_box (HMGL
gr, float
x1, float
y1, float
z1, float
x2, float
y2, float
z2)Lower and upper edge of the box in which never points are drawn. If both edges are the same (the variables are equal) then the cutting box is empty. See section CutMinMax sample, for sample code and picture.
void
mgl_set_cutoff (HMGL
gr, const char *
EqC)Function set the cutting off condition by formula EqC. This condition determine will point be plotted or not. If value of formula is nonzero then point is omitted, otherwise it plotted. Set argument as NULL
to disable cutting off condition. See section CutOff sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_set_font_size (HMGL
gr, float
val)Sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels.
void
mgl_set_font_def (HMGL
gr, const char *
val)Sets the font specification (see section Text printing (Pure C)). Default is “rC” – Roman font centering.
void
mgl_set_rotated_text (HMGL
gr, int
val)Sets to use or not text rotation along axis.
void
mgl_load_font (HMGL
gr, const char *
name, const char *
path)Load font typeface from path/name.
void
mgl_copy_font (HMGL
gr, HMGL
gr_from)Copy font data from another HMGL object.
void
mgl_restore_font (HMGL
gr)Restore font data to default typeface.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_set_palette (HMGL
gr, const char *
colors)Sets the palette as selected colors. Default value is "Hbgrcmyhlnqeup"
. The palette is used mostly in 1D plots (see section 1D plotting (Pure C)) for curves which styles are not specified.
void
mgl_set_pal_color (HMGL
gr, int
n, float
r, float
g, float
b)Sets color for individual palette entry. Look at mgl_set_palette()
function for simplified palette setting.
void
mgl_set_pal_num (HMGL
gr, int
num)Sets the number of actual colors in palette. The value must be less then 100.
void
mgl_set_scheme (HMGL
gr, const char *
sch)Sets the color scheme for following plots. Usually this function is used internally. See section Color scheme.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_set_meshnum (HMGL
gr, int
num)Sets approximate number of lines in Mesh(), Fall(), Grid() and also the number of hachures in Vect(), VectC(), Dew() and the number of cells in Cloud*(). By default (=0) it draws all lines/hachures/cells.
mgl_set_axial_dir (HMGL
gr, char
dir)Sets direction around which curve rotated in Axial() and Torus(). Default value is ’z’.
void
mgl_set_draw_face (HMGL
gr, int
val)If set to true
then it prevent faces drawing. It is useful for speeding up drawing (for example, during rotation and so on).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These large set of functions control how the axis and ticks will be drawn. Note that there is 3-step transformation of data coordinates are performed. Firstly, coordinates are projected if Cut=true
(see section Cutting (Pure C)), after it transformation formulas are applied, and finally the data was normalized in bounding box.
8.4.1 Ranges (bounding box) (Pure C) | ||
8.4.2 Transformation (curved coordinates, Pure C) | ||
8.4.3 Ticks (Pure C) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_set_axis_2d (HMGL
gr, float
x1, float
y1, float
x2, float
y2)void
mgl_set_axis_3d (HMGL
gr, float
x1, float
y1, float
z1, float
x2, float
y2, float
z2)Sets maximal and minimal values for coordinate range (bounding box). If minimal and maximal values of the coordinate are the same or a variable is absent in the list of arguments then they are ignored. This function also sets Cmin=z1 and Cmax=z2. This is default color range for 2d plots.
void
mgl_set_caxis (HMGL
gr, float
c1, float
c2)Sets values for color range. This values are used later for determining the color of the surface.
void
mgl_set_xrange (HMGL
gr, const HMDT
a, int
add)Sets values of x-range as minimal and maximal values of data a. See also mgl_set_axis().
void
mgl_set_yrange (HMGL
gr, const HMDT
a, int
add)Sets values of y-range as minimal and maximal values of data a. See also mgl_set_axis().
void
mgl_set_zrange (HMGL
gr, const HMDT
a, int
add)Sets values of z-range as minimal and maximal values of data a. See also mgl_set_axis().
void
mgl_set_crange (HMGL
gr, const HMDT
a, int
add)Sets values of color range as minimal and maximal values of data a. See also mgl_set_caxis().
void
mgl_set_origin (HMGL
gr, float
x0, float
y0, float
z0)Sets center of axis cross section. If one of values is NAN then MathGL library try to select optimal axis position.
void
mgl_set_auto (HMGL
gr, float
x1, float
x2, float
y1, float
y2, float
z1, float
z2)Sets ranges for automatic variables of plots. It act as changing of Min, Max proprties without calling of RecalcBorder(). Function don’t change the direction if minimal and maximal values are the same. For example, if yy1=y2 then ranges along y-direction will not be changed (will be used previous one). Note that the automatic range become axis range after next call of [XYZ]Range() function(s).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_set_func (HMGL
gr, const char *
EqX, const char *
EqY, const char *
EqZ)Sets the transformation formulas for curvilinear coordinate. Each string should contain mathematical expression for new (real) coordinate depending on old (input) coordinates x, y, z. For example, the cylindrical coordinates are introduced as mgl_set_func("x*cos(y)", "x*sin(y)", "z");
. For removing of formulas the corresponding parameter should be NULL
. Using transformation formulas will slightly slowing the program, i.e. mgl_set_func(NULL, NULL, NULL)
is faster than mgl_set_func("x", "y", "z")
. See section mglFormula class.
void
mgl_set_coor (HMGL
gr, int
how)Sets one of the predefined transformation formulas for curvilinear coordinate. Paramater how define the coordinates: mglCartesian=0
– Cartesian coordinates (no transformation); mglPolar=1
– Polar coordiantes x_n=x*cos(y),y_n=x*sin(y), z_n=z; mglSpherical=2
– Sperical coordinates x_n=x*sin(y)*cos(z), y_n=x*sin(y)*sin(z), z_n=x*cos(y); mglParabolic=3
– Parabolic coordinates x_n=x*y, y_n=(x*x-y*y)/2, z_n=z; mglParaboloidal=4
– Paraboloidal coordinates x_n=(x*x-y*y)*cos(z)/2, y_n=(x*x-y*y)*sin(z)/2, z_n=x*y; mglOblate=5
– Oblate coordinates x_n=cosh(x)*cos(y)*cos(z), y_n=cosh(x)*cos(y)*sin(z), z_n=sinh(x)*sin(y); mglProlate=6
– Prolate coordinates x_n=sinh(x)*sin(y)*cos(z), y_n=sinh(x)*sin(y)*sin(z), z_n=cosh(x)*cos(y); mglElliptic=7
– Elliptic coordinates x_n=cosh(x)*cos(y), y_n=sinh(x)*sin(y), z_n=z; mglToroidal=8
– Toroidal coordinates x_n=sinh(x)*cos(z)/(cosh(x)-cos(y)), y_n=sinh(x)*sin(z)/(cosh(x)-cos(y)), z_n=sin(y)/(cosh(x)-cos(y)); mglBispherical=9
– Bispherical coordinates x_n=sin(y)*cos(z)/(cosh(x)-cos(y)), y_n=sin(y)*sin(z)/(cosh(x)-cos(y)), z_n=sinh(x)/(cosh(x)-cos(y)); mglBipolar=10
– Bipolar coordinates x_n=sinh(x)/(cosh(x)-cos(y)), y_n=sin(y)/(cosh(x)-cos(y)), z_n=z.
void
mgl_set_ternary (HMGL
gr, int
tern)The function sets to draws Ternary plot. This special plot is for 3 dependent coordinates (components) a, b, c so that a+b+c=1. MathGL uses only 2 independent coordinates a=x and b=y since it is enough to plot everything. At this third coordinate z act as another parameter to produce contour lines, surfaces and so on. See section Ternary plot sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_adjust_ticks (HMGL
gr, const char *
dir)Set the ticks step, number of sub-ticks and initial ticks position to be the most human readable for the axis along direction(s) dir. Also set TuneTicks=true
.
void
mgl_set_ticks_dir (HMGL
gr, char
dir, float
d, int
ns, float
org)Set the ticks step d, number of sub-ticks ns and initial ticks position org for the axis along direction dir. Variable d set step for axis ticks (if positive) or it’s number on the axis range (if negative). Zero value set logarithmic ticks. If org value is NAN then value from Org is used.
void
mgl_set_ticks_vals (HMGL
gr, char
dir, int
n, float *
val, const char **
lbl)void
mgl_set_ticks_val (HMGL
gr, char
dir, int
n, double
val, const char *
lbl, ...)Set the manual positions val and its labels lbl for n-th ticks along axis dir. The arrays val and lbl have to contain n elements. Use mgl_set_ticks_dir()
to restore automatic ticks. Note, these functions are not available in Fortran interface. Note, you have to be very careful to use floating-point (not integer!!!) values as ticks position due to limitations of stdarg library (argument transfer). See section Tick values sample, for sample code and picture.
void
mgl_set_ticks (HMGL
gr, float
dx, float
dy, float
dz)Step for axis ticks (if positive) or it’s number (if negative) in x-,y-,z- directions. Zero value set logarithmic ticks. This function are obsolete – use mgl_set_ticks_dir()
function instead.
void
mgl_set_subticks (HMGL
gr, int
nx, int
ny, int
nz)Number of axis subticks in x-,y-,z- directions. This function are obsolete – use mgl_set_ticks_dir()
function instead.
void
mgl_set_tick_origin (HMGL
gr, float
x0, float
y0, float
z0)Starting point for ticks. If corresponding value is NAN then value from Org is used (it is default). This function are obsolete – use mgl_set_ticks_dir()
function instead.
void
mgl_set_xttw (HMGL
gr, const wchar_t *
templ)void
mgl_set_yttw (HMGL
gr, const wchar_t *
templ)void
mgl_set_zttw (HMGL
gr, const wchar_t *
templ)void
mgl_set_cttw (HMGL
gr, const wchar_t *
templ)void
mgl_set_xtt (HMGL
gr, const wchar_t *
templ)void
mgl_set_ytt (HMGL
gr, const wchar_t *
templ)void
mgl_set_ztt (HMGL
gr, const wchar_t *
templ)void
mgl_set_ctt (HMGL
gr, const wchar_t *
templ)The template for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. If templ=NULL
then default template is used (in simplest case it is ‘%.2g’) with automatic detaching of common multiplier or common component (see TuneTicks).
void
mgl_tune_ticks (HMGL
gr, int
tune, float
fact_pos)Switch on/off ticks enhancing by factoring common multiplier (for small, like from 0.001 to 0.002, or large, like from 1000 to 2000, coordinate values) or common component (for narrow range, like from 0.999 to 1.000). Also set the position of common multiplier/component on the axis: =0 at minimal axis value, =1 at maximal axis value. Default value is 1.15.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions control how and where further plotting will be placed. There is a curtain order of calling of these functions for the better plot view. First one should be SubPlot() or InPlot() for specifying the place. After it a Rotate() and Aspect(). And finally any other plotting functions may be called. Alternatevely you can use ColumnPlot() for position plots in the column one by another without gap between plot axis (bounding boxes).
void
mgl_subplot (HMGL
gr, int
nx, int
ny, int
m)void
mgl_subplot_d (HMGL
gr, int
nx, int
ny, int
m, float
dx, float
dy)Puts further plotting in a m-th cell of nx*ny grid of the whole frame area. This function set off any aspects or rotations. So it should be used first for creating the subplot. From the aesthetical point of view it is not recommended to use this function with different matrices in the same frame. The position of the cell can be shifted from its default position by relative size dx, dy.
void
mgl_inplot (HMGL
gr, float
x1, float
x2, float
y1, float
y2)Puts further plotting in some region of the whole frame surface. This function allows one to create a plot in arbitrary place of the screen. The position is defined by rectangular coordinates [x1, x2]*[y1, y2]. The coordinates x1, x2, y1, y2 are normalized to interval [0, 1]. This function set off any aspects or rotations. So it should be used first for creating subplot.
void
mgl_relplot (HMGL
gr, float
x1, float
x2, float
y1, float
y2)Puts further plotting in some region of the last SubPlot() or InPlot(). This function allows one to create a plot in arbitrary place of the screen. The position is defined by rectangular coordinates [x1, x2]*[y1, y2]. The coordinates x1, x2, y1, y2 are normalized to interval [0, 1]. This function set off any aspects or rotations. So it should be used first for creating subplot.
void
mgl_rotate (HMGL
gr, float
TetX, float
TetZ, float
TetY)Rotates a further plotting relative to each axis (x, z, y) consecutively on angles TetX, TetZ, TetY.
void
mgl_rotate_vector (HMGL
gr, float Tet
, float x
, float y
, float z
)Rotates a further plotting around vector {x,y,z}.
void
mgl_aspect (HMGL
gr, float
Ax, float
Ay, float
Az)Defines aspect ratio for the plot. The viewable axes will be related one to another as the ratio Ax:Ay:Az. For the best effect it should be used after Rotate() function.
void
mgl_perspective (HMGL
gr, float
a)Add (switch on) the perspective to plot. The parameter a ~ 1/z_eff \in [0,1). By default (a=0
) the perspective is off.
void
mgl_identity (HMGL
gr)Clears transformation matrix. This function clears all previous effects of Aspect(), SubPlot(), InPlot() or Rotate() functions. It is equivalent to the call of mgl_inplot(0,1,0,1)
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions export current view to a graphic file. The filename fname should have appropriate extension. Parameter descr gives the short description of the picture. Just now the transparency is supported in PNG and SVG files.
void
mgl_write_frame (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to a file fname which type is determined by the extension. Parameter descr adds description to file (can be NULL
). If fname=NULL
then the file ‘frame####.jpg’ is used, where ‘####’ is current frame id.
void
mgl_write_png (HMGL
gr, const char *
fname, const char *
descr)void
mgl_write_png_solid (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to PNG file with transparent background. Parameter fname specifies the file name, descr adds description to file (can be NULL
).
void
mgl_write_jpg (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to JPEG file with non-transparent background (usually white). Parameter fname specifies the file name, descr adds description to file (can be NULL
).
void
mgl_write_gif (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to GIF file with non-transparent background (usually white). Parameter fname specifies the file name, descr adds description to file (can be NULL
).
void
mgl_write_bmp (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to BMP file. Parameter fname specifies the file name, descr adds description to file (can be NULL
). There is no compression used.
void
mgl_write_eps (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to EPS file. The vector representation is used if possible. So it is not recommended for the export of large data plot. It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (can be NULL
).
void
mgl_write_svg (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to SVG (Scalable Vector Graphics) file. The vector representation is used. In difference of EPS format, SVG format support transparency that allows to correctly draw half-transparent plot (like SurfA(), Surf3A(), Cloud()). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name).
void
mgl_write_idtf (HMGL
gr, const char *
fname, const char *
descr)Exports current frame to IDTF file. Later this file can be converted to U3D format. The vector representation is used. So, the output file may be too large for graphic of large data array (especially for surfaces). However, program has no internal limitations for size of output file. Parameter fname specifies the file name, descr adds description to file (default is file name).
void
mgl_show_image (const char *
viewer, int
nowait)Displays the current picture using external program viewer for viewing. The function save the picture to temporary file and call viewer to display it. If nowait=true
then the function return immediately (it will not wait while window will be closed).
void
mgl_set_size (HMGL
gr, int
width, int
height)Sets size of picture in pixels. This function must be called before any other plotting because it completely remove picture contents.
void
mgl_flush (HMGL
gr)Flushes the plotting commands to frame. This function may be useful if one wants to remove array before the finishing of the plot (i.e. before calling Finish()
). Also call of this function separate the objects in mglGraphIDTF. Most of plots call this function internally.
int
mgl_get_width (HMGL
gr)int
mgl_get_height (HMGL
gr)Gets width or height of the image.
const unsigned char *
mgl_get_rgb (HMGL
gr)Gets RGB bitmap of the current state of the image. Format of each element of bits is: {red, green, blue}. Number of elements is Width*Height. Position of element {i,j} is [3*i + 3*Width*j].
const unsigned char *
mgl_get_rgba (HMGL
gr)Gets RGBA bitmap of the current state of the image. Format of each element of bits is: {red, green, blue, alpha}. Number of elements is Width*Height. Position of element {i,j} is [4*i + 4*Width*j].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw some simple objects like line, point, sphere, drop, cone and so on.
void
mgl_clf (HMGL
gr)void
mgl_clf_rgb (HMGL
gr, float
r, float
g, float
b)Clear the picture and will it by color {r,g,b} or previous one.
void
mgl_ball (HMGL
gr, float
x, float
y, float
z)void
mgl_ball_rgb (HMGL
gr, float
x, float
y, float
z, float
r, float
g, float
b, float
alpha)void
mgl_ball_str (HMGL
gr, float
x, float
y, float
z, const char *
col)Draws a point (ball) at position {x, y, z} with color defined by string col or by RGBA values {r, g, b; alpha}. Default color is red.
void
mgl_line (HMGL
gr, float
x1, float
y1, float
z1, float
x2, float
y2, float
z2, char *
stl, int
num)Draws a geodesic line (straight line in Cartesian coordinates) from point {x1,y1,z1} to {x2,y2,z2} using line style stl. Parameter num define the “quality” of the line. If num=2
then the straight line will be drawn in all coordinate system (independently on transformation formulas (see section Transformation (curved coordinates, Pure C)). Contrary, for large values (for example, =100
) the geodesic line will be drawn in corresponding coordinate system (straight line in Cartesian coordinates, circle in polar coordinates and so on).
void
mgl_curve (HMGL
gr, float
x1, float
y1, float
z1, float
dx1, float
dy1, float
dz1, float
x2, float
y2, float
z2, float
dx2, float
dy2, float
dz2, const char *
stl, int
num)Draws Bezier-like curve from point {x1,y1,z1} to {x2,y2,z2} using line style stl. At this tangent is co-directed with {dx1,dy1,dz1}, {dx2,dy2,dz2} and proportional to its amplitude. Parameter num define the number of points for the curve.
void
mgl_facex (HMGL
gr, float
x0, float
y0, float
z0, float
wy, float
wz, const char *
stl, float
d1, float
d2)void
mgl_facey (HMGL
gr, float
x0, float
y0, float
z0, float
wx, float
wz, const char *
stl, float
d1, float
d2)void
mgl_facez (HMGL
gr, float
x0, float
y0, float
z0, float
wx, float
wy, const char *
stl, float
d1, float
d2)Draws the solid rectangle (face) perpendicular to [x,y,z]-axis correspondingly at position {x0, y0, z0} with color stl and with widths wx, wy, wz along corresponding directions. At this colors can be the same for all vertexes or different if all 4 colors are specified for each vertex. Parameters d1!=0, d2!=0 set additional shift of the last vertex (i.e. to draw quadrangle).
void
mgl_sphere (HMGL
gr, float
x0, float
y0, float
z0, float
r, const char *
stl)Draw the sphere with radius r and center at point {x0, y0, z0} and color stl.
void
mgl_drop (HMGL
gr, float
x0, float
y0, float
z0, float
dx, float
dy, float
dz, float
r, const char *
col, float
shift, float
ap)Draw the drop with radius r at point {x0,y0,z0} elongated in direction {dx,dy,dz} and with color col. Parameter shift set the degree of drop oblongness: ‘0’ is sphere, ‘1’ is maximally oblongness drop. Parameter ap set relative width of the drop (this is analogue of “ellipticity” for the sphere). See section Drops sample, for sample code and picture.
void
mgl_cone (HMGL
gr, float
x1, float
y1, float
z1, float
x2, float
y2, float
z2, float
r1, float
r2, const char *
stl, int
draw_edge)Draw tube (or truncated cone if edge=false
) between points {x1,y1,z1}, {x2,y2,z2} with radius at the edges r1, r2. If r2<0 then it is suppsosed that r2=r1. The cone color is defined by string stl.
void
mgl_mark (HMGL
gr, float
x, float
y, float
z, char
mark)Draws a marks of different type at position {x,y,z}.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. The class mglFont (see section mglFont class) is used for low-level string parsing and printing. It can use arbitrary font-faces and parse many TeX commands. All these functions have 2 variant: for printing 8-bit text (char *
) and for printing Unicode text (wchar_t *
). In first case the conversion in current locale is used. So sometimes you need to specify it by setlocale()
function. The size argument control the size of text: if positive it give the value, if negative it give the value relative to FontSize. The font type (STIX, arial, courier, times and so on) can be selected by function mgl_load_font()
. See section Font settings.
The font parameters are described by string. This string may contain several characters of font type (‘rbiwou’) and/or align (‘LRC’) specification. Also it may contain the text color ‘wkrgbcymhRGBCYMHW’ (see section mglColor class) after symbol ‘:’. The font types are: ‘r’ – roman font, ‘i’ – italic style, ‘b’ – bold style, ‘w’ – wired style, ‘o’ – over-lined text, ‘u’ – underlined text. By default roman font is used. The align types are: ‘L’ – align left (default), ‘C’ – align center, ‘R’ – align right. Also a parsing of the LaTeX-like syntax is provided (for detail see section mglFont class). For example, string ‘iC:b’ correspond to italic font style for centered text which printed by blue color.
void
mgl_puts (HMGL
gr, float
x, float
y, float
z, const char *
text)void
mgl_putsw (HMGL
gr, float
x, float
y, float
z, const wchar_t *
text)void
mgl_puts_ext (HMGL
gr, float
x, float
y, float
z, const char *
text, const char *
font, float
size, char
dir)void
mgl_putsw_ext (HMGL
gr, float
x, float
y, float
z, const wchar_t *
text, const char *
font, float
size, char
dir)The function plots the string text at position {x,y,z} with fonts specifying by the criteria how. The size of font is set by size parameter (default is FontSize). Parameter dir specifies the additional string align. The aligns are: ‘x’ – align as x-label, ‘y’ – align as y-label, ‘z’ – align as z-label, ‘i’ – align as x-label but inverse writing direction, ‘t’ – no align (default), ‘n’ – align in x-y plane.
void
mgl_puts_dir (HMGL
gr, float
x, float
y, float
z, float
dx, float
dy, float
dz, const char *
text, float
size)void
mgl_putsw_dir (HMGL
gr, float
x, float
y, float
z, float
dx, float
dy, float
dz, const wchar_t *
text, float
size)The function plots the string text at position {x,y,z} along direction {dx,dy,dz} with specified size.
void
mgl_title (HMGL
gr, const char *
text, const char *
font, int
size)void
mgl_titlew (HMGL
gr, const wchar_t *
text, const char *
font, int
size)Print string text as title of the picture (at the top of the picture). Can be used at any place (even inside SubPlot()).
void
mgl_text_y (HMGL
gr, const HMDT
y, const char *
text, const char *
font, float size)void
mgl_text_xy (const HMDT
x, const HMDT
y, const char *
text, const char *
font, float size)void
mgl_text_xyz (const HMDT
x, const HMDT
y, const HMDT
z, const char *
text, const char *
font, float size)The function draws text along the curve between points {x[i], y[i], z[i]} by font style font and with size size. The string font may contain symbols ‘t’ for printing the text under the curve (default), or ‘T’ for printing the text above the curve. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. If array x is not specified then its an automatic array is used with values equidistantly distributed in interval [Min.x, Max.x] (see section Ranges (bounding box) (Pure C)). If array z is not specified then z[i] = zVal is used. See section Text sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw the “things for measuring”, like axis with ticks, colorbar with ticks, grid along axis, bounding box and labels for axis. For more information see section Axis settings (Pure C).
void
mgl_axis (HMGL
gr, const char *
dir)Draws axes with ticks (see section Axis settings (Pure C)) in directions determined by string parameter dir.If string contain the symbol ‘_’ then tick labels are not printed. Font for ticks labels is determined by mgl_set_font_def()
(see section Font settings).
void
mgl_colorbar (HMGL
gr, const char *
sch, int
where)Draws colorbar with color scheme sch (current scheme if sch=NULL
) at edge of plot. Parameter where specifies the position of colorbar: ‘0’ - at right (default), ‘1’ - at left, ‘2’ - at top, ‘3’ - at bottom. See section Dens sample, for sample code and picture.
void
mgl_colorbar_ext (HMGL
gr, const char *
sch, int
where, float
x, float
y, float
w, float
h)Draws colorbar with color scheme sch (current scheme if not specified) at arbitrary position of subplot {x, y} (supposed to be in range [0,1]). Parameter where specifies the position of colorbar labels: ‘0’ - at left, ‘1’ - at right, ‘2’ - at bottom, ‘3’ - at top. Parameters w, h set the relative width and height of the colorbar.
void
mgl_colorbar_val (HMGL
gr, const HMDT
v, const char *
sch, int
where)Draws colorbar with sharp colors sch (current palette if sch=NULL
) for values v at edge of plot. Parameter where specifies the position of colorbar: ‘0’ - at right (default), ‘1’ - at left, ‘2’ - at top, ‘3’ - at bottom. See section Dens sample, for sample code and picture.
void
mgl_axis_grid (HMGL
gr, const char *
dir, const char *
pen)Draws grid lines perpendicular to direction determined by string parameter dir. The step of grid lines is the same as tick step for an Axis(). The style of lines is determined by pen parameter.
void
mgl_box (HMGL
gr, int
ticks)void
mgl_box_rgb (HMGL
gr, float
r, float
g, float
b, int
ticks)void
mgl_box_str (HMGL
gr, const char *
col, int
ticks)Draws bounding box outside the plotting volume with color specified by string col or by RGB values.
void
mgl_label (HMGL
gr, char
dir, const char *
text)void
mgl_label_ext (HMGL
gr, char
dir, const char *
text, int
pos, float
size, float
shift)Prints the label text for axis dir=‘x’,‘y’,‘z’,‘t’ (here ‘t’ is “ternary” axis t=1-x-y). The position of label is determined by pos parameter. If pos=0 then label is printed at the center of axis. If pos>0 then label is printed at the maximum of axis (default). If pos<0 then label is printed at the minimum of axis. Parameter size determines the font size for the label. By default the font size is 1.4 times larger than the one for ticks FontSize. See section Text printing (Pure C).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw legend to the graph (useful for 1D plotting (Pure C)). Legend entry is a pair of strings: one for style of the line, another one with description text (with included LaTeX parsing). The array of string are accumulated first to the internal arrays (by function AddLegend()) and are plotted later. The position of the legend can be selected automatic or manually. Parameters font and size specify the font style and size (see section Font settings). Parameter llen set the relative width of the line sample and the text indent (default value is 0.1). If line style string for entry is empty then the corresponding text is printed without indent. See section Legend sample, for sample code and picture.
void
mgl_legend (HMGL
gr, int
where, const char *
font, float
size, float
llen)Draws legend of accumulated legend entries by font font with size. Parameter where sets the position of the legend: ‘0’ is bottom left corner, ‘1’ is bottom right corner, ‘2’ is top left corner, ‘3’ is top right corner (is default).
void
mgl_legend_xy (HMGL
gr, float
x, float
y, const char *
font, float
size, float
llen)Draws legend of accumulated legend entries by font font with size. Position of legend is determined by parameter x, y which supposed to be normalized to interval [0,1].
void
mgl_add_legend (HMGL
gr, const char *
text, const char *
style)void
mgl_add_legendw (HMGL
gr, const wchar_t *
text, const char *
style)Adds string text to internal legend accumulator. The style of described line and mark is specified in string style (see section Line styles). Maximal number of entries is 100.
void
mgl_clear_legend (HMGL
gr)Clears saved legend strings.
void
mgl_set_legend_box (HMGL
gr, int
enable)Switch on/off drawing box near legend. By default (=true
) box is drawn.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 1D data. 1D means that data depended from only 1 parameter like parametric curve {x(i),y(i),z(i)}, i=1...n. There are 5 generally different types of data representations: simple line plot (Plot), line plot with filling under it (Area), stairs plot (Step), bar plot (Bars, Barh) and vertical lines (Stem). Each type of plotting has similar interface. There are 3D version and two 2D versions. One of last requires single array. The parameters of line and marks are specified by the string argument. If the string parameter is NULL then solid line with color from palette Pal is used (see section Pallete and colors). Also there are some special 1d plots having slightly different interface: surface of curve rotation (Torus), chart (Chart) and error boxes (Error), marks with variable size (Mark), tubes (Tube) and so on. See section Line styles.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous lines between points. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Area(), Step(), Stem, Tube(), Mark(), Error(), Belt(). See section Plot sample, for sample code and picture.
void
mgl_plot_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
pen)The function draws continuous lines between points {x[i], y[i], z[i]} in 3D space.
void
mgl_plot_xy (HMGL
gr, const HMDT
x, const HMDT
y, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z.
void
mgl_plot (HMGL
gr, const HMDT
y, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_radar (HMGL
gr, const HMDT
a, const char *
pen, float
r)This functions draws radar chart which is continuous lines between points located on an radial lines (like plot in Polar coordinates). The plots are drawn for each row if one of the data is the matrix. Parameter r set the additional shift of data (i.e. the data a+r is used instead of a). If r<0
then r=max(0, -min(a)
. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). If pen containt ‘#’ symbol then "grid" (radial lines and circle for r) is drawn See also Plot. See section Radar sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous lines between points with color defined by the special array (look like tension plot). The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color scheme (see section Color scheme) and style and/or width of line (see section Line styles). By default (pen=NULL
) solid line with current color scheme is used. See also Plot(), Mesh(), Fall(). See section Tens sample, for sample code and picture.
void
mgl_tens_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
c, const char *
pen)The function draws continuous lines between points {x[i], y[i], z[i]} in 3D space with color defined by c[i].
void
mgl_tens_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
c, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z with color defined by c[i].
void
mgl_tens (HMGL
gr, const HMDT
y, const HMDT
c, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z with color defined by c[i], where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous lines between points and fills it to axis plane. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot(), Bars(), Stem(). See section Area sample, for sample code and picture.
void
mgl_area_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
pen)The function draws continuous lines between points {x[i], y[i], z[i]} in 3D space and fills it down to z = Org.z.
void
mgl_area_xy (HMGL
gr, const HMDT
x, const HMDT
y, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z and fills it down to y = Org.y.
void
mgl_area_xys (HMGL
gr, const HMDT
x, const HMDT
y, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z and fills it down to y = Org.y. The lines are drawn one abover another (like summation). Note, you can reach the same effect if call mgl_data_cumsum(y,"y");
before plot.
void
mgl_area (HMGL
gr, const HMDT
y, const char *
pen)The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z and fills it down to y = Org.y, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions fill area between 2 curves. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y1.nx=y2.nx and all dimensions of arrays y1 and y2 must be equal too. String pen specifies the color (see section Line styles). By default (pen=NULL
) color from palette is used (see section Pallete and colors). See also Area(), Bars(), Stem(). See section Region sample, for sample code and picture.
void
mgl_region_xy (HMGL
gr, const HMDT
x, const HMDT
y1, const HMDT
y2, const char *
pen, int
inside)The function fills area between curves {x[i], y1[i]} and {x[i], y2[i]}.
void
mgl_region (HMGL
gr, const HMDT
y1, const HMDT
y2, const char *
pen, int
inside)The function fills area between curves {x[i], y1[i]} and {x[i], y2[i]}, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw vertical bars from points to axis plane. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Barh(), Area(), Stem(), Chart(). See section Bars sample, for sample code and picture.
void
mgl_bars_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
pen=NULL
)The function draws vertical bars from points {x[i], y[i], z[i]} down to z = Org.z.
void
mgl_bars_xy (HMGL
gr, const HMDT
x, const HMDT
y, const char *
pen=NULL
, float
zVal=NAN
)The function draws vertical bars from points {x[i], y[i]} down to y = Org.y in plane z=zVal (default in plane z=Min.z).
void
mgl_bars (HMGL
gr, const HMDT
y, const char *
pen=NULL
, float
zVal=NAN
)The function draws vertical bars from points {x[i], y[i]} down to y = Org.y in plane z=zVal (default in plane z=Min.z), where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw horizontal bars from points to axis plane. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Bars(). See section Barh sample, for sample code and picture.
void
mgl_barh_xy (HMGL
gr, const HMDT
y, const HMDT
v, const char *
pen=NULL
, float
zVal=NAN
)The function draws horizontal bars from points {v[i], y[i]} down to x = Org.x in plane z=zVal (default in plane z=Min.z).
void
mgl_barh (HMGL
gr, const HMDT
v, const char *
pen=NULL
, float
zVal=NAN
)The function draws horizontal bars from points {v[i], y[i]} down to x = Org.x in plane z=zVal (default in plane z=Min.z), where y[i] values are equidistantly distributed in interval [Min.y, Max.y].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw vertical lines from points to axis plane. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Area(), Bars(), Plot(). See section Stem sample, for sample code and picture.
void
mgl_stem_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
pen)The function draws vertical lines from points {x[i], y[i], z[i]} down to z = Org.z.
void
mgl_stem_xy (HMGL
gr, const HMDT
x, const HMDT
y, const char *
pen)The function draws vertical lines from points {x[i], y[i]} down to y = Org.y in plane z=Min.z.
void
mgl_stem (HMGL
gr, const HMDT
y, const char *
pen)The function draws vertical lines from points {x[i], y[i]} down to y = Org.y in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous stairs for points to axis plane. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot(), Stem(), Tile(), Boxs(). See section Step sample, for sample code and picture.
void
mgl_step_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
pen)The function draws continuous stairs for points {x[i], y[i], z[i]}.
void
mgl_step_xy (HMGL
gr, const HMDT
x, const HMDT
y, const char *
pen)The function draws continuous stairs for points {x[i], y[i]} in plane z=Min.z.
void
mgl_step (HMGL
gr, const HMDT
y, const char *
pen)The function draws continuous stairs for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw surface which is result of curve {r, z} rotation around AxialDir axis (see section Other settings). The sizes of 1st dimension must be equal for all arrays r.nx=z.nx. String pen specifies the color (see section Line styles). By default (pen=NULL
) color from palette is used (see section Pallete and colors). See also Plot(), Axial(). See section Torus sample, for sample code and picture.
void
mgl_torus (HMGL
gr, const HMDT
r, const HMDT
z, const char *
pen)The function draws surface which is result of curve {r[i], z[i]} rotation.
void
mgl_torus_2 (HMGL
gr, const HMDT
z, const char *
pen)The function draws surface which is result of curve {r[i], z[i]} rotation, where r[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_chart (HMGL
gr, const HMDT
a, const char *
col)The function draws colored stripes (boxes) for data in array a. The number of stripes is equal to the number of rows in a (equal to a.ny). The color of each next stripe is cyclically changed from colors specified in string col or in palette Pal (see section Pallete and colors). Spaces in colors denote transparent “color”, i.e. if col contain space(s) then corresponding stripe(s) are not drawn. The stripe width is proportional to value of element in a. Chart is plotted only for data with non-negative elements. If string col have symbol ‘#’ then black border lines are drawn. The most nice form the chart have in 3d (after rotation of coordinates) or in cylindrical coordinates (becomes so called Pie chart). See section Chart sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw marks with size r*MarkSize (see section Default sizes) at points {x[i], y[i], z[i]}. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). If you need to draw markers of the same size then you may use Plot() function. See also Plot(), TextMark(), Stem(), Error(). See section Mark sample, for sample code and picture.
void
mgl_mark_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
r, const char *
pen)The function draws marks for points {x[i], y[i], z[i]} in 3D space.
void
mgl_mark_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
r, const char *
pen)The function draws marks for points {x[i], y[i]} in plane z=Min.z.
void
mgl_mark_y (HMGL
gr, const HMDT
y, const HMDT
r, const char *
pen)The function draws marks for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw string text as marks with size proportional to r*MarkSize (see section Default sizes) at points {x[i], y[i], z[i]}. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot(), Mark(), Stem(). See section TextMark sample, for sample code and picture.
void
mgl_textmarkw_xyzr (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
r, const wchar_t *
text, const char *
fnt=NULL
)void
mgl_textmark_xyzr (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
r, const char *
text, const char *
fnt=NULL
)The function draws textual marks for points {x[i], y[i], z[i]} in 3D space.
void
mgl_textmarkw_xyr (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
r, const wchar_t *
text, const char *
fnt)void
mgl_textmark_xyr (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
r, const char *
text, const char *
fnt)The function draws textual marks for points {x[i], y[i]} in plane z=Min.z.
void
mgl_textmarkw_yr (HMGL
gr, const HMDT
y, const HMDT
r, const wchar_t *
text, const char *
fnt)void
mgl_textmark_yr (HMGL
gr, const HMDT
y, const HMDT
r, const char *
text, const char *
fnt)The function draws textual marks for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
void
mgl_textmarkw (HMGL
gr, const HMDT
y, const wchar_t *
text, const char *
fnt)void
mgl_textmark (HMGL
gr, const HMDT
y, const char *
text, const char *
fnt)The function draws textual marks for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x]. The mark sizes r[i]=1 for all points.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw error boxes at points {x[i], y[i]} on plane z = zVal (by default z=Min.z). This can be useful, for example, in experimental points, or to show numeric error or some estimations and so on. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot(). See section Error sample, for sample code and picture.
void
mgl_error_exy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ex, const HMDT
ey, const char *
pen)Draws a error box {ex, ey} in point position {x, y}.
void
mgl_error_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ey, const wchar_t *
pen)Draws a error box ey (along only one direction) in point position {x, y}.
void
mgl_error (HMGL
gr, const HMDT
y, const HMDT
ey, const char *
pen)Draws a error box ey (along only one direction) in point position {x, y}, where x values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw the tube with variable radius r along the curve between points {x[i], y[i], z[i]}. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot(). See section Tube sample, for sample code and picture.
void
mgl_tube_xyzr (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
r, const char *
pen)void
mgl_tube_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, float
r, const char *
pen)The function draws tube with radius r between points {x[i], y[i], z[i]} in 3D space.
void
mgl_tube_xyr (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
r, const char *
pen)void
mgl_tube_xy (HMGL
gr, const HMDT
x, const HMDT
y, float
r, const char *
pen)The function draws tube with radius r between points {x[i], y[i]} in plane z=Min.z.
void
mgl_tube_r (HMGL
gr, const HMDT
y, const HMDT
r, const char *
pen)void
mgl_tube (HMGL
gr, const HMDT
y, float
r, const char *
pen)The function draws tube with radius r between points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 2D data. 2D means that data depend from 2 independent parameters like matrix f(x_i,y_j), i=1...n, j=1...m. There are 6 generally different types of data representations: simple mesh lines plot (Mesh), surface plot (Surf), surface plot by boxes (Boxs), surface plot by tiles (Tile), waterfall-like plot (Fall), belt plot (Belt), density plot (Dens), contour lines plot (Cont), solid contours plot (ContF) and its rotational figure (Axial). Cont, ContF and Axial functions have variants for automatic and manual selection of level values for contours. Also there are functions for plotting data grid lines according to the data format (Grid) for enhancing density or contour plots. Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See section Color scheme.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_mesh_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)The function draws mesh lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Mesh lines are plotted for each z slice of the data. See also Surf(), Fall(), NeshNum, Cont(). See section Mesh sample, for sample code and picture.
void
mgl_mesh (HMGL
gr, const HMDT
z, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_fall_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch=NULL
)The function draws fall lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If sch contain ‘x’ then lines are drawn along x-direction else (by default) lines are drawn along y-direction. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Fall lines are plotted for each z slice of the data. See also Belt(), Mesh(), NeshNum. See section Fall sample, for sample code and picture.
void
mgl_fall (HMGL
gr, const HMDT
z, const char *
sch=NULL
)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_belt_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)The function draws belts for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. This plot can be used as 3d generalization of Plot(). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If sch contain ‘x’ then belts are drawn along x-direction else (by default) belts are drawn along y-direction. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Belts are plotted for each z slice of the data. See also Fall(), Surf(), Plot(), NeshNum. See section Belt sample, for sample code and picture.
void
mgl_belt (HMGL
gr, const HMDT
z, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_surf_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Mesh(), Dens(), Belt(), Tile(), Boxs(), SurfC(), SurfA(). See section Surf sample, for sample code and picture.
void
mgl_surf (HMGL
gr, const HMDT
z, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_boxs_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)The function draws vertical boxes for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Surf(), Tile(), Step(). See section Boxs sample, for sample code and picture.
void
mgl_boxs (HMGL
gr, const HMDT
z, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_tile_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Such plot can be used as 3d generalization of Step(). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Surf(), Boxs(), Step(), TileS(). See section Tile sample, for sample code and picture.
void
mgl_tile (HMGL
gr, const HMDT
z, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_dens_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, float
zVal)The function draws density plot for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Surf(), Cont(), ContF(), Dens[XYZ](). See section Dens sample, for sample code and picture.
void
mgl_dens (HMGL
gr, const HMDT
z, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_cont_xy_val (HMGL
gr, const HMDT
v, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, float
zVal)The function draws contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal (or for z=v[k] if zVal==NAN
). Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Dens(), ContF(), Axial(), Cont[XYZ](). See section Cont sample, for sample code and picture.
void
mgl_cont__val (HMGL
gr, const HMDT
v, const HMDT
z, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_cont_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, int
num, float
zVal)The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
mgl_cont (HMGL
gr, const HMDT
z, const char *
sch, int
num, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_contf_xy_val (HMGL
gr, const HMDT
v, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, float
zVal)The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal (or for z=v[k] if zVal==NAN
). Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v (must be v.nx>2
). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Dens(), Cont(), ContD(), Axial(), ContF[XYZ](). See section ContF sample, for sample code and picture.
void
mgl_contf_val (HMGL
gr, const HMDT
v, const HMDT
z, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_contf_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, int
num, float
zVal)The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
mgl_contf (HMGL
gr, const HMDT
z, const char *
sch, int
num, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_contd_xy_val (HMGL
gr, const HMDT
v, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, float
zVal)The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal (or for z=v[k] if zVal==NAN
) with manual colors. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v (must be v.nx>2
). String sch sets the contour colors: the color of k-th contour is determined by character sch[k%strlen(sch)]
. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Dens(), Cont(), ContF(). See section ContD sample, for sample code and picture.
void
mgl_contd_val (HMGL
gr, const HMDT
v, const HMDT
z, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_contd_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, int
num, float
zVal)The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
mgl_contd (HMGL
gr, const HMDT
z, const char *
sch, int
num, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_axial_xy_val (HMGL
gr, const HMDT
v, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)The function draws surface which is result of contour plot rotation for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then wire plot is produced. If string contain symbols ‘x’, ‘y’ or ‘z’ then rotation axis AxialDir (see section Other settings) will be set to specified direction. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Cont(), ContF(), Torus(), Surf3(). See section Axial sample, for sample code and picture.
void
mgl_axial_val (HMGL
gr, const HMDT
v, const HMDT
z, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_axial_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, int
num)The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
mgl_axial (HMGL
gr, const HMDT
z, const char *
sch, int
num)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_grid_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, float
zVal)The function draws grid lines for density plot of surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Grid is plotted for each z slice of the data. See also Dens(), Cont(), ContF().
void
mgl_grid (HMGL
gr, const HMDT
z, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 3D data. 3D means that data depend from 3 independent parameters like matrix f(x_i,y_j,z_k), i=1...n, j=1...m, k=1...l. There are 4 generally different types of data representations: isosurface or surface of constant value (Surf3), density plot at slices (Dens3), contour lines plot at slices (Cont3), solid contours plot at slices (ContF3) and cloud-like plot (Cloud). Surf3, Cont3 and ContF3 functions have variants for automatic and manual selection of level values for surfaces/contours. Also there are functions for plotting data grid lines according to the data format (Grid3) for enhancing density or contour plots. Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See section Color scheme.
8.13.1 Surf3 (Pure C) | ||
8.13.2 Dens3 (Pure C) | ||
8.13.3 Cont3 (Pure C) | ||
8.13.4 ContF3 (Pure C) | ||
8.13.5 Grid3 (Pure C) | ||
8.13.6 Cloud (Pure C) | ||
8.13.7 Beam |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_surf3_xyz_val (HMGL
gr, float
val, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl)The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. Arrays x, y, z can be vectors (not 3d arrays as a). Note, that there is possibility of incorrect plotting due to uncertainty of cross-section defining if there are two or more isosurface intersections inside one cell. See also CloudQ(), CloudP(), Dens3(), Surf3C(), Surf3A(), Axial(). See section Surf3 sample, for sample code and picture.
void
mgl_surf3_val (HMGL
gr, float
val, const HMDT
a, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_surf3_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl, int
num)Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
void
mgl_surf3 (HMGL
gr, const HMDT
a, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_dens3_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, char
dir, int
sVal, const char *
stl)The function draws density plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Density is plotted at slice sVal in dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Cont3(), ContF3(), Dens(), Grid3(). See section Dens3 sample, for sample code and picture.
void
mgl_dens3 (HMGL
gr, const HMDT
a, char
dir, int
sVal, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_dens3_all_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl)Draws density plots at all central slices of the 3d data specified parametrically.
void
mgl_dens3_all (HMGL
gr, const HMDT
a, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_cont3_xyz_val (HMGL
gr, const HMDT
v, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, char
dir, int
sVal, const char *
stl)The function draws contour plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Contours are plotted for values specified in array v at slice sVal in dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Dens3(), ContF3(), Cont(), Grid3(). See section Cont3 sample, for sample code and picture.
void
mgl_cont3_val (HMGL
gr, const HMDT
v, const HMDT
a, char
dir, int
sVal, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_cont3_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, char
dir, int
sVal, const char *
stl, int
num)The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
mgl_cont3 (HMGL
gr, const HMDT
a, char
dir, int
sVal, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_cont3_all_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl, int
num)Draws contour plots at all central slices of the 3d data specified parametrically.
void
mgl_cont3_all (HMGL
gr, const HMDT
a, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_contf3_xyz_val (HMGL
gr, const HMDT
v, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, char
dir, int
sVal, const char *
stl)The function draws solid (or filled) contour plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Contours are plotted for values specified in array v at slice sVal in dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Dens3(), Cont3(), ContF(), Grid3(). See section Cont3 sample, for sample code and picture.
void
mgl_contf3_val (HMGL
gr, const HMDT
v, const HMDT
a, char
dir, int
sVal, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_contf3_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, char
dir, int
sVal, const char *
stl, int
num)The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
mgl_contf3 (HMGL
gr, const HMDT
a, char
dir, int
sVal, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_contf3_all_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl, int
num)Draws contour plots at all central slices of the 3d data specified parametrically.
void
mgl_contf3_all (HMGL
gr, const HMDT
a, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_grid3_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, char
dir, int
sVal, const char *
stl)The function draws grid for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). Density is plotted at slice sVal in dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Cont3(), ContF3(), Dens3(), Grid().
void
mgl_grid3 (HMGL
gr, const HMDT
a, char
dir, int
sVal, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_grid3_all_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl)Draws grids at all central slices of the 3d data specified parametrically.
void
mgl_grid3_all (HMGL
gr, const HMDT
a, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_cloudq_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl, float
alpha=1
)The function draws cloud plot for 3d data specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]). This plot is a set of cubes with color and transparency proportional to value of a. The resulting plot is like cloud – low value is transparent but higher ones are not. The number of plotting cells depend on MeshNum (see section Other settings). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. Parameter alpha changes the overall transparency of plot. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Surf3. See section CloudQ sample, for sample code and picture.
void
mgl_cloudq (HMGL
gr, const HMDT
a, const char *
stl, float
alpha=1
)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_cloudp_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
stl, float
alpha=1
)The same as first one but the semi-transparent points are used instead of cubes. See section CloudP sample, for sample code and picture.
void
mgl_cloudp (HMGL
gr, const HMDT
a, const char *
stl, float
alpha=1
)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_beam_val (HMGL
gr, float
val, const HMDT
tr, const HMDT
g1, const HMDT
g2, const HMDT
a, float
r, const char *
stl, int
flag)Draws the isosurface for 3d array a at constant values of a=val. This is special kind of plot for a specified in accompanied coordinates along curve tr with orts g1, g2 and with transverse scale r. Variable flag is bitwise: ‘0x1’ - draw in accompanied (not laboratory) coordinates; ‘0x2’ - draw projection to \rho-z plane; ‘0x4’ - draw normalized in each slice field. The x-size of data arrays tr, g1, g2 must be nx>2. The y-size of data arrays tr, g1, g2 and z-size of the data array a must be equal. See section Surf3.
void
mgl_beam (HMGL
gr, const HMDT
tr, const HMDT
g1, const HMDT
g2, const HMDT
a, float
r, const char *
stl, int
flag=0
, int
num=3
)Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These plotting functions draw two matrix simultaneously. There are 5 generally different types of data representations: surface or isosurface colored by other data (SurfC, Surf3C), surface or isosurface transpared by other data (SurfA, Surf3A), tiles with variable size (TileS), mapping diagram (Map), STFA diagram (STFA). Surf3A and Surf3C have variants for automatic and manual selection of level values for isosurfaces. Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See section Color scheme.
8.14.1 SurfC (Pure C) | ||
8.14.2 Surf3C (Pure C) | ||
8.14.3 SurfA (Pure C) | ||
8.14.4 Surf3A (Pure C) | ||
8.14.5 TileS (Pure C) | ||
8.14.6 Map (Pure C) | ||
8.14.7 STFA (Pure C) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_surfc_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
c, const char *
sch)The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. All dimensions of arrays z and c must be equal. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Surf(), SurfA(), Surf3C(). See section SurfC sample, for sample code and picture.
void
mgl_surfc (HMGL
gr, const HMDT
z, const HMDT
c, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_surf3c_xyz_val (HMGL
gr, float
val, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const HMDT
c, const char *
stl)The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as Surf3() function but the color of isosurface depends on values of array c. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. All dimensions of arrays z and c must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). Note, that there is possibility of incorrect plotting due to uncertainty of cross-section defining if there are two or more isosurface intersections inside one cell. See also Surf3(), SurfC(), Surf3A(). See section Surf3C sample, for sample code and picture.
void
mgl_surf3c_val (HMGL
gr, float
val, const HMDT
a, const HMDT
c, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_surf3c_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const HMDT
c, const char *
stl, int
num)Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
void
mgl_surf3c (HMGL
gr, const HMDT
a, const HMDT
c, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_surfa_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
c, const char *
sch)The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and transparent it by matrix c[i,j]. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. All dimensions of arrays z and c must be equal. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also Surf(), SurfC(), Surf3A(), TileS(). See section SurfA sample, for sample code and picture.
void
mgl_surfa (HMGL
gr, const HMDT
z, const HMDT
c, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_surf3a_xyz_val (HMGL
gr, float
val, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const HMDT
c, const char *
stl)The function draws isosurface plot for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) at a(x,y,z)=val. It is mostly the same as Surf3() function but the transparency of isosurface depends on values of b array. This allows one to remove the part of isosurface where b is negligibly small (useful for phase plotting of a beam or a pulse). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. All dimensions of arrays z and c must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). Note, that there is possibility of incorrect plotting due to uncertainty of cross-section defining if there are two or more isosurface intersections inside one cell. See also Surf3, SurfA, Surf3C. See section Surf3A sample, for sample code and picture.
void
mgl_surf3a_val (HMGL
gr, float
val, const HMDT
a, const HMDT
c, const char *
sch)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_surf3a_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const HMDT
c, const char *
stl, int
num)Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
void
mgl_surf3a (HMGL
gr, const HMDT
a, const HMDT
c, const char *
sch, int
num)The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_tiles_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
r, const char *
sch)The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. It is mostly the same as Tile() but the size of tiles is determined by r array. This is some kind of “transparency” useful for exporting to EPS files. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The minor dimensions of arrays x, y, z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays x and y can be vectors (not matrices as z). Surface is plotted for each z slice of the data. See also SurfA, Tile. See section Tiles sample, for sample code and picture.
void
mgl_tiles (HMGL
gr, const HMDT
z, const HMDT
c, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_map_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch, int
ks, int
pnts)The function draws mapping plot for matrices {ax, ay } which parametrically depend on coordinates x, y. The previous position of the cell (point) is marked by color. Height is proportional to Jacobian(ax,ay). This plot is like Arnold diagram ???. If pnts=false
then face is drawn otherwise the color ball at matrix knots are drawn. Parameter ks specifies the slice of matrices which will be used. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The size of ax and ay must be the same. The minor dimensions of arrays x, y, ax should be equal. Arrays x, y can be vectors (not matrix as ax). See section Map sample, for sample code and picture.
void
mgl_map (HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, int
ks, int
pnts)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_stfa_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
re, const HMDT
im, int
dn, const char *
sch, float
zVal)Draws spectrogram of complex array re+i*im
for Fourier size of dn points at plane z=zVal. Parameter dn is arbitrary even integer. For example in 1D case, result is density plot of data res[i,j]=|\sum_d^dn exp(I*j*d)*(re[i*dn+d]+I*im[i*dn+d])|/dn with size {int(nx/dn), dn, ny}. At this array re, im parametrically depend on coordinates x, y. String sch sets the color scheme. Previous color scheme is used by default. The size of re and im must be the same. The minor dimensions of arrays x, y, re should be equal. Arrays x, y can be vectors (not matrix as re). See section Color scheme.
void
mgl_stfa (HMGL
gr, const HMDT
re, const HMDT
im, int
dn, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 2D and 3D vector fields. There are 5 generally different types of vector fields representations: simple vector field (Vect), vector field with coloring (VectC), vector field by dew-drops (Dew), flow threads (Flow), flow pipes (Pipe). Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See section Color scheme.
8.15.1 Traj (Pure C) | ||
8.15.2 Vect (Pure C) | ||
8.15.3 VectC (Pure C) | ||
8.15.4 Dew (Pure C) | ||
8.15.5 Flow (Pure C) | ||
8.15.6 Pipe (Pure C) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_traj_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch=NULL
, float
len=0
)void
mgl_traj_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch=NULL
, float
zVal=NAN
, float
len=0
)The function draws vectors {ax, ay, az} along a curve {x, y, z}. The length and color of arrows are proportional to \sqrtax^2+ay^2+az^2. The color is specified by the string argument sch. Previous color scheme is used by default. Parameter len set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if len=0). The minor sizea of all arrays must be equal and large 2. Vectors are plotted for each column of the arrays. See also Vect. See section Traj sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_vect_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch, float
zVal, int
flag)The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z=zVal. The length of hachures is proportional to \sqrtax^2+ay^2. The number of hachures depend on MeshNum (see section Other settings). The color is specified by the string argument sch. Previous color scheme is used by default. Parameter flag setup the hachures (arrows). It is compination of vlaues: MGL_VEC_COL
for drawing bi-color arrow, MGL_VEC_LEN
for drawing fixed length arrows, MGL_VEC_DOT
for drawing hachures with dots instead of arrows, MGL_VEC_END
for drawing arrows to the cell point, MGL_VEC_MID
for drawing arrows with center at cell point. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also VectC(), Flow(), Dew(). See section Vect sample, for sample code and picture.
void
mgl_vect_2d (HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, float
zVal, int
flag)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_vect_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, int
flag)This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the length of hachures is proportional to \sqrtax^2+ay^2+az^2. See section Vect 3D sample, for sample code and picture.
void
mgl_vect_3d (HMGL
gr, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, int
flag)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are obsolete – use mgl_vect_*() functions instead.
void
mgl_vectc_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch, float
zVal)The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z=zVal. The color of hachures is proportional to \sqrtax^2+ay^2. The number of hachures depend on MeshNum (see section Other settings). The color is specified by the string argument sch. Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Vect(), Flow(), Dew(). See section VectC sample, for sample code and picture.
void
mgl_vectc_2d (HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_vectc_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch)This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of hachures is proportional to \sqrtax^2+ay^2+az^2. See section VectC 3D sample, for sample code and picture.
void
mgl_vectc_3d (HMGL
gr, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_dew_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch, float
zVal)The function draws dew-drops for plane vector field {ax, ay} depending parametrically on coordinates x, y at level z=zVal. Note that this is very expensive plot in memory usage and creation time! The color of drops is proportional to \sqrtax^2+ay^2. The number of drops depend on MeshNum (see section Other settings). The color is specified by the string argument sch. Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Vect(), VectC(). See section Dew sample, for sample code and picture.
void
mgl_dew (HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_flow_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch, int
num, int
central, float
zVal)The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z = zVal. Number of threads is proportional to num. Parameter central sets the thread start from center (if true) or only from edges (if false). The color of lines is proportional to \sqrtax^2+ay^2. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Pipe(), VectC(), Vect(). See section Flow sample, for sample code and picture.
void
mgl_flow_2d (HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, int
num, int
central, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_flow_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, int
num, int
central)This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrtax^2+ay^2+az^2. See section Flow 3D sample, for sample code and picture.
void
mgl_flow_3d (HMGL
gr, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, int
num, int
central)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_flowp_xy (float
x0, float
y0, float
z0, HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch)The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y from point {x0, y0} at level z = z0. The color of lines is proportional to \sqrtax^2+ay^2. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Pipe(), VectC(), Vect(). See section Flow sample, for sample code and picture.
void
mgl_flowp_2d (float
x0, float
y0, float
z0, HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, int
num, int
central, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_flowp_xyz (float
x0, float
y0, float
z0, HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, int
num, int
central)This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrtax^2+ay^2+az^2. See section Flow 3D sample, for sample code and picture.
void
mgl_flowp_3d (float
x0, float
y0, float
z0, HMGL
gr, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, int
num, int
central)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_pipe_xy (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
ax, const HMDT
ay, const char *
sch, float
r0, int
num, int
central, float
zVal)The function draws flow pipes for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z = zVal. Number of pipes is proportional to num. Parameter central sets the pipe start from center (if true) or only from edges (if false). The color of lines is proportional to \sqrtax^2+ay^2. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. Parameter r0 set the base pipe radius. If r0<0 then pipe radius is inverse proportional to amplitude. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Pipe(), VectC(), Vect(). See section Pipe sample, for sample code and picture.
void
mgl_pipe_2d (HMGL
gr, const HMDT
ax, const HMDT
ay, const char *
sch, float
r0, int
num, int
central, float
zVal)The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
mgl_pipe_xyz (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, float
r0, int
num, int
central)This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrtax^2+ay^2+az^2. See section Pipe 3D sample, for sample code and picture.
void
mgl_pipe_3d (HMGL
gr, const HMDT
ax, const HMDT
ay, const HMDT
az, const char *
sch, float
r0, int
num, int
central)The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform miscelaneous plotting. There is unstructured data points plots (Dots), surface reconstruction (Crust), surfaces on the triangular mesh (TriPlot), textual formula plotting (Plots by formula), data plots at edges (Dens[XYZ], Cont[XYZ], ContF[XYZ]), simple plot (SimplePlot). Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See section Color scheme.
8.16.1 DensXYZ (Pure C) | ||
8.16.2 ContXYZ (Pure C) | ||
8.16.3 ContFXYZ (Pure C) | ||
8.16.4 Dots (Pure C) | ||
8.16.5 Crust (Pure C) | ||
8.16.6 TriPlot (Pure C) | ||
8.16.7 Plots by formula (Pure C) | ||
8.16.8 SimplePlot (Pure C) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These plotting functions draw density plot in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. For example, code like
mgl_dens_x(gr, mgl_data_sum(c,"x"),"BbcyrR",-1); mgl_dens_y(gr, mgl_data_sum(c.Sum("y"),0,1); mgl_dens_z(gr, mgl_data_sum(c.Sum("z"),0,-1); |
will produce the following picture. See also Cont[XYZ](), ContF[XYZ](), Dens(). See section Dens projection sample, for sample code and picture.
void
mgl_dens_x (HMGL
gr, const HMDT
a, const char *
stl, float
sVal)Draws density plot for data a at x = sVal.
void
mgl_dens_y (HMGL
gr, const HMDT
a, const char *
stl, float
sVal)Draws density plot for data a at y = sVal.
void
mgl_dens_z (HMGL
gr, const HMDT
a, const char *
stl, float
sVal)Draws density plot for data a at z = sVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These plotting functions draw density plot in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. For example, code like
mgl_cont_x(gr, mgl_data_sum(c,"x"),"BbcyrR",-1,7); mgl_cont_y(gr, mgl_data_sum(c.Sum("y"),0,1,7); mgl_cont_z(gr, mgl_data_sum(c.Sum("z"),0,-1,7); |
will produce the following picture. See also ContF[XYZ](), Dens[XYZ](), Cont(). See section Cont projection sample, for sample code and picture.
void
mgl_cont_x (HMGL
gr, const HMDT
a, const char *
stl, float
sVal, int
num)Draws num-th contour lines for data a at x = sVal.
void
mgl_cont_y (HMGL
gr, const HMDT
a, const char *
stl, float
sVal, int
num)Draws num-th contour lines for data a at y = sVal.
void
mgl_cont_z (HMGL
gr, const HMDT
a, const char *
stl, float
sVal, int
num)Draws num-th contour lines for data a at z = sVal.
void
mgl_cont_x_val (HMGL
gr, const HMDT
v, const HMDT
a, const char *
stl, float
sVal)Draws contour lines for data a=v[i] at x = sVal.
void
mgl_cont_y_val (HMGL
gr, const HMDT
v, const HMDT
a, const char *
stl, float
sVal)Draws contour lines for data a=v[i] at y = sVal.
void
mgl_cont_z_val (HMGL
gr, const HMDT
v, const HMDT
a, const char *
stl, float
sVal)Draws contour lines for data a=v[i] at z = sVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These plotting functions draw density plot in x, y, or z plain. If a is a tensor (3-dimensional data) then interpolation to a given sVal is performed. These functions are useful for creating projections of the 3D data array to the bounding box. See also Cont[XYZ](), Dens[XYZ](), ContF().
void
mgl_contf_x (HMGL
gr, const HMDT
a, const char *
stl, float
sVal, int
num=7
)Draws num-th solid contours for data a at x = sVal.
void
mgl_contf_y (HMGL
gr, const HMDT
a, const char *
stl, float
sVal, int
num=7
)Draws num-th solid contours for data a at y = sVal.
void
mgl_contf_z (HMGL
gr, const HMDT
a, const char *
stl, float
sVal, int
num=7
)Draws num-th solid contours for data a at z = sVal.
void
mgl_contf_x_val (HMGL
gr, const HMDT
v, const HMDT
a, const char *
stl, float
sVal)Draws solid contours for data a=v[i] at x = sVal.
void
mgl_contf_y_val (HMGL
gr, const HMDT
v, const HMDT
a, const char *
stl, float
sVal)Draws solid contours for data a=v[i] at y = sVal.
void
mgl_contf_z_val (HMGL
gr, const HMDT
v, const HMDT
a, const char *
stl, float
sVal)Draws solid contours for data a=v[i] at z = sVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_dots (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)void
mgl_dots_a (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
sch)The function draws the arbitrary placed points {x[i], y[i], z[i]}. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If array a is specified then it define the transparency of dots. Arrays x, y, z, a must have equal sizes. See also Crust(), Mark(), Plot(). See section Dots sample, for sample code and picture.
void
mgl_dots_tr (HMGL
gr, const HMDT
tr, const char *
sch)The same as previous with x=tr(0,:), y=tr(1,:), z=tr(2,:) and if tr.nx>3 then a=tr(3,:).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_crust (HMGL
gr, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch, float
er)The function reconstruct and draws the surface for arbitrary placed points {x[i], y[i], z[i]}. Parameter er set relative radius for (increase it for removing holes). String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. Arrays x, y, z must have equal sizes. See also Dots(), TriPlot(). See section Crust sample, for sample code and picture.
void
mgl_crust_tr (HMGL
gr, const HMDT
tr, const char *
sch, float
er)The same as previous with x=tr(0,:), y=tr(1,:), z=tr(2,:).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_triplot_xyz (HMGL
gr, const HMDT
id, const HMDT
x, const HMDT
y, const HMDT
z, const char *
sch)void
mgl_triplot_xyzc (HMGL
gr, const HMDT
id, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
c, const char *
sch)The function draws the surface of triangles. Triangle vertexes are set by indexes id of data points {x[i], y[i], z[i]}. String sch sets the color scheme (see section Color scheme). Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. First dimensions of id must be 3 or greater. Arrays x, y, z must have equal sizes. Parameter c set the colors of triangles (if id.ny=c.nx) or colors of vertexes (if x.nx=c.nx). See also Dots(), Crust().
void
mgl_triplot_xy (HMGL
gr, const HMDT
id, const HMDT
x, const HMDT
y, const char *
sch, float
zVal)The same as previous with z[i]=zVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 1D or 2D functions specified by textual formula. You do not need to create the data arrays to plot it. The parameter stl set the line style (see section Line styles) for Plot()
or color scheme (see section Color scheme) for Surf()
. The parameter n set the minimal number of points along coordinate(s) for plots. At this time (v. 1.8) there is no adaptive increase of data points numbers but in future it will appear.
void
mgl_fplot (HMGL
gr, const char *
eqY, const char *
stl, float
zVal, int
n)The function draws function ‘eqY(x)’ at plane z=zVal where ‘x’ variable is changed in range [Min.x, Max.x]. See also Plot.
void
mgl_fplot_xyz (HMGL
gr, const char *
eqX, const char *
eqY, const char *
eqZ, const char *
stl, float
zVal, int
n)The function draws parametrical curve {‘eqX(t)’, ‘eqY(t)’, ‘eqZ(t)’} where ‘t’ variable is changed in range [0, 1]. See also Plot.
void
mgl_fsurf (HMGL
gr, const char *
eqZ, const char *
stl, int
n);The function draws surface for function ‘eqY(x,y)’ where ‘x’, ‘y’ variables are changed in range [Min, Max]. See also Surf.
void
mgl_fsurf_xyz (HMGL
gr, const char *
eqX, const char *
eqY, const char *
eqZ, const char *
stl, int
n)The function draws parametrical surface {‘eqX(u,v)’, ‘eqY(u,v)’, ‘eqZ(u,v)’} where ‘u’, ‘v’ variables are changed in range [0, 1]. See also Surf.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_simple_plot (HMGL
gr, const HMDT
a, int
type, const char *
stl)Plots the array a depending on it’s dimensions and type parameter. String stl specifies the style of plotting. For 1d data: type=0
– Plot, type=1
– Area, type=2
– Step, type=3
– Stem, type=4
– Bars. For 2d data: type=0
– Surf, type=1
– Dens, type=2
– Mesh, type=3
– Cont. For 3d data: type=0
– Surf3, type=1
– Dens3, type=2
– Cont3, type=2
– Cloud.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions fit data to formula. Fitting goal is to find formula parameters for the best fit the data points, i.e. to minimize the sum \sum_i (f(x_i, y_i, z_i) - a_i)^2/s_i^2. At this, approximation function ‘f’ can depend only on one argument ‘x’ (1D case), on two arguments ‘x,y’ (2D case) and on three arguments ‘x,y,z’ (3D case). The function ‘f’ also may depend on parameters. Normally the list of fitted parameters is specified by var string (like, ‘abcd’). Usually user should supply initial values for fitted parameters by ini variable. But if he/she don’t supply it then the zeros are used.
Functions Fit() and FitS() do not draw the obtained data themselves. They fill the data fit by formula ‘f’ with found coefficients and return the \chi^2 error of approximation. At this, the ‘x,y,z’ coordinates are equidistantly distributed in the interval Min–Max. Number of points in fit is selected as maximal value of fit size and the value of FitPnts. Note, that this functions use GSL library and do something only if MathGL was compiled with GSL support. See section Fitting sample, for sample code and picture.
float
mgl_fit_xyzas (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const HMDT
s, const char *
func, const char *
var, float *
ini)float
mgl_fit_xyzas_d (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const HMDT
s, const char *
func, const char *
var, HMDT
ini)Fit data along x-, y- and z-directions for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]).
float
mgl_fit_xyzs (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
a, const HMDT
s, const char *
func, const char *
var, float *
ini)float
mgl_fit_xyzs_d (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
a, const HMDT
s, const char *
func, const char *
var, HMDT
ini)Fit data along x-, and y-directions for 2d array specified parametrically a[i,j](x[i,j], y[i,j]) for each data slice.
float
mgl_fit_xys (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
a, const HMDT
s, const char *
func, const char *
var, float *
ini)float
mgl_fit_xys_d (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
a, const HMDT
s, const char *
func, const char *
var, HMDT
ini)Fit data along x-direction for 1d array specified parametrically a[i](x[i]) for each data slice.
float
mgl_fit_ys (HMGL
gr, HMDT
fit, const HMDT
a, const HMDT
s, const char *
func, const char *
var, float *
ini)float
mgl_fit_ys_d (HMGL
gr, HMDT
fit, const HMDT
a, const HMDT
s, const char *
func, const char *
var, HMDT
ini)Fit data along x-direction for 1d array with x equidistantly distributed in interval [Min.x, Max.x].
float
mgl_fit_xyza (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
func, const char *
var, float *
ini)float
mgl_fit_xyza_d (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
z, const HMDT
a, const char *
func, const char *
var, HMDT
ini)Fit data along x-, y- and z-directions for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) with s[i,j,k]=1.
float
mgl_fit_xyz (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
a, const char *
func, const char *
var, float *
ini)float
mgl_fit_xyz_d (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
y, const HMDT
a, const char *
func, const char *
var, HMDT
ini)Fit data along x-, and y-directions for 2d array specified parametrically a[i,j](x[i,j], y[i,j]) with s[i,j]=1 for each data slice.
float
mgl_fit_xy (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
a, const char *
func, const char *
var, float *
ini)float
mgl_fit_xy_d (HMGL
gr, HMDT
fit, const HMDT
x, const HMDT
a, const char *
func, const char *
var, HMDT
ini)Fit data along x-direction for 1d array specified parametrically a[i](x[i]) with s[i]=1 for each data slice.
float
mgl_fit_1 (HMGL
gr, HMDT
fit, const HMDT
a, const char *
func, const char *
var, float *
ini)float
mgl_fit_1_d (HMGL
gr, HMDT
fit, const HMDT
a, const char *
func, const char *
var, HMDT
ini)Fit data along x-direction for 1d array a with s=1 and x equidistantly distributed in interval [Min.x, Max.x].
float
mgl_fit_2 (HMGL
gr, HMDT
fit, const HMDT
a, const char *
func, const char *
var, float *
ini)float
mgl_fit_2_d (HMGL
gr, HMDT
fit, const HMDT
a, const char *
func, const char *
var, HMDT
ini)Fit data along x-, and y-directions for 2d array a with s=1 and x, y equidistantly distributed in interval [Min, Max].
float
mgl_fit_3 (HMGL
gr, HMDT
fit, const HMDT
a, const char *
func, const char *
var, float *
ini)float
mgl_fit_3_d (HMGL
gr, HMDT
fit, const HMDT
a, const char *
func, const char *
var, HMDT
ini)Fit data along x-, y- and z-directions for 3d array a with s=1 and x, y, z equidistantly distributed in interval [Min, Max].
void
mgl_puts_fit (HMGL
gr, float
x, float
y, float
z, const char *
prefix, const char *
font, float
size=-1
)Print last fitted formula with found coefficients (as numbers) at position {x, y, z}. The string prefix will be printed before formula. All other parameters are the same as in Text printing (Pure C).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions provide ability to create several pictures simultaneously. For most of cases it is useless but for widget classes (see section Widget classes) they can provide a way to show animation. Also you can write several frames into animated GIF file.
int
mgl_new_frame (HMGL
gr)Creates new frame. Function returns current frame id. Zero or negative parameter id leads to automatic numbering frames. Positive one sets the new frame id directly. This is not thread safe function! Use direct list creation in multithreading drawing. The function mgl_end_frame()
must be call after the finishing of the frame drawing for each call of this function.
void
mgl_end_frame (HMGL
gr)Finishes the frame drawing.
int
mgl_get_num_frame (HMGL
gr)Gets the number of created frames.
int
mgl_resel_frames (HMGL
gr)Reset frames counter (start it from zero).
void
mgl_start_gif (HMGL
gr, const char *
fname, int
ms)Start writing frames into animated GIF file fname. Parameter ms set the delay between frames in milliseconds. You should not change the picture size during writing the cinema. Use mgl_close_gif() to finalize writing. Note, that this function is disabled in OpenGL mode.
void
mgl_close_gif (HMGL
gr)Finish writing animated GIF and close connected pointers.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_data_create (HMDT
dat, int
mx, int
my, int
mz)Creates or recreates the array with specified size and fills it by zero. This function does nothing if one of parameters mx, my, mz is zero or negative.
void
mgl_data_set_float (HMDT
dat, const float *
A, int
NX, int
NY, int
NZ)void
mgl_data_set_double (HMDT
dat, const double *
A, int
NX, int
NY, int
NZ)Allocates memory and copies the data from the flat array.
void
mgl_data_set_float2 (HMDT
dat, const float **
A, int
N1, int
N2)void
mgl_data_set_double2 (HMDT
dat, const double **
A, int
N1, int
N2)Allocates memory and copies the data from the float**
array with dimensions N1, N2, i.e. from array defined like as float a[N1][N2];
.
void
mgl_data_set_float3 (HMDT
dat, const float ***
A, int
N1, int
N2)void
mgl_data_set_double3 (HMDT
dat, const double ***
A, int
N1, int
N2)Allocates memory and copies the data from the double***
array with dimensions N1, N2, N3, i.e. from array defined like as float a[N1][N2][N3];
.
void
mgl_data_set_vector (HMDT
dat, gsl_vector *
v)Allocates memory and copies the data from the gsl_vector *
structure.
void
mgl_data_set_matrix (HMDT
dat, gsl_matrix *
m)Allocates memory and copies the data from the gsl_matrix *
structure.
void
mgl_data_set (HMDT
dat, const HMDT
d)Copies the data from HMDT instance d.
void
mgl_data_set_values (const char *
str, int
NX, int
NY, int
NZ)Allocates memory and scanf the data from the string.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_data_fill (HMDT
dat, float
x1, float
x2, char
dir)Equidistantly fills the data values to range [x1, x2] in direction dir={‘x’,‘y’,‘z’}.
void
mgl_data_fill (HMGL
gr, HMDT
dat, const char *
eq, const HMDT *
vdat, const HMDT *
wdat)Fills the value of array according to the formula in string eq. Formula is an arbitrary expression depending on variables ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Coordinates ‘x’, ‘y’, ‘z’ are supposed to be normalized in bounding box of gr (in difference from Modify
functions). Variable ‘u’ is the original value of the array. Variables ‘v’ and ‘w’ are values of vdat, wdat which can be NULL
(i.e. can be omitted).
void
mgl_data_modify (HMDT
dat, const char *
eq, int
dim)Function fills the value of array according to the formula in string eq. Formula is an arbitrary expression depending on variables ‘x’, ‘y’, ‘z’, ‘u’. Coordinates ‘x’, ‘y’, ‘z’ are data indexes normalized in interval [0,1]. Variable ‘u’ is the original value of the array. Modification will be fulfilled only for slices >=dim.
void
mgl_data_modify_vw (HMDT
dat, const char *
eq, const HMDT
v, const HMDT
w)Function fills the value of array according to the formula in string eq. Formula is an arbitrary expression depending on variables ‘x’, ‘y’, ‘z’, ‘u’, ‘v’, ‘w’. Coordinates ‘x’, ‘y’, ‘z’ are data indexes normalized in interval [0,1]. Variable ‘u’ is the original value of the array. Variables ‘v’ and ‘w’ are values of vdat, wdat which can be NULL
(i.e. can be ommited).
void
mgl_data_put_val (HMDT
a, float
val, int
i, int
j, int
k)Function sets value(s) of array a[i, j, k] = val. Negative indexes i, j, k=-1 set the value val to whole range in corresponding direction(s). For example, mgl_data_put_val(a,val,-1,0,-1);
sets a[i,0,j]=val for i=0...(a.nx-1), j=0...(a.nz-1).
void
mgl_data_put_dat (HMDT
a, const HMDT
v, int
i, int
j, int
k)Function copies value(s) from array v to the range of array a. Negative indexes i, j, k=-1 set the range in corresponding direction(s). At this minor dimensions of array v should be large than corresponding dimensions of array a. For example, mgl_data_put_dat(a,v,-1,0,-1);
sets a[i,0,j]=v.ny>nz ? v[i,j] : v[i], where i=0...(a.nx-1), j=0...(a.nz-1) and condition v.nx>=a.nx is true.
void
mgl_data_set_value (HMDT
dat, float
v, int
i, int
j, int
k)Sets the value in specified cell of the data with border checking.
float
mgl_data_get_value (HMDT
dat, int
i, int
j, int
k)Gets the value in specified cell of the data with border checking.
float
mgl_data_get_nx (HMDT
dat)Gets the x-size of the data.
float
mgl_data_get_ny (HMDT
dat)Gets the y-size of the data.
float
mgl_data_get_nz (HMDT
dat)Gets the z-size of the data.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_data_rearrange (HMDT
dat, int
mx, int
my, int
mz)Rearrange dimensions without changing data array so that resulting sizes should be mx*my*mz < nx*ny*nz. If some of parameter my or mz are zero then it will be selected to optimal fill of data array. For example, if my=0 then it will be change to my=nx*ny*nz/mx and mz will be 1.
void
mgl_data_extend (HMDT
dat, int
n1, int
n2)Increase the dimensions of the data by inserting new (|n1|+1)-th slices after (for n1>0) or before (for n1<0) of existed one. It is possible to insert 2 dimensions simultaneously for 1d data by using parameter n2. Data to new slices is copy from existed one. For example, for n1>0 new array will be a_ij^new = a_i^old where j=0...n1. Correspondingly, for n1<0 new array will be a_ij^new = a_j^old where i=0...|n1|.
void
mgl_data_transpose (const char *
dim)Transposes (shift order of) dimensions of the data. New order of dimensions is specified int string dim. This function may be useful also for the reading of one-dimensional data.
void
mgl_data_squeeze (HMDT
dat, int
rx, int
ry, int
rz, int
smooth)Reduces the data size by excluding data elements which indexes are not divisible by rx, ry, rz correspondingly.
void
mgl_data_crop (HMDT
dat, int
n1, int
n2, char
dir)Cuts off edges of the data i<n1 and i>n2 if n2>0 or i>n[xyz]
-n2 if n2<=0 along direction dir.
void
mgl_data_insert (HMDT
dat, char
dir, int
pos, char
num)Insert num slices along dir-direction at position pos and fill it by zeros.
void
mgl_data_delete (HMDT
dat, char
dir, int
pos, char
num)Delete num slices along dir-direction at position pos.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_data_read (HMDT
dat, const char *
fname)Reads data from tab-separated text file with auto determining sizes of the data.
void
mgl_data_read_dim (HMDT
dat, const char *
fname, int
mx, int
my, int
mz)Reads data from text file with specified data sizes. This function does nothing if one of parameters mx, my or mz is zero or negative.
void
mgl_data_read_mat (HMDT
dat, const char *
fname, int
dim)Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions.
void
mgl_data_save (const HMDT
dat, const char *
fname, int
ns)Saves the whole data array (for ns=-1
) or only ns-th slice to text file. If ns>0 then only ns-th slice (or column for 2D array) will be saved.
void
mgl_data_import (HMDT
dat, const char *
fname, const char *
scheme, float
v1, float v2)Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to float values in range [v1, v2] using color scheme scheme (see section Color scheme).
void
mgl_data_export (HMDT
dat, const char *
fname, const char *
scheme, float
v1, float v2, int
ns) constSaves data matrix (or ns
-th slice for 3d data) to bitmap file (now support only PNG format). The data values are transformed from range [v1, v2] to RGB pixels of bitmap using color scheme scheme (see section Color scheme). If v1>=v2 then the values of v1, v2 are automatically determined as minimal and maximal value of the data array.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
HMDT
mgl_data_subdata (const HMDT
dat, int
xx, int
yy, int
zz)Extracts sub-array data from the original data array keeping fixed positive index. For example SubData(-1,2)
extracts 3d row (indexes are zero based), SubData(4,-1)
extracts 5th column, SubData(-1,-1,3)
extracts 4th slice and so on.
HMDT
mgl_data_subdata_ext (const HMDT
dat, const HMDT
xx, const HMDT
yy, const HMDT
zz)Extracts sub-array data from the original data array for indexes specified by arrays xx, yy, zz (indirect access). The resulting array have the same dimensions as input arrays for 2D and 3D arguments. This function work like previous one for 1D arguments (or numbers). The dimensions of all argument must be the same if they are 2D or 3D arrays.
HMDT
mgl_data_column (const HMDT
dat, const char *
eq)Get column (or slice) of the data filled by formula eq of other named columns. For example, Column("n*w^2/exp(t)");
. The column ids must be defined first by SetColumnId()
function.
void
mgl_data_set_id (HMDT
dat, const char *
ids)Sets the symbol id for data columns. The string must contain one symbol ’a’...’z’ per column (without spaces).
HMDT
mgl_data_hist (const HMDT
dat, int
n, float
v1, float
v2, int
nsub)Creates n-th points distribution of the data values in range [v1, v2]. Parameter nsub define the number of additional interpolated points (for smoothness of histogram).
HMDT
mgl_data_hist_w (const HMDT
dat, const HMDT
w, int
n, float
v1, float
v2, int
nsub)Creates n-th points distribution of the data values in range [v1, v2]. Array w specifies weights of the data elements. Parameter nsub define the number of additional interpolated points (for smoothness of histogram).
HMDT
mgl_data_momentum (const HMDT
dat, char
dir, const char *
how)Get momentum (1D-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij if var=‘z’ and so on. Coordinates ‘x’, ‘y’, ‘z’ are data indexes normalized in range [0,1].
HMDT
mgl_data_sum (const HMDT
dat, const char *
dir)Gets array which is the result of summation in given direction or direction(s).
HMDT
mgl_data_max_dir (const HMDT
dat, const char *
dir)Gets array which is the maximal data values in given direction or direction(s).
HMDT
mgl_data_min_dir (const HMDT
dat, const char *
dir)Gets array which is the minimal data values in given direction or direction(s).
HMDT
mgl_data_combine (const HMDT
dat, const HMDT
a)Returns direct multiplication of arrays (like, res[i,j] = this[i]*a[j] and so on).
HMDT
mgl_data_evaluate_i (const HMDT
dat, const HMDT
idat, int
norm)HMDT
mgl_data_evaluate_ij (const HMDT
dat, const HMDT
idat, const HMDT
jdat, int
norm)HMDT
mgl_data_evaluate_ijk (const HMDT
dat, const HMDT
idat, const HMDT
jdat, const HMDT
kdat, int
norm)Get array which values is result of interpolation of original array for coordinates from other arrays. All dimensions must be the same for data idat, jdat, kdat. Coordinates from idat, jdat, kdat are supposed to be normalized in range [0,1] (if norm=true
) or in range [0,nx], [0,ny], [0,nz] correspondingly.
HMDT
mgl_data_resize (const HMDT
dat, int
mx, int
my, int
mz)HMDT
mgl_data_resize_box (const HMDT
dat, int
mx, int
my, int
mz, float
x1, float
x2, float
y1, float
y2, float
z1, float
z2)Resizes the data to new size mx, my, mz from box (part) [x1,x2] x [y1,y2] x [z1,z2] of original array. Initially x,y,z coordinates are supposed to be in [0,1].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain ‘x’, ‘y’ or ‘z’ characters for 1-st, 2-nd and 3-d dimension correspondengly.
void
mgl_data_cumsum (HMDT
dat, const char *
dir)Cumulative summation of the data in given direction or directions.
void
mgl_data_integral (HMDT
dat, const char *
dir)Integrates (like cumulative summation) the data in given direction or directions.
void
mgl_data_diff (HMDT
dat, const char *
dir)Differentiates the data in given direction or directions.
void
mgl_data_diff_par (HMDT
dat, const HMDT
x, const HMDT
y, const HMDT
z)Differentiates the data specified parametrically in direction x with y, z=constant. Parameter z can be NULL
that correspond to 2D case. Parametrical differentiation uses the formula (for 2D case): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j) where a_i=da/di, a_j=da/dj denotes usual differentiation along 1st and 2nd dimensions. The similar formula is used for 3D case. Note, that you may change the order of arguments – for example, if you have 2D data a(i,j) which depend on coordinates {x(i,j), y(i,j)} then usual derivative along ‘x’ will be Diff(x,y);
and usual derivative along ‘y’ will be Diff(y,x);
.
void
mgl_data_diff2 (const char *
dir)Double-differentiates (like Laplace operator) the data in given direction.
void
mgl_data_swap (HMDT
dat, const char *
dir)Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
void
mgl_data_mirror (HMDT
dat, const char *
dir)Mirror the left-to-right part of the data in given direction. Looks like change the value index i->n-i.
void
mgl_data_sew (HMDT
dat, const char *
dir, float
da)Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.
void
mgl_data_smooth (HMDT
dat, int
Type, float
delt, const char *
dira)Smooths the data on specified direction or directions by method Type. Now 4 methods are supported: SMOOTH_NONE
does nothing for delta=0 or approaches data to zero with the step delta, SMOOTH_LINE_3
linear averaging by 3 points, SMOOTH_LINE_5
linear averaging by 5 points, SMOOTH_QUAD_5
quadratic averaging by 5 points. Parameter delta forbids to change values of array more than delta from the original ones. String dirs specifies the dimensions which will be smoothed. It may contain characters: ’x’ for 1st dimension, ’y’ for 2nd dimension, ’z’ for 3d dimension.
void
mgl_data_envelop (HMDT
dat, char
dir)Find envelop for data values along direction dir.
void
mgl_data_norm_slice (HMDT
dat, float
v1, float
v2, char
dir, int
keep_en, int
sym)Normalizes data slice-by-slice along direction dir the data in slices to range [v1,v2]. If flag sym=true
then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. If keep_en is set then maximal value of k-th slice will be limited by
\sqrt\sum a_ij(k)/\sum a_ij(0).
void
mgl_data_norm (HMDT
dat, float
v1=0
, float
v2=1
, int
sym=false
, int
dim=0
)Normalizes the data to range [v1,v2]. If flag sym=true
then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. Modification will be applied only for slices >=dim.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
float
mgl_data_spline (const HMDT
dat, float
x, float
y, float
z)Interpolates data by cubic spline to the given point x in [0...nx-1], y in [0...ny-1], z in [0...nz-1].
float
mgl_data_spline1 (const HMDT
dat, float
x, float
y, float
z)Interpolates data by cubic spline to the given point x, y, z which assumed to be normalized in range [0, 1].
float
mgl_data_linear (const HMDT
dat, float
x, float
y, float
z)Interpolates data by linear function to the given point x in [0...nx-1], y in [0...ny-1], z in [0...nz-1].
float
mgl_data_linear11 (const HMDT
dat, float
x, float
y, float
z)Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range [0, 1].
float
mgl_data_get_value (const HMDT
dat, int
i, int
j, int
k)Gets the value in specified cell of the data with border checking.
float *
mgl_data_value (HMDT
dat, int
i, int
j, int
k)Gets the pointer to data element.
const float *
mgl_data_data (const HMDT
dat)Gets the pointer to internal data array.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
float
mgl_data_max (const HMDT
dat)Gets maximal value of the data.
float
mgl_data_min (HMDT
dat) const
Gets minimal value of the data.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
mgl_data_mul_dat (HMDT
dat, const HMDT
d)Multiplies the data by the other one for each element.
void
mgl_data_div_dat (HMDT
dat, const HMDT
d)Divides the data by the other one for each element.
void
mgl_data_add_dat (HMDT
dat, const HMDT
d)Adds the other data.
void
mgl_data_sub_dat (HMDT
dat, const HMDT
d)Subtracts the other data.
void
mgl_data_mul_num (HMDT
dat, float
d)Multiplies each element by the number.
void
mgl_data_div_num (HMDT
dat, float
d)Divides each element by the number.
void
mgl_data_add_num (HMDT
dat, float
d)Adds the number to each element.
void
mgl_data_sub_num (HMDT
dat, float
d)Subtracts the number to each element.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are not so common. So I put it in this chapter.
HMDT
mgl_transform (const HMDT
real, const HMDT
imag, const char *
type)Do integral transformation of complex data real, imag on specified direction. Now only Fourier transformation is supported. The order of transformations is specified in string type: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: ‘f’ is forward Fourier transformation, ‘i’ is inverse Fourier transformation, ‘n’ or ‘ ’ is no transformation.
HMDT
mgl_transform_a const HMDT
ampl, const HMDT
phase, const char *
type)Do integral transformation of complex data ampl, phase on specified direction. Now only Fourier transformation is supported. The order of transformations is specified in string type: first character for x-dimension, second one for y-dimension, third one for z-dimension. The possible character are: ‘f’ is forward Fourier transformation, ‘i’ is inverse Fourier transformation, ‘n’ or ‘ ’ is no transformation.
HMDT
mgl_data_stfa (const HMDT
real, const HMDT
imag, int dn,
char
dir='x'
)Short time Fourier analysis for real and imaginary parts. Output is amplitude of partial Fourier of length dn. For example if dir=‘x’, result will have size {int(nx/dn), dn, ny} and it will contain res[i,j,k]=|\sum_d^dn exp(I*j*d)*(real[i*dn+d,k]+I*imag[i*dn+d,k])|/dn.
HMDT
mgl_pde_solve (const char *
ham, const HMDT
ini_re, const HMDT
ini_im, mglPoint
Min, mglPoint
Max, float
dz=0.1
, float
k0=100
)Solves equation du/dz = i*k0*ham(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters Min, Max set the bounding box for the solution. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter dz set the step along evolutionary coordinate z. At this moment, simplified form of function ham is supported – all “mixed” terms (like ‘x*p’->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like ‘x*q’->x*d/dy) are allowed. Here variable ‘u’ is used for field amplitude |u|. This allow one solve nonlinear problems – for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2"
. You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)"
, but only if dependence on variable ‘i’ is linear (i.e. ham = hre+i*him). See section PDE sample, for sample code and picture.
HMDT
mgl_ray_trace (const char *
ham, mglPoint
r0, mglPoint
p0, float
dt=0.1
, float
tmax=10
)Solves GO ray equation like dr/dt = d ham/dp, dp/dt = -d ham/dr. This is Hamiltonian equations for particle trajectory in 3D case. Here ham is Hamiltonian which may depend on coordinates ‘x’, ‘y’, ‘z’, momentums ‘p’=px, ‘q’=py, ‘v’=pz and time ‘t’: ham = H(x,y,z,p,q,v,t). The starting point (at t=0
) is defined by variables r0, p0. Parameters dt and tmax specify the integration step and maximal time for ray tracing. Result is array of {x,y,z,p,q,v,t} with dimensions {7 * int(tmax/dt+1) }.
HMDT
mgl_qo2d_solve (const char *
ham, const HMDT
ini_re, const HMDT
ini_im, const HMDT
ray, float
r, float
k0, HMDT
xx, HMDT
yy)Solves equation du/dt = i*k0*ham(p,q,x,y,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators (see mglPDE()
for details). Parameters ini_re, ini_im specify real and imaginary part of initial field distribution. Parameters ray set the reference ray, i.e. the ray around which the accompanied coordinate system will be maked. You may use, for example, the array created by mglRay()
function. Note, that the reference ray must be smooth enough to make accompanied coodrinates unambiguity. Otherwise errors in the solution may appear. If xx and yy are non-zero then Cartesian coordinates for each point will be written into them. See section Beam tracing sample, for sample code and picture.
HMDT
mgl_jacobian_2d (const HMDT
x, const HMDT
y)HMDT
mgl_jacobian_3d (const HMDT
x, const HMDT
y, const HMDT
z)Computates the Jacobian for transformation {i,j,k} to {x,y,z} where initial coordinates {i,j,k} are data indexes normalized in range [0,1]. The Jacobian is determined by formula det||dr_\alpha/d\xi_\beta|| where r={x,y,z} and \xi={i,j,k}. All dimensions must be the same for all data arrays. Data must be 3D if all 3 arrays {x,y,z} are specified or 2D if only 2 arrays {x,y} are specified.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Build Daemon user on September 11, 2010 using texi2html 1.82.