mathgl 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/mathgl/mathgl.i CHANGED
@@ -20,6 +20,7 @@
20
20
  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21
21
  ***************************************************************************/
22
22
 
23
+
23
24
  #ifdef SWIGRUBY
24
25
  %module MathGL
25
26
  #else
@@ -42,15 +43,16 @@
42
43
  %ignore *::operator-=;
43
44
  %ignore *::operator*=;
44
45
  %ignore *::operator/=;
45
- //%ignore mglDataA;
46
+ //%ignore mglDataA
46
47
 
47
48
  %{
48
49
  #define SWIG_FILE_WITH_INIT
49
- //#include "mgl2/config.h"
50
50
  #include "mgl2/type.h"
51
51
  #include "mgl2/data.h"
52
52
  #include "mgl2/mgl.h"
53
- //#include "mgl2/window.h"
53
+ const double Pi = M_PI;
54
+ const double NaN = NAN;
55
+ const double Inf = INFINITY;
54
56
  %}
55
57
 
56
58
  #if MGL_USE_DOUBLE
@@ -99,16 +101,13 @@ import_array();
99
101
  %include "rubymgl.i"
100
102
  #endif
101
103
 
102
- %include "mgl2/config.h"
103
- //%include "mgl2/define.h"
104
- %include "mgl2/type.h"
105
- %include "mgl2/data.h"
106
- %include "mgl2/mgl.h"
107
- //%include "mgl2/window.h"
104
+ %include "type.i"
105
+ %include "data.i"
106
+ %include "mgl.i"
108
107
  %extend mglData
109
108
  {
110
- float __getitem__( int i) { return self->GetVal(i); };
111
- float __paren( int i) { return self->GetVal(i); };
112
- void __setitem__( int i, float y) { self->SetVal(y,i); };
113
- void __paren_asgn( int i, float y) { self->SetVal(y,i); };
109
+ mreal __getitem__( int i) { return self->GetVal(i); };
110
+ mreal __paren( int i) { return self->GetVal(i); };
111
+ void __setitem__( int i, mreal y) { self->SetVal(y,i); };
112
+ void __paren_asgn( int i, mreal y) { self->SetVal(y,i); };
114
113
  };
data/ext/mathgl/mgl.i ADDED
@@ -0,0 +1,1349 @@
1
+ /***************************************************************************
2
+ * mgl.h is part of Math Graphic Library
3
+ * Copyright (C) 2007-2014 Alexey Balakin <mathgl.abalakin@gmail.ru> *
4
+ * *
5
+ * This program is free software; you can redistribute it and/or modify *
6
+ * it under the terms of the GNU General Public License as published by *
7
+ * the Free Software Foundation; either version 2 of the License, or *
8
+ * (at your option) any later version. *
9
+ * *
10
+ * This program is distributed in the hope that it will be useful, *
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
+ * GNU General Public License for more details. *
14
+ * *
15
+ * You should have received a copy of the GNU General Public License *
16
+ * along with this program; if not, write to the *
17
+ * Free Software Foundation, Inc., *
18
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
+ ***************************************************************************/
20
+ //-----------------------------------------------------------------------------
21
+ /// Wrapper class for all graphics
22
+ class mglGraph
23
+ {
24
+ mglGraph(const mglGraph &t) {} // copying is not allowed
25
+ const mglGraph &operator=(const mglGraph &t) { return t; }
26
+ protected:
27
+ HMGL gr;
28
+ public:
29
+ inline mglGraph(int kind=0, int width=600, int height=400)
30
+ {
31
+ if(kind==-1) gr=NULL;
32
+ #if MGL_HAVE_OPENGL
33
+ else if(kind==1) gr=mgl_create_graph_gl();
34
+ #else
35
+ else if(kind==1)
36
+ { gr=mgl_create_graph(width, height);
37
+ mglGlobalMess += "OpenGL support was disabled. Please, enable it and rebuild MathGL.\n"; }
38
+ #endif
39
+ else gr=mgl_create_graph(width, height);
40
+ }
41
+ inline mglGraph(HMGL graph)
42
+ { gr = graph; mgl_use_graph(gr,1); }
43
+ virtual ~mglGraph()
44
+ { if(mgl_use_graph(gr,-1)<1) mgl_delete_graph(gr); }
45
+ /// Get pointer to internal HMGL object
46
+ inline HMGL Self() { return gr; }
47
+ /// Set default parameters for plotting
48
+ inline void DefaultPlotParam() { mgl_set_def_param(gr); }
49
+ /// Set name of plot for saving filename
50
+ inline void SetPlotId(const char *id) { mgl_set_plotid(gr,id); }
51
+ /// Get name of plot for saving filename
52
+ inline const char *GetPlotId() { return mgl_get_plotid(gr); }
53
+
54
+ /// Ask to stop drawing
55
+ inline void Stop(bool stop=true) { mgl_ask_stop(gr, stop); }
56
+ /// Check if plot termination is asked
57
+ inline bool NeedStop() { return mgl_need_stop(gr); }
58
+ /// Set callback function for event processing
59
+ inline void SetEventFunc(void (*func)(void *), void *par=NULL)
60
+ { mgl_set_event_func(gr, func, par); }
61
+
62
+ /// Set the transparency on/off.
63
+ inline void Alpha(bool enable) { mgl_set_alpha(gr, enable); }
64
+ /// Set default value of alpha-channel
65
+ inline void SetAlphaDef(double alpha) { mgl_set_alpha_default(gr, alpha); }
66
+ /// Set the transparency type (0 - usual, 1 - glass, 2 - lamp)
67
+ inline void SetTranspType(int type) { mgl_set_transp_type(gr, type); }
68
+
69
+ /// Set the using of light on/off.
70
+ inline void Light(bool enable) { mgl_set_light(gr, enable); }
71
+ /// Switch on/off the specified light source.
72
+ inline void Light(int n,bool enable) { mgl_set_light_n(gr, n, enable); }
73
+ /// Use diffusive light (only for local light sources) -- OBSOLETE
74
+ inline void SetDifLight(bool dif) { mgl_set_light_dif(gr, dif); }
75
+ /// Add a light source.
76
+ inline void AddLight(int n, mglPoint p, char col='w', double bright=0.5, double ap=0)
77
+ { mgl_add_light_ext(gr, n, p.x, p.y, p.z, col, bright, ap); }
78
+ inline void AddLight(int n, mglPoint r, mglPoint p, char col='w', double bright=0.5, double ap=0)
79
+ { mgl_add_light_loc(gr, n, r.x, r.y, r.z, p.x, p.y, p.z, col, bright, ap); }
80
+ /// Set ambient light brightness
81
+ inline void SetAmbient(double i) { mgl_set_ambbr(gr, i); }
82
+ /// Set diffusive light brightness
83
+ inline void SetDiffuse(double i) { mgl_set_difbr(gr, i); }
84
+ /// Set the fog distance or switch it off (if d=0).
85
+ inline void Fog(double d, double dz=0.25) { mgl_set_fog(gr, d, dz); }
86
+
87
+ /// Set relative width of rectangles in Bars, Barh, BoxPlot
88
+ inline void SetBarWidth(double width) { mgl_set_bar_width(gr, width); }
89
+ /// Set default size of marks (locally you can use "size" option)
90
+ inline void SetMarkSize(double size) { mgl_set_mark_size(gr, size); }
91
+ /// Set default size of arrows (locally you can use "size" option)
92
+ inline void SetArrowSize(double size) { mgl_set_arrow_size(gr, size); }
93
+ /// Set number of mesh lines (use 0 to draw all of them)
94
+ inline void SetMeshNum(int num) { mgl_set_meshnum(gr, num); }
95
+ /// Set number of visible faces (use 0 to draw all of them)
96
+ inline void SetFaceNum(int num) { mgl_set_facenum(gr, num); }
97
+
98
+ /// Set cutting for points outside of bounding box
99
+ inline void SetCut(bool cut) { mgl_set_cut(gr, cut); }
100
+ /// Set additional cutting box
101
+ inline void SetCutBox(mglPoint p1, mglPoint p2)
102
+ { mgl_set_cut_box(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z); }
103
+ /// Set the cutting off condition (formula)
104
+ inline void CutOff(const char *EqC) { mgl_set_cutoff(gr, EqC); }
105
+
106
+ /// Set default font size
107
+ inline void SetFontSize(double size) { mgl_set_font_size(gr, size); }
108
+ /// Set default font style and color
109
+ inline void SetFontDef(const char *fnt) { mgl_set_font_def(gr, fnt); }
110
+ /// Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72)
111
+ virtual void SetFontSizePT(double pt, int dpi=72){ SetFontSize(pt*27.f/dpi); }
112
+ /// Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt)
113
+ inline void SetFontSizeCM(double cm, int dpi=72) { SetFontSizePT(cm*28.45f,dpi); }
114
+ /// Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt)
115
+ inline void SetFontSizeIN(double in, int dpi=72) { SetFontSizePT(in*72.27f,dpi); }
116
+ /// Load font from file
117
+ inline void LoadFont(const char *name, const char *path=NULL)
118
+ { mgl_load_font(gr, name, path); }
119
+ /// Copy font from another mglGraph instance
120
+ inline void CopyFont(const mglGraph *GR) { mgl_copy_font(gr, GR->gr);}
121
+ /// Restore font (load default font for new HMGL objects)
122
+ inline void RestoreFont() { mgl_restore_font(gr); }
123
+ /// Set to use or not text rotation
124
+ inline void SetRotatedText(bool rotated) { mgl_set_rotated_text(gr, rotated); }
125
+
126
+ /// Set default palette
127
+ inline void SetPalette(const char *colors) { mgl_set_palette(gr, colors); }
128
+ /// Set default color scheme
129
+ inline void SetDefScheme(const char *sch) { mgl_set_def_sch(gr, sch); }
130
+
131
+ /// Sets RGB values for color with given id
132
+ static inline void SetColor(char id, double r, double g, double b) { mgl_set_color(id, r, g, b); }
133
+ /// Set mask for face coloring as array of type 'unsigned char[8]'
134
+ static inline void SetMask(char id, const char *mask) { mgl_set_mask(id, mask); }
135
+ /// Set mask for face coloring as uint64_t number
136
+ static inline void SetMask(char id, uint64_t mask) { mgl_set_mask_val(id, mask); }
137
+ /// Set default mask rotation angle
138
+ inline void SetMaskAngle(int angle) { mgl_set_mask_angle(gr, angle); }
139
+
140
+ /// Get last warning code
141
+ inline int GetWarn() { return mgl_get_warn(gr);}
142
+ /// Set warning code ant fill message
143
+ inline void SetWarn(int code, const char *info) { mgl_set_warn(gr,code,info); }
144
+ /// Set buffer for warning messages
145
+ inline const char *Message() { return mgl_get_mess(gr); }
146
+
147
+ /// Set axis range scaling -- simplified way to shift/zoom axis range -- need to replot whole image!
148
+ inline void ZoomAxis(mglPoint p1=mglPoint(0,0,0,0), mglPoint p2=mglPoint(1,1,1,1))
149
+ { mgl_zoom_axis(gr, p1.x,p1.y,p1.z,p1.c, p2.x,p2.y,p2.z,p2.c); }
150
+ /// Add [v1, v2] to the current range in direction dir
151
+ inline void AddRange(char dir, double v1, double v2)
152
+ { mgl_add_range_val(gr, dir, v1, v2); }
153
+ /// Set range in direction dir as [v1, v2]
154
+ inline void SetRange(char dir, double v1, double v2)
155
+ { mgl_set_range_val(gr, dir, v1, v2); }
156
+ /// Set range in direction dir as minimal and maximal values of data a
157
+ inline void SetRange(char dir, const mglData &dat, bool add=false)
158
+ { mgl_set_range_dat(gr, dir, &dat, add); }
159
+ /// Set values of axis range as minimal and maximal values of datas
160
+ inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz, const mglData &cc)
161
+ { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0);
162
+ mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&cc,0); }
163
+ /// Set values of axis range as minimal and maximal values of datas
164
+ inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz)
165
+ { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0);
166
+ mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&zz,0); }
167
+ /// Set values of axis range as minimal and maximal values of datas
168
+ inline void SetRanges(const mglData &xx, const mglData &yy)
169
+ { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0); }
170
+ /// Set values of axis ranges
171
+ inline void SetRanges(double x1, double x2, double y1, double y2, double z1=0, double z2=0)
172
+ { mgl_set_ranges(gr, x1, x2, y1, y2, z1, z2); }
173
+ /// Set values of axis ranges
174
+ inline void SetRanges(mglPoint p1, mglPoint p2)
175
+ { mgl_set_ranges(gr, p1.x, p2.x, p1.y, p2.y, p1.z, p2.z); }
176
+ /// Set ranges for automatic variables
177
+ inline void SetAutoRanges(double x1, double x2, double y1=0, double y2=0, double z1=0, double z2=0, double c1=0, double c2=0)
178
+ { mgl_set_auto_ranges(gr, x1, x2, y1, y2, z1, z2, c1, c2); }
179
+ /// Set ranges for automatic variables
180
+ inline void SetAutoRanges(mglPoint p1, mglPoint p2)
181
+ { mgl_set_auto_ranges(gr, p1.x, p2.x, p1.y, p2.y, p1.z, p2.z, p1.c, p2.c); }
182
+ /// Set axis origin
183
+ inline void SetOrigin(mglPoint p)
184
+ { mgl_set_origin(gr, p.x, p.y, p.z); }
185
+ inline void SetOrigin(double x0, double y0, double z0=NaN)
186
+ { mgl_set_origin(gr, x0, y0, z0); }
187
+
188
+ /// Set the transformation formulas for coordinate
189
+ inline void SetFunc(const char *EqX, const char *EqY, const char *EqZ=NULL, const char *EqA=NULL)
190
+ { mgl_set_func(gr, EqX, EqY, EqZ, EqA); }
191
+ /// Set one of predefined transformation rule
192
+ inline void SetCoor(int how) { mgl_set_coor(gr, how); }
193
+ /// Set to draw Ternary axis (triangle like axis, grid and so on)
194
+ inline void Ternary(int val) { mgl_set_ternary(gr, val); }
195
+
196
+ /// Set to use or not tick labels rotation
197
+ inline void SetTickRotate(bool val) { mgl_set_tick_rotate(gr,val); }
198
+ /// Set to use or not tick labels skipping
199
+ inline void SetTickSkip(bool val) { mgl_set_tick_skip(gr,val); }
200
+ /// Set tick length
201
+ inline void SetTickLen(double len, double stt=1)
202
+ { mgl_set_tick_len(gr, len, stt); }
203
+ /// Set axis and ticks style
204
+ inline void SetAxisStl(const char *stl="k", const char *tck=0, const char *sub=0)
205
+ { mgl_set_axis_stl(gr, stl, tck, sub); }
206
+
207
+ /// Set time templates for ticks
208
+ inline void SetTicksTime(char dir, double d=0, const char *t="")
209
+ { mgl_set_ticks_time(gr,dir,d,t); }
210
+ /// Set ticks text (\n separated). Use "" to disable this feature.
211
+ inline void SetTicksVal(char dir, const char *lbl, bool add=false)
212
+ { mgl_set_ticks_str(gr,dir,lbl,add); }
213
+ inline void SetTicksVal(char dir, const wchar_t *lbl, bool add=false)
214
+ { mgl_set_ticks_wcs(gr,dir,lbl,add); }
215
+ /// Set ticks position and text (\n separated). Use "" to disable this feature.
216
+ inline void SetTicksVal(char dir, const mglData &v, const char *lbl, bool add=false)
217
+ { mgl_set_ticks_val(gr,dir,&v,lbl,add); }
218
+ inline void SetTicksVal(char dir, const mglData &v, const wchar_t *lbl, bool add=false)
219
+ { mgl_set_ticks_valw(gr,dir,&v,lbl,add); }
220
+ /// Add manual tick at given position. Use "" to disable this feature.
221
+ inline void AddTick(char dir, double val, const char *lbl)
222
+ { mgl_add_tick(gr,dir,val,lbl); }
223
+ inline void AddTick(char dir, double val, const wchar_t *lbl)
224
+ { mgl_add_tickw(gr,dir,val,lbl); }
225
+ /// Set the ticks parameters and string for its factor
226
+ inline void SetTicks(char dir, double d=0, int ns=0, double org=NaN, const char *factor="")
227
+ { mgl_set_ticks_fact(gr, dir, d, ns, org, factor); }
228
+ inline void SetTicks(char dir, double d, int ns, double org, const wchar_t *factor)
229
+ { mgl_set_ticks_factw(gr, dir, d, ns, org, factor); }
230
+ /// Auto adjust ticks
231
+ inline void Adjust(const char *dir="xyzc")
232
+ { mgl_adjust_ticks(gr, dir); }
233
+ /// Set templates for ticks
234
+ inline void SetTickTempl(char dir, const char *t)
235
+ { mgl_set_tick_templ(gr,dir,t); }
236
+ inline void SetTickTempl(char dir, const wchar_t *t)
237
+ { mgl_set_tick_templw(gr,dir,t); }
238
+ /// Tune ticks
239
+ inline void SetTuneTicks(int tune, double fact_pos=1.15)
240
+ { mgl_tune_ticks(gr, tune, fact_pos); }
241
+ /// Set additional shift of tick labels
242
+ inline void SetTickShift(mglPoint p)
243
+ { mgl_set_tick_shift(gr,p.x,p.y,p.z,p.c); }
244
+ /// Set to use UTC time instead of local time
245
+ inline void SetTimeUTC(bool enable)
246
+ { mgl_set_flag(gr,enable, MGL_USE_GMTIME); }
247
+ /// Set to draw tick labels at axis origin
248
+ inline void SetOriginTick(bool enable=true)
249
+ { mgl_set_flag(gr,!enable, MGL_NO_ORIGIN); }
250
+
251
+ /// Put further plotting in some region of whole frame.
252
+ inline void SubPlot(int nx,int ny,int m,const char *style="<>_^", double dx=0, double dy=0)
253
+ { mgl_subplot_d(gr, nx, ny, m, style, dx, dy); }
254
+ /// Like SubPlot() but "join" several cells
255
+ inline void MultiPlot(int nx,int ny,int m, int dx, int dy, const char *style="<>_^")
256
+ { mgl_multiplot(gr, nx, ny, m, dx, dy, style); }
257
+ /// Put further plotting in a region of whole frame.
258
+ inline void InPlot(double x1,double x2,double y1,double y2, bool rel=true)
259
+ { if(rel) mgl_relplot(gr, x1, x2, y1, y2);
260
+ else mgl_inplot(gr, x1, x2, y1, y2); }
261
+ /// Put further plotting in column cell of previous subplot
262
+ inline void ColumnPlot(int num, int ind, double d=0)
263
+ { mgl_columnplot(gr,num,ind,d); }
264
+ /// Put further plotting in matrix cell of previous subplot
265
+ inline void GridPlot(int nx, int ny, int ind, double d=0)
266
+ { mgl_gridplot(gr,nx,ny,ind,d); }
267
+ /// Put further plotting in cell of stick rotated on angles tet, phi
268
+ inline void StickPlot(int num, int i, double tet, double phi)
269
+ { mgl_stickplot(gr,num,i,tet,phi); }
270
+
271
+ /// Set factor of plot size
272
+ inline void SetPlotFactor(double val)
273
+ { mgl_set_plotfactor(gr,val); }
274
+ /// Push transformation matrix into stack
275
+ inline void Push() { mgl_mat_push(gr); }
276
+ /// Pop transformation matrix from stack
277
+ inline void Pop() { mgl_mat_pop(gr); }
278
+
279
+ /// Add title for current subplot/inplot
280
+ inline void Title(const char *title,const char *stl="",double size=-2)
281
+ { mgl_title(gr,title,stl,size); }
282
+ inline void Title(const wchar_t *title,const char *stl="",double size=-2)
283
+ { mgl_titlew(gr,title,stl,size); }
284
+ /// Set aspect ratio for further plotting.
285
+ inline void Aspect(double Ax,double Ay,double Az=1)
286
+ { mgl_aspect(gr, Ax, Ay, Az); }
287
+ /// Rotate a further plotting.
288
+ inline void Rotate(double TetX,double TetZ=0,double TetY=0)
289
+ { mgl_rotate(gr, TetX, TetZ, TetY); }
290
+ /// Rotate a further plotting around vector {x,y,z}.
291
+ inline void RotateN(double Tet,double x,double y,double z)
292
+ { mgl_rotate_vector(gr, Tet, x, y, z); }
293
+ /// Set perspective (in range [0,1)) for plot. Set to zero for switching off.
294
+ inline void Perspective(double val)
295
+ { mgl_perspective(gr, val); }
296
+ /// Set angle of view independently from Rotate().
297
+ inline void View(double TetX,double TetZ=0,double TetY=0)
298
+ { mgl_view(gr, TetX, TetZ, TetY); }
299
+ /// Set angle of view independently from Rotate().
300
+ inline void ViewAsRotate(double TetZ,double TetX,double TetY=0)
301
+ { mgl_view(gr, -TetX, -TetZ, -TetY); }
302
+ /// Zoom in/out a part of picture (use Zoom(0, 0, 1, 1) for restore default)
303
+ inline void Zoom(double x1, double y1, double x2, double y2)
304
+ { mgl_zoom(gr, x1, y1, x2, y2); }
305
+
306
+ /// Set size of frame in pixels. Normally this function is called internally.
307
+ inline void SetSize(int width, int height) { mgl_set_size(gr, width, height); }
308
+ /// Set plot quality
309
+ inline void SetQuality(int qual=MGL_DRAW_NORM) { mgl_set_quality(gr, qual); }
310
+ /// Get plot quality
311
+ inline int GetQuality() { return mgl_get_quality(gr); }
312
+ /// Set drawing region for Quality&4
313
+ inline void SetDrawReg(long nx=1, long ny=1, long m=0) { mgl_set_draw_reg(gr,nx,ny,m); }
314
+ /// Start group of objects
315
+ inline void StartGroup(const char *name) { mgl_start_group(gr, name); }
316
+ /// End group of objects
317
+ inline void EndGroup() { mgl_end_group(gr); }
318
+ /// Highlight objects with given id
319
+ inline void Highlight(int id) { mgl_highlight(gr, id); }
320
+
321
+ /// Show current image
322
+ inline void ShowImage(const char *viewer, bool keep=0)
323
+ { mgl_show_image(gr, viewer, keep); }
324
+ /// Write the frame in file (depending extension, write current frame if fname is empty)
325
+ inline void WriteFrame(const char *fname=0,const char *descr="")
326
+ { mgl_write_frame(gr, fname, descr); }
327
+ /// Write the frame in file using JPEG format
328
+ inline void WriteJPEG(const char *fname,const char *descr="")
329
+ { mgl_write_jpg(gr, fname, descr); }
330
+ /// Write the frame in file using PNG format with transparency
331
+ inline void WritePNG(const char *fname,const char *descr="", bool alpha=true)
332
+ { if(alpha) mgl_write_png(gr, fname, descr);
333
+ else mgl_write_png_solid(gr, fname, descr); }
334
+ /// Write the frame in file using BMP format
335
+ inline void WriteBMP(const char *fname,const char *descr="")
336
+ { mgl_write_bmp(gr, fname, descr); }
337
+ /// Write the frame in file using BMP format
338
+ inline void WriteTGA(const char *fname,const char *descr="")
339
+ { mgl_write_tga(gr, fname, descr); }
340
+ /// Write the frame in file using PostScript format
341
+ inline void WriteEPS(const char *fname,const char *descr="")
342
+ { mgl_write_eps(gr, fname, descr); }
343
+ /// Write the frame in file using LaTeX format
344
+ inline void WriteTEX(const char *fname,const char *descr="")
345
+ { mgl_write_tex(gr, fname, descr); }
346
+ /// Write the frame in file using PostScript format as bitmap
347
+ inline void WriteBPS(const char *fname,const char *descr="")
348
+ { mgl_write_bps(gr, fname, descr); }
349
+ /// Write the frame in file using SVG format
350
+ inline void WriteSVG(const char *fname,const char *descr="")
351
+ { mgl_write_svg(gr, fname, descr); }
352
+ /// Write the frame in file using GIF format (only for current frame!)
353
+ inline void WriteGIF(const char *fname,const char *descr="")
354
+ { mgl_write_gif(gr, fname, descr); }
355
+
356
+ /// Write the frame in file using OBJ format
357
+ inline void WriteOBJ(const char *fname,const char *descr="",bool use_png=true)
358
+ { mgl_write_obj(gr, fname, descr, use_png); }
359
+ /// Write the frame in file using OBJ format - Balakin way
360
+ inline void WriteOBJold(const char *fname,const char *descr="",bool use_png=true)
361
+ { mgl_write_obj_old(gr, fname, descr, use_png); }
362
+ /// Write the frame in file using XYZ format
363
+ inline void WriteXYZ(const char *fname,const char *descr="")
364
+ { mgl_write_xyz(gr, fname, descr); }
365
+ /// Write the frame in file using STL format (faces only)
366
+ inline void WriteSTL(const char *fname,const char *descr="")
367
+ { mgl_write_stl(gr, fname, descr); }
368
+ /// Write the frame in file using OFF format
369
+ inline void WriteOFF(const char *fname,const char *descr="", bool colored=false)
370
+ { mgl_write_off(gr, fname, descr,colored); }
371
+ // /// Write the frame in file using X3D format
372
+ // inline void WriteX3D(const char *fname,const char *descr="")
373
+ // { mgl_write_x3d(gr, fname, descr); }
374
+ /// Write the frame in file using PRC format
375
+ inline void WritePRC(const char *fname,const char *descr="",bool make_pdf=true)
376
+ { mgl_write_prc(gr, fname, descr, make_pdf); }
377
+ /// Export in JSON format suitable for later drawing by JavaScript
378
+ inline void WriteJSON(const char *fname,const char *descr="",bool force_z=false)
379
+ { if(force_z) mgl_write_json_z(gr, fname, descr);
380
+ else mgl_write_json(gr, fname, descr); }
381
+ /// Return string of JSON data suitable for later drawing by JavaScript
382
+ inline const char *GetJSON() { return mgl_get_json(gr); }
383
+
384
+ /// Force preparing the image. It can be useful for OpenGL mode mostly.
385
+ inline void Finish() { mgl_finish(gr); }
386
+ /// Create new frame.
387
+ inline void NewFrame() { mgl_new_frame(gr); }
388
+ /// Finish frame drawing
389
+ inline void EndFrame() { mgl_end_frame(gr); }
390
+ /// Get the number of created frames
391
+ inline int GetNumFrame() { return mgl_get_num_frame(gr); }
392
+ /// Reset frames counter (start it from zero)
393
+ inline void ResetFrames() { mgl_reset_frames(gr); }
394
+ /// Delete primitives for i-th frame (work if MGL_VECT_FRAME is set on)
395
+ inline void DelFrame(int i) { mgl_del_frame(gr, i); }
396
+ /// Get drawing data for i-th frame (work if MGL_VECT_FRAME is set on)
397
+ inline void GetFrame(int i) { mgl_get_frame(gr, i); }
398
+ /// Set drawing data for i-th frame (work if MGL_VECT_FRAME is set on). Work as EndFrame() but don't add frame to GIF image.
399
+ inline void SetFrame(int i) { mgl_set_frame(gr, i); }
400
+ /// Append drawing data from i-th frame (work if MGL_VECT_FRAME is set on)
401
+ inline void ShowFrame(int i){ mgl_show_frame(gr, i); }
402
+ /// Clear list of primitives for current drawing
403
+ inline void ClearFrame() { mgl_clear_frame(gr); }
404
+
405
+ /// Start write frames to cinema using GIF format
406
+ inline void StartGIF(const char *fname, int ms=100)
407
+ { mgl_start_gif(gr, fname,ms); }
408
+ /// Stop writing cinema using GIF format
409
+ inline void CloseGIF() { mgl_close_gif(gr); }
410
+ /// Export points and primitives in file using MGLD format
411
+ inline void ExportMGLD(const char *fname, const char *descr=0)
412
+ { mgl_export_mgld(gr, fname, descr); }
413
+ /// Import points and primitives from file using MGLD format
414
+ inline void ImportMGLD(const char *fname, bool add=false)
415
+ { mgl_import_mgld(gr, fname, add); }
416
+
417
+ /// Copy RGB values into array which is allocated by user
418
+ inline bool GetRGB(char *imgdata, int imglen)
419
+ {
420
+ long w=mgl_get_width(gr), h=mgl_get_height(gr);
421
+ if(imglen>=3*w*h) memcpy(imgdata, mgl_get_rgb(gr),3*w*h);
422
+ return imglen>=3*w*h;
423
+ }
424
+ inline const unsigned char *GetRGB() { return mgl_get_rgb(gr); }
425
+ /// Copy RGBA values into array which is allocated by user
426
+ inline bool GetRGBA(char *imgdata, int imglen)
427
+ {
428
+ long w=mgl_get_width(gr), h=mgl_get_height(gr);
429
+ if(imglen>=4*w*h) memcpy(imgdata, mgl_get_rgba(gr),4*w*h);
430
+ return imglen>=4*w*h;
431
+ }
432
+ inline const unsigned char *GetRGBA() { return mgl_get_rgba(gr); }
433
+ /// Copy BGRN values into array which is allocated by user
434
+ inline bool GetBGRN(unsigned char *imgdata, int imglen)
435
+ {
436
+ long w=mgl_get_width(gr), h=mgl_get_height(gr), i;
437
+ const unsigned char *buf=mgl_get_rgb(gr);
438
+ if(imglen>=4*w*h) for(i=0;i<w*h;i++)
439
+ {
440
+ imgdata[4*i] = buf[3*i+2];
441
+ imgdata[4*i+1] = buf[3*i+1];
442
+ imgdata[4*i+2] = buf[3*i];
443
+ imgdata[4*i+3] = 255;
444
+ }
445
+ return imglen>=4*w*h;
446
+ }
447
+ /// Copy RGBA values of background image into array which is allocated by user
448
+ inline bool GetBackground(char *imgdata, int imglen)
449
+ {
450
+ long w=mgl_get_width(gr), h=mgl_get_height(gr);
451
+ if(imglen>=4*w*h) memcpy(imgdata, mgl_get_background(gr),4*w*h);
452
+ return imglen>=4*w*h;
453
+ }
454
+ inline const unsigned char *GetBackground() { return mgl_get_background(gr); }
455
+ /// Get width of the image
456
+ inline int GetWidth() { return mgl_get_width(gr); }
457
+ /// Get height of the image
458
+ inline int GetHeight() { return mgl_get_height(gr);}
459
+ /// Calculate 3D coordinate {x,y,z} for screen point {xs,ys}
460
+ inline mglPoint CalcXYZ(int xs, int ys)
461
+ {
462
+ mreal x,y,z;
463
+ mgl_calc_xyz(gr,xs,ys,&x,&y,&z);
464
+ return mglPoint(x,y,z);
465
+ }
466
+ /// Calculate screen point {xs,ys} for 3D coordinate {x,y,z}
467
+ inline mglPoint CalcScr(mglPoint p)
468
+ {
469
+ int xs,ys;
470
+ mgl_calc_scr(gr,p.x,p.y,p.z,&xs,&ys);
471
+ return mglPoint(xs,ys);
472
+ }
473
+ /// Set object/subplot id
474
+ inline void SetObjId(int id) { mgl_set_obj_id(gr,id); }
475
+ /// Get object id
476
+ inline int GetObjId(long x,long y) { return mgl_get_obj_id(gr,x,y); }
477
+ /// Get subplot id
478
+ inline int GetSplId(long x,long y) { return mgl_get_spl_id(gr,x,y); }
479
+ /// Check if {\a xs,\a ys} is close to active point with accuracy d, and return its position or -1
480
+ inline long IsActive(int xs, int ys, int d=1) { return mgl_is_active(gr,xs,ys,d); }
481
+
482
+ /// Combine plots from 2 canvases. Result will be saved into this
483
+ inline void Combine(const mglGraph *g) { mgl_combine_gr(gr,g->gr); }
484
+
485
+ /// Clear up the frame
486
+ inline void Clf(double r, double g, double b) { mgl_clf_rgb(gr, r, g, b); }
487
+ inline void Clf(const char *col) { mgl_clf_str(gr, col); }
488
+ inline void Clf(char col) { mgl_clf_chr(gr, col); }
489
+ inline void Clf() { mgl_clf(gr); }
490
+ /// Clear unused points and primitives. Useful only in combination with SetFaceNum().
491
+ inline void ClearUnused() { mgl_clear_unused(gr); }
492
+
493
+ /// Load background image
494
+ inline void LoadBackground(const char *fname, double alpha=1)
495
+ { mgl_load_background(gr,fname,alpha); }
496
+ /// Force drawing the image and use it as background one
497
+ inline void Rasterize() { mgl_rasterize(gr); }
498
+
499
+ /// Draws the point (ball) at position {x,y,z} with color c
500
+ inline void Ball(mglPoint p, char c='r')
501
+ { char s[3]={'.',c,0}; mgl_mark(gr, p.x, p.y, p.z, s); }
502
+ /// Draws the mark at position p
503
+ inline void Mark(mglPoint p, const char *mark)
504
+ { mgl_mark(gr, p.x, p.y, p.z, mark); }
505
+ /// Draws the line between points by specified pen
506
+ inline void Line(mglPoint p1, mglPoint p2, const char *pen="B",int n=2)
507
+ { mgl_line(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, pen, n); }
508
+ /// Draws the spline curve between points by specified pen
509
+ inline void Curve(mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *pen="B", int n=100)
510
+ { mgl_curve(gr, p1.x, p1.y, p1.z, d1.x, d1.y, d1.z, p2.x, p2.y, p2.z, d2.x, d2.y, d2.z, pen, n); }
511
+ /// Draws the 3d error box e for point p
512
+ inline void Error(mglPoint p, mglPoint e, const char *pen="k")
513
+ { mgl_error_box(gr, p.x, p.y, p.z, e.x, e.y, e.z, pen); }
514
+
515
+ /// Draws the face between points with color stl (include interpolation up to 4 colors).
516
+ inline void Face(mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="r")
517
+ { mgl_face(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, p3.x, p3.y, p3.z, p4.x, p4.y, p4.z, stl); }
518
+ /// Draws the face in y-z plane at point p with color stl (include interpolation up to 4 colors).
519
+ inline void FaceX(mglPoint p, double wy, double wz, const char *stl="w", double dx=0, double dy=0)
520
+ { mgl_facex(gr, p.x, p.y, p.z, wy, wz, stl, dx, dy); }
521
+ /// Draws the face in x-z plane at point p with color stl (include interpolation up to 4 colors).
522
+ inline void FaceY(mglPoint p, double wx, double wz, const char *stl="w", double dx=0, double dy=0)
523
+ { mgl_facey(gr, p.x, p.y, p.z, wx, wz, stl, dx, dy); }
524
+ /// Draws the face in x-y plane at point p with color stl (include interpolation up to 4 colors).
525
+ inline void FaceZ(mglPoint p, double wx, double wy, const char *stl="w", double dx=0, double dy=0)
526
+ { mgl_facez(gr, p.x, p.y, p.z, wx, wy, stl, dx, dy); }
527
+ /// Draws the drop at point p in direction d with color col and radius r
528
+ inline void Drop(mglPoint p, mglPoint d, double r, const char *col="r", double shift=1, double ap=1)
529
+ { mgl_drop(gr, p.x, p.y, p.z, d.x, d.y, d.z, r, col, shift, ap); }
530
+ /// Draws the sphere at point p with color col and radius r
531
+ inline void Sphere(mglPoint p, double r, const char *col="r")
532
+ { mgl_sphere(gr, p.x, p.y, p.z, r, col); }
533
+ /// Draws the cone between points p1,p2 with radius r1,r2 and with style stl
534
+ inline void Cone(mglPoint p1, mglPoint p2, double r1, double r2=-1, const char *stl="r@")
535
+ { mgl_cone(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z,r1,r2,stl); }
536
+ /// Draws the ellipse between points p1,p2 with color stl and width r
537
+ inline void Ellipse(mglPoint p1, mglPoint p2, double r, const char *stl="r")
538
+ { mgl_ellipse(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); }
539
+ /// Draws the circle at point p with color stl and radius r
540
+ inline void Circle(mglPoint p, double r, const char *stl="r")
541
+ { mgl_ellipse(gr, p.x, p.y, p.z, p.x, p.y, p.z, r,stl); }
542
+ /// Draws the rhomb between points p1,p2 with color stl and width r
543
+ inline void Rhomb(mglPoint p1, mglPoint p2, double r, const char *stl="r")
544
+ { mgl_rhomb(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); }
545
+ /// Draws the polygon based on points p1,p2 with color stl
546
+ inline void Polygon(mglPoint p1, mglPoint p2, int n, const char *stl="r")
547
+ { mgl_polygon(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, n,stl); }
548
+ /// Draws the arc around axis pr with center at p0 and starting from p1, by color stl and angle a (in degrees)
549
+ inline void Arc(mglPoint p0, mglPoint pr, mglPoint p1, double a, const char *stl="r")
550
+ { mgl_arc_ext(gr, p0.x,p0.y,p0.z, pr.x,pr.y,pr.z, p1.x,p1.y,p1.z, a,stl); }
551
+ /// Draws the arc around axis 'z' with center at p0 and starting from p1, by color stl and angle a (in degrees)
552
+ inline void Arc(mglPoint p0, mglPoint p1, double a, const char *stl="r")
553
+ { mgl_arc_ext(gr, p0.x,p0.y,p0.z, 0,0,1, p1.x,p1.y,p0.z, a,stl); }
554
+
555
+ /// Print text in position p with specified font
556
+ inline void Putsw(mglPoint p,const wchar_t *text,const char *font=":C",double size=-1)
557
+ { mgl_putsw(gr, p.x, p.y, p.z, text, font, size); }
558
+ inline void Puts(mglPoint p,const char *text,const char *font=":C",double size=-1)
559
+ { mgl_puts(gr, p.x, p.y, p.z, text, font, size); }
560
+ inline void Putsw(double x, double y,const wchar_t *text,const char *font=":AC",double size=-1)
561
+ { mgl_putsw(gr, x, y, 0, text, font, size); }
562
+ inline void Puts(double x, double y,const char *text,const char *font=":AC",double size=-1)
563
+ { mgl_puts(gr, x, y, 0, text, font, size); }
564
+ /// Print text in position p along direction d with specified font
565
+ inline void Putsw(mglPoint p, mglPoint d, const wchar_t *text, const char *font=":L", double size=-1)
566
+ { mgl_putsw_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); }
567
+ inline void Puts(mglPoint p, mglPoint d, const char *text, const char *font=":L", double size=-1)
568
+ { mgl_puts_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); }
569
+
570
+ /// Print text along the curve
571
+ inline void Text(const mglData &x, const mglData &y, const mglData &z, const char *text, const char *font="", const char *opt="")
572
+ { mgl_text_xyz(gr, &x, &y, &z, text, font, opt); }
573
+ inline void Text(const mglData &x, const mglData &y, const char *text, const char *font="", const char *opt="")
574
+ { mgl_text_xy(gr, &x, &y, text, font, opt); }
575
+ inline void Text(const mglData &y, const char *text, const char *font="", const char *opt="")
576
+ { mgl_text_y(gr, &y, text, font, opt); }
577
+ inline void Text(const mglData &x, const mglData &y, const mglData &z, const wchar_t *text, const char *font="", const char *opt="")
578
+ { mgl_textw_xyz(gr, &x, &y, &z, text, font, opt); }
579
+ inline void Text(const mglData &x, const mglData &y, const wchar_t *text, const char *font="", const char *opt="")
580
+ { mgl_textw_xy(gr, &x, &y, text, font, opt); }
581
+ inline void Text(const mglData &y, const wchar_t *text, const char *font="", const char *opt="")
582
+ { mgl_textw_y(gr, &y, text, font, opt); }
583
+
584
+ /// Draws bounding box outside the plotting volume with color c.
585
+ inline void Box(const char *col="", bool ticks=true)
586
+ { mgl_box_str(gr, col, ticks); }
587
+ /// Draw axises with ticks in direction(s) dir.
588
+ inline void Axis(const char *dir="xyzt", const char *stl="", const char *opt="")
589
+ { mgl_axis(gr, dir,stl,opt); }
590
+ /// Draw grid lines perpendicular to direction(s) dir.
591
+ inline void Grid(const char *dir="xyzt",const char *pen="B", const char *opt="")
592
+ { mgl_axis_grid(gr, dir, pen, opt); }
593
+ /// Print the label text for axis dir.
594
+ inline void Label(char dir, const char *text, double pos=+1, const char *opt="")
595
+ { mgl_label(gr, dir, text, pos, opt); }
596
+ inline void Label(char dir, const wchar_t *text, double pos=+1, const char *opt="")
597
+ { mgl_labelw(gr, dir, text, pos, opt); }
598
+
599
+ /// Draw colorbar at edge of axis
600
+ inline void Colorbar(const char *sch="")
601
+ { mgl_colorbar(gr, sch); }
602
+ inline void Colorbar(const char *sch,double x,double y,double w=1,double h=1)
603
+ { mgl_colorbar_ext(gr, sch, x,y,w,h); }
604
+ /// Draw colorbar with manual colors at edge of axis
605
+ inline void Colorbar(const mglData &val, const char *sch="")
606
+ { mgl_colorbar_val(gr, &val, sch); }
607
+ inline void Colorbar(const mglData &val, const char *sch,double x,double y,double w=1,double h=1)
608
+ { mgl_colorbar_val_ext(gr, &val, sch, x,y,w,h); }
609
+
610
+ /// Add string to legend
611
+ inline void AddLegend(const char *text,const char *style)
612
+ { mgl_add_legend(gr, text, style); }
613
+ inline void AddLegend(const wchar_t *text,const char *style)
614
+ { mgl_add_legendw(gr, text, style); }
615
+ /// Clear saved legend string
616
+ inline void ClearLegend()
617
+ { mgl_clear_legend(gr); }
618
+ /// Draw legend of accumulated strings at position {x,y}
619
+ inline void Legend(double x, double y, const char *font="#", const char *opt="")
620
+ { mgl_legend_pos(gr, x, y, font, opt); }
621
+ /// Draw legend of accumulated strings
622
+ inline void Legend(int where=3, const char *font="#", const char *opt="")
623
+ { mgl_legend(gr, where, font, opt); }
624
+ /// Set number of marks in legend sample
625
+ inline void SetLegendMarks(int num) { mgl_set_legend_marks(gr, num); }
626
+
627
+ /// Draw usual curve {x,y,z}
628
+ inline void Plot(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="")
629
+ { mgl_plot_xyz(gr, &x, &y, &z, pen, opt); }
630
+ inline void Plot(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
631
+ { mgl_plot_xy(gr, &x, &y, pen,opt); }
632
+ inline void Plot(const mglData &y, const char *pen="", const char *opt="")
633
+ { mgl_plot(gr, &y, pen,opt); }
634
+ /// Draw tape(s) which rotates as (bi-)normales of curve {x,y,z}
635
+ inline void Tape(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="")
636
+ { mgl_tape_xyz(gr, &x, &y, &z, pen, opt); }
637
+ inline void Tape(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
638
+ { mgl_tape_xy(gr, &x, &y, pen,opt); }
639
+ inline void Tape(const mglData &y, const char *pen="", const char *opt="")
640
+ { mgl_tape(gr, &y, pen,opt); }
641
+ /// Draw radar chart (plot in curved coordinates)
642
+ inline void Radar(const mglData &a, const char *pen="", const char *opt="")
643
+ { mgl_radar(gr, &a, pen, opt); }
644
+ /// Draw stairs for points in arrays {x,y,z}
645
+ inline void Step(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="")
646
+ { mgl_step_xyz(gr, &x, &y, &z, pen, opt); }
647
+ inline void Step(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
648
+ { mgl_step_xy(gr, &x, &y, pen, opt); }
649
+ inline void Step(const mglData &y, const char *pen="", const char *opt="")
650
+ { mgl_step(gr, &y, pen, opt); }
651
+ /// Draw curve {x,y,z} which is colored by c (like tension plot)
652
+ inline void Tens(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *pen="", const char *opt="")
653
+ { mgl_tens_xyz(gr, &x, &y, &z, &c, pen, opt); }
654
+ inline void Tens(const mglData &x, const mglData &y, const mglData &c, const char *pen="", const char *opt="")
655
+ { mgl_tens_xy(gr, &x, &y, &c, pen, opt); }
656
+ inline void Tens(const mglData &y, const mglData &c, const char *pen="", const char *opt="")
657
+ { mgl_tens(gr, &y, &c, pen, opt); }
658
+ /// Fill area between curve {x,y,z} and axis plane
659
+ inline void Area(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="")
660
+ { mgl_area_xyz(gr, &x, &y, &z, pen, opt); }
661
+ inline void Area(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
662
+ { mgl_area_xy(gr, &x, &y, pen, opt); }
663
+ inline void Area(const mglData &y, const char *pen="", const char *opt="")
664
+ { mgl_area(gr, &y, pen, opt); }
665
+ /// Fill area between curves y1 and y2 specified parametrically
666
+ inline void Region(const mglData &y1, const mglData &y2, const char *pen="", const char *opt="")
667
+ { mgl_region(gr, &y1, &y2, pen, opt); }
668
+ inline void Region(const mglData &x, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="")
669
+ { mgl_region_xy(gr, &x, &y1, &y2, pen, opt); }
670
+ /// Fill area (draw ribbon) between curves {x1,y1,z1} and {x2,y2,z2}
671
+ inline void Region(const mglData &x1, const mglData &y1, const mglData &z1, const mglData &x2, const mglData &y2, const mglData &z2, const char *pen="", const char *opt="")
672
+ { mgl_region_3d(gr, &x1, &y1, &z1, &x2, &y2, &z2, pen, opt); }
673
+ inline void Region(const mglData &x1, const mglData &y1, const mglData &x2, const mglData &y2, const char *pen="", const char *opt="")
674
+ { mgl_region_3d(gr, &x1, &y1, NULL, &x2, &y2, NULL, pen, opt); }
675
+ /// Draw vertical lines from points {x,y,z} to axis plane
676
+ inline void Stem(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="")
677
+ { mgl_stem_xyz(gr, &x, &y, &z, pen, opt); }
678
+ inline void Stem(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
679
+ { mgl_stem_xy(gr, &x, &y, pen, opt); }
680
+ inline void Stem(const mglData &y, const char *pen="", const char *opt="")
681
+ { mgl_stem(gr, &y, pen, opt); }
682
+
683
+ /// Draw vertical bars from points {x,y,z} to axis plane
684
+ inline void Bars(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="")
685
+ { mgl_bars_xyz(gr, &x, &y, &z, pen, opt); }
686
+ inline void Bars(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
687
+ { mgl_bars_xy(gr, &x, &y, pen, opt); }
688
+ inline void Bars(const mglData &y, const char *pen="", const char *opt="")
689
+ { mgl_bars(gr, &y, pen, opt); }
690
+ /// Draw horizontal bars from points {x,y} to axis plane
691
+ inline void Barh(const mglData &y, const mglData &v, const char *pen="", const char *opt="")
692
+ { mgl_barh_yx(gr, &y, &v, pen, opt); }
693
+ inline void Barh(const mglData &v, const char *pen="", const char *opt="")
694
+ { mgl_barh(gr, &v, pen, opt); }
695
+ /// Draw chart for data a
696
+ inline void Chart(const mglData &a, const char *colors="", const char *opt="")
697
+ { mgl_chart(gr, &a, colors,opt); }
698
+
699
+ /// Draw Open-High-Low-Close (OHLC) diagram
700
+ inline void OHLC(const mglData &x, const mglData &open, const mglData &high, const mglData &low, const mglData &close, const char *pen="", const char *opt="")
701
+ { mgl_ohlc_x(gr, &x, &open,&high,&low,&close,pen,opt); }
702
+ inline void OHLC(const mglData &open, const mglData &high, const mglData &low, const mglData &close, const char *pen="", const char *opt="")
703
+ { mgl_ohlc(gr, &open,&high,&low,&close,pen,opt); }
704
+
705
+ /// Draw box-plot (special 5-value plot used in statistic)
706
+ inline void BoxPlot(const mglData &x, const mglData &y, const char *pen="", const char *opt="")
707
+ { mgl_boxplot_xy(gr, &x, &y, pen,opt); }
708
+ inline void BoxPlot(const mglData &y, const char *pen="", const char *opt="")
709
+ { mgl_boxplot(gr, &y, pen,opt); }
710
+ /// Draw candle plot
711
+ inline void Candle(const mglData &x, const mglData &v1, const mglData &v2, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="")
712
+ { mgl_candle_xyv(gr, &x, &v1, &v2, &y1, &y2, pen, opt); }
713
+ inline void Candle(const mglData &v1, const mglData &v2, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="")
714
+ { mgl_candle_yv(gr, &v1, &v2, &y1, &y2, pen, opt); }
715
+ inline void Candle(const mglData &v1, const mglData &v2, const char *pen="", const char *opt="")
716
+ { mgl_candle_yv(gr, &v1, &v2, NULL, NULL, pen, opt); }
717
+ inline void Candle(const mglData &y, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="")
718
+ { mgl_candle(gr, &y, &y1, &y2, pen, opt); }
719
+ inline void Candle(const mglData &y, const char *pen="", const char *opt="")
720
+ { mgl_candle(gr, &y, NULL, NULL, pen, opt); }
721
+ /// Draw cones from points {x,y,z} to axis plane
722
+ inline void Cones(const mglData &x, const mglData &y, const mglData &z, const char *pen="@", const char *opt="")
723
+ { mgl_cones_xyz(gr, &x, &y, &z, pen, opt); }
724
+ inline void Cones(const mglData &x, const mglData &z, const char *pen="@", const char *opt="")
725
+ { mgl_cones_xz(gr, &x, &z, pen, opt); }
726
+ inline void Cones(const mglData &z, const char *pen="@", const char *opt="")
727
+ { mgl_cones(gr, &z, pen, opt); }
728
+
729
+ /// Draw error boxes {ex,ey} at points {x,y}
730
+ inline void Error(const mglData &y, const mglData &ey, const char *pen="", const char *opt="")
731
+ { mgl_error(gr, &y, &ey, pen, opt); }
732
+ inline void Error(const mglData &x, const mglData &y, const mglData &ey, const char *pen="", const char *opt="")
733
+ { mgl_error_xy(gr, &x, &y, &ey, pen, opt); }
734
+ inline void Error(const mglData &x, const mglData &y, const mglData &ex, const mglData &ey, const char *pen="", const char *opt="")
735
+ { mgl_error_exy(gr, &x, &y, &ex, &ey, pen, opt); }
736
+ /// Draw marks with size r at points {x,y,z}
737
+ inline void Mark(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *pen, const char *opt="")
738
+ { mgl_mark_xyz(gr, &x, &y, &z, &r, pen, opt); }
739
+ inline void Mark(const mglData &x, const mglData &y, const mglData &r, const char *pen, const char *opt="")
740
+ { mgl_mark_xy(gr, &x, &y, &r, pen, opt); }
741
+ inline void Mark(const mglData &y, const mglData &r, const char *pen, const char *opt="")
742
+ { mgl_mark_y(gr, &y, &r, pen, opt); }
743
+ /// Draw textual marks with size r at points {x,y,z}
744
+ inline void TextMark(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *text, const char *fnt="", const char *opt="")
745
+ { mgl_textmark_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); }
746
+ inline void TextMark(const mglData &x, const mglData &y, const mglData &r, const char *text, const char *fnt="", const char *opt="")
747
+ { mgl_textmark_xyr(gr, &x, &y, &r, text, fnt, opt); }
748
+ inline void TextMark(const mglData &y, const mglData &r, const char *text, const char *fnt="", const char *opt="")
749
+ { mgl_textmark_yr(gr, &y, &r, text, fnt, opt); }
750
+ inline void TextMark(const mglData &y, const char *text, const char *fnt="", const char *opt="")
751
+ { mgl_textmark(gr, &y, text, fnt, opt); }
752
+ inline void TextMark(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const wchar_t *text, const char *fnt="", const char *opt="")
753
+ { mgl_textmarkw_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); }
754
+ inline void TextMark(const mglData &x, const mglData &y, const mglData &r, const wchar_t *text, const char *fnt="", const char *opt="")
755
+ { mgl_textmarkw_xyr(gr, &x, &y, &r, text, fnt, opt); }
756
+ inline void TextMark(const mglData &y, const mglData &r, const wchar_t *text, const char *fnt="", const char *opt="")
757
+ { mgl_textmarkw_yr(gr, &y, &r, text, fnt, opt); }
758
+ inline void TextMark(const mglData &y, const wchar_t *text, const char *fnt="", const char *opt="")
759
+ { mgl_textmarkw(gr, &y, text, fnt, opt); }
760
+
761
+ /// Draw labels for points coordinate(s) at points {x,y,z}
762
+ inline void Label(const mglData &x, const mglData &y, const mglData &z, const char *text, const char *fnt="", const char *opt="")
763
+ { mgl_label_xyz(gr, &x, &y, &z, text, fnt, opt); }
764
+ inline void Label(const mglData &x, const mglData &y, const char *text, const char *fnt="", const char *opt="")
765
+ { mgl_label_xy(gr, &x, &y, text, fnt, opt); }
766
+ inline void Label(const mglData &y, const char *text, const char *fnt="", const char *opt="")
767
+ { mgl_label_y(gr, &y, text, fnt, opt); }
768
+ inline void Label(const mglData &x, const mglData &y, const mglData &z, const wchar_t *text, const char *fnt="", const char *opt="")
769
+ { mgl_labelw_xyz(gr, &x, &y, &z, text, fnt, opt); }
770
+ inline void Label(const mglData &x, const mglData &y, const wchar_t *text, const char *fnt="", const char *opt="")
771
+ { mgl_labelw_xy(gr, &x, &y, text, fnt, opt); }
772
+ inline void Label(const mglData &y, const wchar_t *text, const char *fnt="", const char *opt="")
773
+ { mgl_labelw_y(gr, &y, text, fnt, opt); }
774
+
775
+ /// Draw table for values val along given direction with row labels text
776
+ inline void Table(const mglData &val, const char *text, const char *fnt="#|", const char *opt="")
777
+ { mgl_table(gr, 0, 0, &val, text, fnt, opt); }
778
+ inline void Table(const mglData &val, const wchar_t *text, const char *fnt="#|", const char *opt="")
779
+ { mgl_tablew(gr, 0, 0, &val, text, fnt, opt); }
780
+ /// Draw table for values val along given direction with row labels text at given position
781
+ inline void Table(double x, double y, const mglData &val, const char *text, const char *fnt="#|", const char *opt="")
782
+ { mgl_table(gr, x, y, &val, text, fnt, opt); }
783
+ inline void Table(double x, double y, const mglData &val, const wchar_t *text, const char *fnt="#|", const char *opt="")
784
+ { mgl_tablew(gr, x, y, &val, text, fnt, opt); }
785
+
786
+ /// Draw tube with radius r around curve {x,y,z}
787
+ inline void Tube(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *pen="", const char *opt="")
788
+ { mgl_tube_xyzr(gr, &x, &y, &z, &r, pen, opt); }
789
+ inline void Tube(const mglData &x, const mglData &y, const mglData &z, double r, const char *pen="", const char *opt="")
790
+ { mgl_tube_xyz(gr, &x, &y, &z, r, pen, opt); }
791
+ inline void Tube(const mglData &x, const mglData &y, const mglData &r, const char *pen="", const char *opt="")
792
+ { mgl_tube_xyr(gr, &x, &y, &r, pen, opt); }
793
+ inline void Tube(const mglData &x, const mglData &y, double r, const char *pen="", const char *opt="")
794
+ { mgl_tube_xy(gr, &x, &y, r, pen, opt); }
795
+ inline void Tube(const mglData &y, const mglData &r, const char *pen="", const char *opt="")
796
+ { mgl_tube_r(gr, &y, &r, pen, opt); }
797
+ inline void Tube(const mglData &y, double r, const char *pen="", const char *opt="")
798
+ { mgl_tube(gr, &y, r, pen, opt); }
799
+ /// Draw surface of curve {r,z} rotatation around axis
800
+ inline void Torus(const mglData &r, const mglData &z, const char *pen="", const char *opt="")
801
+ { mgl_torus(gr, &r, &z, pen,opt); }
802
+
803
+ /// Draw mesh lines for 2d data specified parametrically
804
+ inline void Mesh(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
805
+ { mgl_mesh_xy(gr, &x, &y, &z, stl, opt); }
806
+ inline void Mesh(const mglData &z, const char *stl="", const char *opt="")
807
+ { mgl_mesh(gr, &z, stl, opt); }
808
+ /// Draw mesh lines for 2d data specified parametrically
809
+ inline void Fall(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
810
+ { mgl_fall_xy(gr, &x, &y, &z, stl, opt); }
811
+ inline void Fall(const mglData &z, const char *stl="", const char *opt="")
812
+ { mgl_fall(gr, &z, stl, opt); }
813
+ /// Draw belts for 2d data specified parametrically
814
+ inline void Belt(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
815
+ { mgl_belt_xy(gr, &x, &y, &z, stl, opt); }
816
+ inline void Belt(const mglData &z, const char *stl="", const char *opt="")
817
+ { mgl_belt(gr, &z, stl, opt); }
818
+ /// Draw surface for 2d data specified parametrically with color proportional to z
819
+ inline void Surf(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
820
+ { mgl_surf_xy(gr, &x, &y, &z, stl, opt); }
821
+ inline void Surf(const mglData &z, const char *stl="", const char *opt="")
822
+ { mgl_surf(gr, &z, stl, opt); }
823
+ /// Draw grid lines for density plot of 2d data specified parametrically
824
+ inline void Grid(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
825
+ { mgl_grid_xy(gr, &x, &y, &z, stl, opt); }
826
+ inline void Grid(const mglData &z, const char *stl="", const char *opt="")
827
+ { mgl_grid(gr, &z, stl, opt); }
828
+ /// Draw vertical tiles for 2d data specified parametrically
829
+ inline void Tile(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
830
+ { mgl_tile_xy(gr, &x, &y, &z, stl, opt); }
831
+ inline void Tile(const mglData &z, const char *stl="", const char *opt="")
832
+ { mgl_tile(gr, &z, stl, opt); }
833
+ /// Draw density plot for 2d data specified parametrically
834
+ inline void Dens(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
835
+ { mgl_dens_xy(gr, &x, &y, &z, stl, opt); }
836
+ inline void Dens(const mglData &z, const char *stl="", const char *opt="")
837
+ { mgl_dens(gr, &z, stl, opt); }
838
+ /// Draw vertical boxes for 2d data specified parametrically
839
+ inline void Boxs(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="")
840
+ { mgl_boxs_xy(gr, &x, &y, &z, stl, opt); }
841
+ inline void Boxs(const mglData &z, const char *stl="", const char *opt="")
842
+ { mgl_boxs(gr, &z, stl, opt); }
843
+
844
+ /// Draw contour lines for 2d data specified parametrically
845
+ inline void Cont(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
846
+ { mgl_cont_xy_val(gr, &v, &x, &y, &z, sch, opt); }
847
+ inline void Cont(const mglData &v, const mglData &z, const char *sch="", const char *opt="")
848
+ { mgl_cont_val(gr, &v, &z, sch, opt); }
849
+ inline void Cont(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
850
+ { mgl_cont_xy(gr, &x, &y, &z, sch, opt); }
851
+ inline void Cont(const mglData &z, const char *sch="", const char *opt="")
852
+ { mgl_cont(gr, &z, sch, opt); }
853
+ /// Draw solid contours for 2d data specified parametrically
854
+ inline void ContF(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
855
+ { mgl_contf_xy_val(gr, &v, &x, &y, &z, sch, opt); }
856
+ inline void ContF(const mglData &v, const mglData &z, const char *sch="", const char *opt="")
857
+ { mgl_contf_val(gr, &v, &z, sch, opt); }
858
+ inline void ContF(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
859
+ { mgl_contf_xy(gr, &x, &y, &z, sch, opt); }
860
+ inline void ContF(const mglData &z, const char *sch="", const char *opt="")
861
+ { mgl_contf(gr, &z, sch, opt); }
862
+ /// Draw solid contours for 2d data specified parametrically with manual colors
863
+ inline void ContD(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
864
+ { mgl_contd_xy_val(gr, &v, &x, &y, &z, sch, opt); }
865
+ inline void ContD(const mglData &v, const mglData &z, const char *sch="", const char *opt="")
866
+ { mgl_contd_val(gr, &v, &z, sch, opt); }
867
+ inline void ContD(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
868
+ { mgl_contd_xy(gr, &x, &y, &z, sch, opt); }
869
+ inline void ContD(const mglData &z, const char *sch="", const char *opt="")
870
+ { mgl_contd(gr, &z, sch, opt); }
871
+ /// Draw contour tubes for 2d data specified parametrically
872
+ inline void ContV(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
873
+ { mgl_contv_xy_val(gr, &v, &x, &y, &z, sch, opt); }
874
+ inline void ContV(const mglData &v, const mglData &z, const char *sch="", const char *opt="")
875
+ { mgl_contv_val(gr, &v, &z, sch, opt); }
876
+ inline void ContV(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
877
+ { mgl_contv_xy(gr, &x, &y, &z, sch, opt); }
878
+ inline void ContV(const mglData &z, const char *sch="", const char *opt="")
879
+ { mgl_contv(gr, &z, sch, opt); }
880
+
881
+ /// Draw axial-symmetric isosurfaces for 2d data specified parametrically
882
+ inline void Axial(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
883
+ { mgl_axial_xy_val(gr, &v, &x, &y, &z, sch,opt); }
884
+ inline void Axial(const mglData &v, const mglData &z, const char *sch="", const char *opt="")
885
+ { mgl_axial_val(gr, &v, &z, sch, opt); }
886
+ inline void Axial(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
887
+ { mgl_axial_xy(gr, &x, &y, &z, sch, opt); }
888
+ inline void Axial(const mglData &z, const char *sch="", const char *opt="")
889
+ { mgl_axial(gr, &z, sch, opt); }
890
+
891
+ /// Draw grid lines for density plot at slice for 3d data specified parametrically
892
+ inline void Grid3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", double sVal=-1, const char *opt="")
893
+ { mgl_grid3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); }
894
+ inline void Grid3(const mglData &a, const char *stl="", double sVal=-1, const char *opt="")
895
+ { mgl_grid3(gr, &a, stl, sVal, opt); }
896
+ /// Draw density plot at slice for 3d data specified parametrically
897
+ inline void Dens3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", double sVal=-1, const char *opt="")
898
+ { mgl_dens3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); }
899
+ inline void Dens3(const mglData &a, const char *stl="", double sVal=-1, const char *opt="")
900
+ { mgl_dens3(gr, &a, stl, sVal, opt); }
901
+
902
+ /// Draw isosurface(s) for 3d data specified parametrically
903
+ inline void Surf3(double Val, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", const char *opt="")
904
+ { mgl_surf3_xyz_val(gr, Val, &x, &y, &z, &a, stl, opt); }
905
+ inline void Surf3(double Val, const mglData &a, const char *stl="", const char *opt="")
906
+ { mgl_surf3_val(gr, Val, &a, stl, opt); }
907
+ inline void Surf3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", const char *opt="")
908
+ { mgl_surf3_xyz(gr, &x, &y, &z, &a, stl, opt); }
909
+ inline void Surf3(const mglData &a, const char *stl="", const char *opt="")
910
+ { mgl_surf3(gr, &a, stl, opt); }
911
+
912
+ /// Draw a semi-transparent cloud for 3d data
913
+ inline void Cloud(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", const char *opt="")
914
+ { mgl_cloud_xyz(gr, &x, &y, &z, &a, stl, opt); }
915
+ inline void Cloud(const mglData &a, const char *stl="", const char *opt="")
916
+ { mgl_cloud(gr, &a, stl, opt); }
917
+
918
+ /// Draw contour lines at slice for 3d data specified parametrically
919
+ inline void Cont3(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
920
+ { mgl_cont3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); }
921
+ inline void Cont3(const mglData &v, const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
922
+ { mgl_cont3_val(gr, &v, &a, sch, sVal, opt); }
923
+ inline void Cont3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
924
+ { mgl_cont3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); }
925
+ inline void Cont3(const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
926
+ { mgl_cont3(gr, &a, sch, sVal, opt); }
927
+
928
+ /// Draw solid contours at slice for 3d data specified parametrically
929
+ inline void ContF3(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
930
+ { mgl_contf3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); }
931
+ inline void ContF3(const mglData &v, const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
932
+ { mgl_contf3_val(gr, &v, &a, sch, sVal, opt); }
933
+ inline void ContF3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
934
+ { mgl_contf3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); }
935
+ inline void ContF3(const mglData &a, const char *sch="", double sVal=-1, const char *opt="")
936
+ { mgl_contf3(gr, &a, sch, sVal, opt); }
937
+
938
+ /// Draw several isosurfaces for 3d beam in curvilinear coordinates
939
+ inline void Beam(const mglData &tr, const mglData &g1, const mglData &g2, const mglData &a, double r, const char *stl=0, int flag=0, int num=3)
940
+ { mgl_beam(gr, &tr,&g1,&g2,&a,r,stl,flag,num); }
941
+ inline void Beam(double val, const mglData &tr, const mglData &g1, const mglData &g2, const mglData &a, double r, const char *stl=NULL, int flag=0)
942
+ { mgl_beam_val(gr,val,&tr,&g1,&g2,&a,r,stl,flag); }
943
+
944
+ /// Draw vertical tiles with variable size r for 2d data specified parametrically
945
+ inline void TileS(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *stl="", const char *opt="")
946
+ { mgl_tiles_xy(gr, &x, &y, &z, &r, stl, opt); }
947
+ inline void TileS(const mglData &z, const mglData &r, const char *stl="", const char *opt="")
948
+ { mgl_tiles(gr, &z, &r, stl, opt); }
949
+ /// Draw surface for 2d data specified parametrically with color proportional to c
950
+ inline void SurfC(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="")
951
+ { mgl_surfc_xy(gr, &x, &y, &z, &c, sch,opt); }
952
+ inline void SurfC(const mglData &z, const mglData &c, const char *sch="", const char *opt="")
953
+ { mgl_surfc(gr, &z, &c, sch,opt); }
954
+ /// Draw surface for 2d data specified parametrically with alpha proportional to c
955
+ inline void SurfA(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="")
956
+ { mgl_surfa_xy(gr, &x, &y, &z, &c, sch,opt); }
957
+ inline void SurfA(const mglData &z, const mglData &c, const char *sch="", const char *opt="")
958
+ { mgl_surfa(gr, &z, &c, sch,opt); }
959
+
960
+ /// Color map of matrix a to matrix b, both matrix can parametrically depend on coordinates
961
+ inline void Map(const mglData &x, const mglData &y, const mglData &a, const mglData &b, const char *sch="", const char *opt="")
962
+ { mgl_map_xy(gr, &x, &y, &a, &b, sch, opt); }
963
+ inline void Map(const mglData &a, const mglData &b, const char *sch="", const char *opt="")
964
+ { mgl_map(gr, &a, &b, sch, opt); }
965
+ /// Draw density plot for spectra-gramm specified parametrically
966
+ inline void STFA(const mglData &x, const mglData &y, const mglData &re, const mglData &im, int dn, const char *sch="", const char *opt="")
967
+ { mgl_stfa_xy(gr, &x, &y, &re, &im, dn, sch, opt); }
968
+ inline void STFA(const mglData &re, const mglData &im, int dn, const char *sch="", const char *opt="")
969
+ { mgl_stfa(gr, &re, &im, dn, sch, opt); }
970
+
971
+ /// Draw isosurface(s) for 3d data specified parametrically with alpha proportional to b
972
+ inline void Surf3A(double Val, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *stl="", const char *opt="")
973
+ { mgl_surf3a_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl, opt); }
974
+ inline void Surf3A(double Val, const mglData &a, const mglData &b, const char *stl="", const char *opt="")
975
+ { mgl_surf3a_val(gr, Val, &a, &b, stl, opt); }
976
+ inline void Surf3A(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *stl="", const char *opt="")
977
+ { mgl_surf3a_xyz(gr, &x, &y, &z, &a, &b, stl, opt); }
978
+ inline void Surf3A(const mglData &a, const mglData &b, const char *stl="", const char *opt="")
979
+ { mgl_surf3a(gr, &a, &b, stl, opt); }
980
+
981
+ /// Draw isosurface(s) for 3d data specified parametrically with color proportional to b
982
+ inline void Surf3C(double Val, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *stl="", const char *opt="")
983
+ { mgl_surf3c_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl,opt); }
984
+ inline void Surf3C(double Val, const mglData &a, const mglData &b, const char *stl="", const char *opt="")
985
+ { mgl_surf3c_val(gr, Val, &a, &b, stl, opt); }
986
+ inline void Surf3C(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *stl="", const char *opt="")
987
+ { mgl_surf3c_xyz(gr, &x, &y, &z, &a, &b, stl, opt); }
988
+ inline void Surf3C(const mglData &a, const mglData &b, const char *stl="", const char *opt="")
989
+ { mgl_surf3c(gr, &a, &b, stl, opt); }
990
+
991
+ /// Plot dew drops for vector field {ax,ay} parametrically depended on coordinate {x,y}
992
+ inline void Dew(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
993
+ { mgl_dew_xy(gr, &x, &y, &ax, &ay, sch, opt); }
994
+ inline void Dew(const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
995
+ { mgl_dew_2d(gr, &ax, &ay, sch, opt); }
996
+ /// Plot vectors at position {x,y,z} along {ax,ay,az} with length/color proportional to |a|
997
+ inline void Traj(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
998
+ { mgl_traj_xy(gr, &x, &y, &ax, &ay, sch, opt); }
999
+ inline void Traj(const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1000
+ { mgl_traj_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }
1001
+
1002
+ /// Plot vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with length/color proportional to |a|
1003
+ inline void Vect(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
1004
+ { mgl_vect_xy(gr, &x, &y, &ax, &ay, sch, opt); }
1005
+ inline void Vect(const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
1006
+ { mgl_vect_2d(gr, &ax, &ay, sch, opt); }
1007
+ inline void Vect(const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1008
+ { mgl_vect_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }
1009
+ inline void Vect(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1010
+ { mgl_vect_3d(gr, &ax, &ay, &az, sch, opt); }
1011
+
1012
+ /// Draw vector plot at slice for 3d data specified parametrically
1013
+ inline void Vect3(const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *stl="", double sVal=-1, const char *opt="")
1014
+ { mgl_vect3_xyz(gr, &x, &y, &z, &ax,&ay,&az, stl, sVal, opt); }
1015
+ inline void Vect3(const mglData &ax, const mglData &ay, const mglData &az, const char *stl="", double sVal=-1, const char *opt="")
1016
+ { mgl_vect3(gr, &ax,&ay,&az, stl, sVal, opt); }
1017
+
1018
+ /// Plot flows for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color proportional to |a|
1019
+ inline void Flow(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
1020
+ { mgl_flow_xy(gr, &x, &y, &ax, &ay, sch, opt); }
1021
+ inline void Flow(const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
1022
+ { mgl_flow_2d(gr, &ax, &ay, sch, opt); }
1023
+ inline void Flow(const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1024
+ { mgl_flow_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); }
1025
+ inline void Flow(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1026
+ { mgl_flow_3d(gr, &ax, &ay, &az, sch, opt); }
1027
+
1028
+ /// Plot flow from point p for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color proportional to |a|
1029
+ inline void FlowP(mglPoint p, const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
1030
+ { mgl_flowp_xy(gr, p.x, p.y, p.z, &x, &y, &ax, &ay, sch, opt); }
1031
+ inline void FlowP(mglPoint p, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="")
1032
+ { mgl_flowp_2d(gr, p.x, p.y, p.z, &ax, &ay, sch, opt); }
1033
+ inline void FlowP(mglPoint p, const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1034
+ { mgl_flowp_xyz(gr, p.x, p.y, p.z, &x, &y, &z, &ax, &ay, &az, sch, opt); }
1035
+ inline void FlowP(mglPoint p, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="")
1036
+ { mgl_flowp_3d(gr, p.x, p.y, p.z, &ax, &ay, &az, sch, opt); }
1037
+
1038
+ /// Plot flows for gradient of scalar field phi parametrically depended on coordinate {x,y,z}
1039
+ inline void Grad(const mglData &x, const mglData &y, const mglData &z, const mglData &phi, const char *sch="", const char *opt="")
1040
+ { mgl_grad_xyz(gr,&x,&y,&z,&phi,sch,opt); }
1041
+ inline void Grad(const mglData &x, const mglData &y, const mglData &phi, const char *sch="", const char *opt="")
1042
+ { mgl_grad_xy(gr,&x,&y,&phi,sch,opt); }
1043
+ inline void Grad(const mglData &phi, const char *sch="", const char *opt="")
1044
+ { mgl_grad(gr,&phi,sch,opt); }
1045
+
1046
+ /// Plot flow pipes for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color and radius proportional to |a|
1047
+ inline void Pipe(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", double r0=0.05, const char *opt="")
1048
+ { mgl_pipe_xy(gr, &x, &y, &ax, &ay, sch, r0, opt); }
1049
+ inline void Pipe(const mglData &ax, const mglData &ay, const char *sch="", double r0=0.05, const char *opt="")
1050
+ { mgl_pipe_2d(gr, &ax, &ay, sch, r0, opt); }
1051
+ inline void Pipe(const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", double r0=0.05, const char *opt="")
1052
+ { mgl_pipe_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, r0, opt); }
1053
+ inline void Pipe(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", double r0=0.05, const char *opt="")
1054
+ { mgl_pipe_3d(gr, &ax, &ay, &az, sch, r0, opt); }
1055
+
1056
+ /// Draw density plot for data at x = sVal
1057
+ inline void DensX(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1058
+ { mgl_dens_x(gr, &a, stl, sVal, opt); }
1059
+ /// Draw density plot for data at y = sVal
1060
+ inline void DensY(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1061
+ { mgl_dens_y(gr, &a, stl, sVal, opt); }
1062
+ /// Draw density plot for data at z = sVal
1063
+ inline void DensZ(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1064
+ { mgl_dens_z(gr, &a, stl, sVal, opt); }
1065
+ /// Draw contour lines for data at x = sVal
1066
+ inline void ContX(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1067
+ { mgl_cont_x(gr, &a, stl, sVal, opt); }
1068
+ inline void ContX(const mglData &v, const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1069
+ { mgl_cont_x_val(gr, &v, &a, stl, sVal, opt); }
1070
+ /// Draw contour lines for data at y = sVal
1071
+ inline void ContY(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1072
+ { mgl_cont_y(gr, &a, stl, sVal, opt); }
1073
+ inline void ContY(const mglData &v, const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1074
+ { mgl_cont_y_val(gr, &v, &a, stl, sVal, opt); }
1075
+ /// Draw contour lines for data at z = sVal
1076
+ inline void ContZ(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1077
+ { mgl_cont_z(gr, &a, stl, sVal, opt); }
1078
+ inline void ContZ(const mglData &v, const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1079
+ { mgl_cont_z_val(gr, &v, &a, stl, sVal, opt); }
1080
+ /// Draw solid contours for data at x = sVal
1081
+ inline void ContFX(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1082
+ { mgl_contf_x(gr, &a, stl, sVal, opt); }
1083
+ inline void ContFX(const mglData &v, const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1084
+ { mgl_contf_x_val(gr, &v, &a, stl, sVal, opt); }
1085
+ /// Draw solid contours for data at y = sVal
1086
+ inline void ContFY(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1087
+ { mgl_contf_y(gr, &a, stl, sVal, opt); }
1088
+ inline void ContFY(const mglData &v, const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1089
+ { mgl_contf_y_val(gr, &v, &a, stl, sVal, opt); }
1090
+ /// Draw solid contours for data at z = sVal
1091
+ inline void ContFZ(const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1092
+ { mgl_contf_z(gr, &a, stl, sVal, opt); }
1093
+ inline void ContFZ(const mglData &v, const mglData &a, const char *stl="", double sVal=NaN, const char *opt="")
1094
+ { mgl_contf_z_val(gr, &v, &a, stl, sVal, opt); }
1095
+
1096
+ /// Draw curve for formula with x in x-axis range
1097
+ inline void FPlot(const char *fy, const char *stl="", const char *opt="")
1098
+ { mgl_fplot(gr, fy, stl, opt); }
1099
+ /// Draw curve for formulas parametrically depended on t in range [0,1]
1100
+ inline void FPlot(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="")
1101
+ { mgl_fplot_xyz(gr, fx, fy, fz, stl, opt); }
1102
+ /// Draw surface by formula with x,y in axis range
1103
+ inline void FSurf(const char *fz, const char *stl="", const char *opt="")
1104
+ { mgl_fsurf(gr, fz, stl, opt); }
1105
+ /// Draw surface by formulas parametrically depended on u,v in range [0,1]
1106
+ inline void FSurf(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="")
1107
+ { mgl_fsurf_xyz(gr, fx, fy, fz, stl, opt); }
1108
+
1109
+ /// Draw triangle mesh for points in arrays {x,y,z} with specified color c.
1110
+ inline void TriPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="")
1111
+ { mgl_triplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); }
1112
+ inline void TriPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1113
+ { mgl_triplot_xyz(gr, &nums, &x, &y, &z, sch, opt); }
1114
+ inline void TriPlot(const mglData &nums, const mglData &x, const mglData &y, const char *sch="", const char *opt="")
1115
+ { mgl_triplot_xy(gr, &nums, &x, &y, sch, opt); }
1116
+ /// Draw quad mesh for points in arrays {x,y,z} with specified color c.
1117
+ inline void QuadPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="")
1118
+ { mgl_quadplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); }
1119
+ inline void QuadPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1120
+ { mgl_quadplot_xyz(gr, &nums, &x, &y, &z, sch, opt); }
1121
+ inline void QuadPlot(const mglData &nums, const mglData &x, const mglData &y, const char *sch="", const char *opt="")
1122
+ { mgl_quadplot_xy(gr, &nums, &x, &y, sch, opt); }
1123
+
1124
+ /// Draw contour lines for triangle mesh for points in arrays {x,y,z} with specified color c.
1125
+ inline void TriCont(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1126
+ { mgl_tricont_xyc(gr, &nums, &x, &y, &z, sch, opt); }
1127
+ inline void TriContV(const mglData &v, const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1128
+ { mgl_tricont_xycv(gr, &v, &nums, &x, &y, &z, sch, opt); }
1129
+ inline void TriCont(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="")
1130
+ { mgl_tricont_xyzc(gr, &nums, &x, &y, &z, &a, sch, opt); }
1131
+ inline void TriContV(const mglData &v, const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="")
1132
+ { mgl_tricont_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); }
1133
+ inline void TriCont(const mglData &v, const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="")
1134
+ { mgl_tricont_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); }
1135
+
1136
+ /// Draw contour tubes for triangle mesh for points in arrays {x,y,z} with specified color c.
1137
+ inline void TriContVt(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1138
+ { mgl_tricontv_xyc(gr, &nums, &x, &y, &z, sch, opt); }
1139
+ inline void TriContVt(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="")
1140
+ { mgl_tricontv_xyzc(gr, &nums, &x, &y, &z, &a, sch, opt); }
1141
+ inline void TriContVt(const mglData &v, const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="")
1142
+ { mgl_tricontv_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); }
1143
+
1144
+ /// Draw dots in points {x,y,z}.
1145
+ inline void Dots(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1146
+ { mgl_dots(gr, &x, &y, &z, sch, opt); }
1147
+ /// Draw semitransparent dots in points {x,y,z} with specified alpha a.
1148
+ inline void Dots(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="")
1149
+ { mgl_dots_a(gr, &x, &y, &z, &a, sch, opt); }
1150
+ /// Draw semitransparent dots in points {x,y,z} with specified color c and alpha a.
1151
+ inline void Dots(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const mglData &a, const char *sch="", const char *opt="")
1152
+ { mgl_dots_ca(gr, &x, &y, &z, &c, &a, sch, opt); }
1153
+ /// Draw surface reconstructed for points in arrays {x,y,z}.
1154
+ inline void Crust(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="")
1155
+ { mgl_crust(gr, &x, &y, &z, sch, opt); }
1156
+
1157
+ /// Fit data along x-direction for each data row. Return array with values for found formula.
1158
+ inline mglData Fit(const mglData &y, const char *eq, const char *var, const char *opt="")
1159
+ { return mglData(true,mgl_fit_1(gr, &y, eq,var,0, opt)); }
1160
+ inline mglData Fit(const mglData &y, const char *eq, const char *var, mglData &ini, const char *opt="")
1161
+ { return mglData(true,mgl_fit_1(gr, &y, eq, var, &ini, opt)); }
1162
+ /// Fit data along x-, y-directions for each data slice. Return array with values for found formula.
1163
+ inline mglData Fit2(const mglData &z, const char *eq, const char *var, const char *opt="")
1164
+ { return mglData(true,mgl_fit_2(gr, &z, eq, var,0, opt)); }
1165
+ inline mglData Fit2(const mglData &z, const char *eq, const char *var, mglData &ini, const char *opt="")
1166
+ { return mglData(true,mgl_fit_2(gr, &z, eq, var, &ini, opt)); }
1167
+ /// Fit data along along all directions. Return array with values for found formula.
1168
+ inline mglData Fit3(const mglData &a, const char *eq, const char *var, const char *opt="")
1169
+ { return mglData(true,mgl_fit_3(gr, &a, eq, var,0, opt)); }
1170
+ inline mglData Fit3(const mglData &a, const char *eq, const char *var, mglData &ini, const char *opt="")
1171
+ { return mglData(true,mgl_fit_3(gr, &a, eq, var, &ini, opt)); }
1172
+ /// Fit data along x-direction for each data row. Return array with values for found formula.
1173
+ inline mglData Fit(const mglData &x, const mglData &y, const char *eq, const char *var, const char *opt="")
1174
+ { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, var,0, opt)); }
1175
+ inline mglData Fit(const mglData &x, const mglData &y, const char *eq, const char *var, mglData &ini, const char *opt="")
1176
+ { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, var, &ini, opt)); }
1177
+ /// Fit data along x-, y-directions for each data slice. Return array with values for found formula.
1178
+ inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const char *eq, const char *var, const char *opt="")
1179
+ { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, var,0, opt)); }
1180
+ inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const char *eq, const char *var, mglData &ini, const char *opt="")
1181
+ { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, var, &ini, opt)); }
1182
+ /// Fit data along along all directions. Return array with values for found formula.
1183
+ inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *eq, const char *var, const char *opt="")
1184
+ { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq, var,0, opt)); }
1185
+ inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *eq, const char *var, mglData &ini, const char *opt="")
1186
+ { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq,var, &ini, opt)); }
1187
+ /// Fit data with dispersion s along x-direction for each data row. Return array with values for found formula.
1188
+ inline mglData FitS(const mglData &y, const mglData &s, const char *eq, const char *var, const char *opt="")
1189
+ { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, var,0, opt)); }
1190
+ inline mglData FitS(const mglData &y, const mglData &s, const char *eq, const char *var, mglData &ini, const char *opt="")
1191
+ { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, var, &ini, opt)); }
1192
+ inline mglData FitS(const mglData &x, const mglData &y, const mglData &s, const char *eq, const char *var, const char *opt="")
1193
+ { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, var,0, opt)); }
1194
+ inline mglData FitS(const mglData &x, const mglData &y, const mglData &s, const char *eq, const char *var, mglData &ini, const char *opt="")
1195
+ { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, var, &ini, opt)); }
1196
+ /// Fit data with dispersion s along x-, y-directions for each data slice. Return array with values for found formula.
1197
+ inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &s, const char *eq, const char *var, const char *opt="")
1198
+ { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, var,0, opt)); }
1199
+ inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &s, const char *eq, const char *var, mglData &ini, const char *opt="")
1200
+ { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, var, &ini, opt)); }
1201
+ /// Fit data with dispersion s along all directions. Return array with values for found formula.
1202
+ inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &s, const char *eq, const char *var, const char *opt="")
1203
+ { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, var,0, opt)); }
1204
+ inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &s, const char *eq, const char *var, mglData &ini, const char *opt="")
1205
+ { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, var, &ini, opt)); }
1206
+ /// Print fitted last formula (with coefficients)
1207
+ inline void PutsFit(mglPoint p, const char *prefix=0, const char *font="", double size=-1)
1208
+ { mgl_puts_fit(gr, p.x, p.y, p.z, prefix, font, size); }
1209
+ /// Get last fitted formula
1210
+ inline const char *GetFit()
1211
+ { return mgl_get_fit(gr); }
1212
+
1213
+ /// Solve PDE with x,y,z in range [Min, Max]
1214
+ inline mglData PDE(const char *ham, const mglData &ini_re, const mglData &ini_im, double dz=0.1, double k0=100, const char *opt="")
1215
+ { return mglData(true,mgl_pde_solve(gr,ham,&ini_re,&ini_im,dz,k0, opt)); }
1216
+ /// Fill data by formula with x,y,z in range [Min, Max]
1217
+ inline void Fill(mglData &u, const char *eq, const char *opt="")
1218
+ { mgl_data_fill_eq(gr, &u, eq, 0, 0, opt); }
1219
+ inline void Fill(mglData &u, const char *eq, const mglData &v, const char *opt="")
1220
+ { mgl_data_fill_eq(gr, &u, eq, &v, 0, opt); }
1221
+ inline void Fill(mglData &u, const char *eq, const mglData &v, const mglData &w, const char *opt="")
1222
+ { mgl_data_fill_eq(gr, &u, eq, &v, &w, opt); }
1223
+ /// Fill data by formula with x,y,z in range [Min, Max]
1224
+ inline void Fill(mglDataC &u, const char *eq, const char *opt="")
1225
+ { mgl_datac_fill_eq(gr, &u, eq, 0, 0, opt); }
1226
+ inline void Fill(mglDataC &u, const char *eq, const mglData &v, const char *opt="")
1227
+ { mgl_datac_fill_eq(gr, &u, eq, &v, 0, opt); }
1228
+ inline void Fill(mglDataC &u, const char *eq, const mglData &v, const mglData &w, const char *opt="")
1229
+ { mgl_datac_fill_eq(gr, &u, eq, &v, &w, opt); }
1230
+
1231
+ /// Fill dat by interpolated values of vdat parametrically depended on xdat,ydat,zdat for x,y,z in axis range
1232
+ inline void Refill(mglData &dat, const mglData &xdat, const mglData &vdat, long sl=-1, const char *opt="")
1233
+ { mgl_data_refill_gr(gr,&dat,&xdat,0,0,&vdat,sl,opt); }
1234
+ inline void Refill(mglData &dat, const mglData &xdat, const mglData &ydat, const mglData &vdat, long sl=-1, const char *opt="")
1235
+ { mgl_data_refill_gr(gr,&dat,&xdat,&ydat,0,&vdat,sl,opt); }
1236
+ inline void Refill(mglData &dat, const mglData &xdat, const mglData &ydat, const mglData &zdat, const mglData &vdat, const char *opt="")
1237
+ { mgl_data_refill_gr(gr,&dat,&xdat,&ydat,&zdat,&vdat,-1,opt); }
1238
+
1239
+ /// Set the data by triangulated surface values assuming x,y,z in range [Min, Max]
1240
+ inline void DataGrid(mglData &d, const mglData &x, const mglData &y, const mglData &z, const char *opt="")
1241
+ { mgl_data_grid(gr,&d,&x,&y,&z,opt); }
1242
+
1243
+ /// Make histogram (distribution) of data. This function do not plot data.
1244
+ inline mglData Hist(const mglData &x, const mglData &a, const char *opt="")
1245
+ { return mglData(true, mgl_hist_x(gr, &x, &a, opt)); }
1246
+ inline mglData Hist(const mglData &x, const mglData &y, const mglData &a, const char *opt="")
1247
+ { return mglData(true, mgl_hist_xy(gr, &x, &y, &a, opt)); }
1248
+ inline mglData Hist(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *opt="")
1249
+ { return mglData(true, mgl_hist_xyz(gr, &x, &y, &z, &a, opt)); }
1250
+
1251
+ inline void Compression(bool){} // NOTE: Add later -- IDTF
1252
+ /// Set the preference for vertex color on/off (for formats that support it, now only PRC does).
1253
+ inline void VertexColor(bool enable) { mgl_set_flag(gr,enable, MGL_PREFERVC); }
1254
+ /// Render only front side of surfaces for dubugging purposes (for formats that support it, now only PRC does).
1255
+ inline void DoubleSided(bool enable) { mgl_set_flag(gr,!enable, MGL_ONESIDED); }
1256
+ // inline void TextureColor(bool){} // NOTE: Add later -- IDTF
1257
+ };
1258
+ //-----------------------------------------------------------------------------
1259
+ /// Wrapper class for MGL parsing
1260
+ class mglParse
1261
+ {
1262
+ HMPR pr;
1263
+ public:
1264
+ mglParse(HMPR p) { pr = p; mgl_use_parser(pr,1); }
1265
+ mglParse(mglParse &p) { pr = p.pr; mgl_use_parser(pr,1); }
1266
+ mglParse(bool setsize=false)
1267
+ { pr=mgl_create_parser(); mgl_parser_allow_setsize(pr, setsize); }
1268
+ ~mglParse() { if(mgl_use_parser(pr,-1)<1) mgl_delete_parser(pr); }
1269
+ /// Get pointer to internal mglParser object
1270
+ inline HMPR Self() { return pr; }
1271
+ /// Parse and draw single line of the MGL script
1272
+ inline int Parse(mglGraph *gr, const char *str, int pos)
1273
+ { return mgl_parse_line(gr->Self(), pr, str, pos); }
1274
+ inline int Parse(mglGraph *gr, const wchar_t *str, int pos)
1275
+ { return mgl_parse_linew(gr->Self(), pr, str, pos); }
1276
+ /// Execute MGL script text with '\n' separated lines
1277
+ inline void Execute(mglGraph *gr, const char *str)
1278
+ { mgl_parse_text(gr->Self(), pr, str); }
1279
+ inline void Execute(mglGraph *gr, const wchar_t *str)
1280
+ { mgl_parse_textw(gr->Self(), pr, str); }
1281
+ /// Execute and draw script from the file
1282
+ inline void Execute(mglGraph *gr, FILE *fp, bool print=false)
1283
+ { mgl_parse_file(gr->Self(), pr, fp, print); }
1284
+
1285
+ /// Return type of command: 0 - not found, 1 - other data plot, 2 - func plot,
1286
+ /// 3 - setup, 4 - data handle, 5 - data create, 6 - subplot, 7 - program
1287
+ /// 8 - 1d plot, 9 - 2d plot, 10 - 3d plot, 11 - dd plot, 12 - vector plot
1288
+ /// 13 - axis, 14 - primitives, 15 - axis setup, 16 - text/legend, 17 - data transform
1289
+ inline int CmdType(const char *name)
1290
+ { return mgl_parser_cmd_type(pr, name); }
1291
+ /// Return string of command format (command name and its argument[s])
1292
+ inline const char *CmdFormat(const char *name)
1293
+ { return mgl_parser_cmd_frmt(pr, name); }
1294
+ /// Return description of MGL command
1295
+ inline const char *CmdDesc(const char *name)
1296
+ { return mgl_parser_cmd_desc(pr, name); }
1297
+ /// Get name of command with nmber n
1298
+ inline const char *GetCmdName(long n)
1299
+ { return mgl_parser_cmd_name(pr,n); }
1300
+ /// Get number of defined commands
1301
+ inline long GetCmdNum()
1302
+ { return mgl_parser_cmd_num(pr); }
1303
+
1304
+ /// Set value for parameter $N
1305
+ inline void AddParam(int id, const char *str)
1306
+ { mgl_parser_add_param(pr, id, str); }
1307
+ inline void AddParam(int id, const wchar_t *str)
1308
+ { mgl_parser_add_paramw(pr, id, str); }
1309
+ /// Restore once flag
1310
+ inline void RestoreOnce() { mgl_parser_restore_once(pr); }
1311
+ /// Allow changing size of the picture
1312
+ inline void AllowSetSize(bool allow) { mgl_parser_allow_setsize(pr, allow); }
1313
+ /// Allow reading/saving files
1314
+ inline void AllowFileIO(bool allow) { mgl_parser_allow_file_io(pr, allow); }
1315
+ /// Set flag to stop script parsing
1316
+ inline void Stop() { mgl_parser_stop(pr); }
1317
+
1318
+ /// Return result of formula evaluation
1319
+ inline mglData Calc(const char *formula)
1320
+ { return mglData(true,mgl_parser_calc(pr,formula)); }
1321
+ inline mglData Calc(const wchar_t *formula)
1322
+ { return mglData(true,mgl_parser_calcw(pr,formula)); }
1323
+
1324
+ /// Find variable with given name or add a new one
1325
+ /// NOTE !!! You must not delete obtained data arrays !!!
1326
+ inline mglData *AddVar(const char *name)
1327
+ { return mgl_parser_add_var(pr, name); }
1328
+ inline mglData *AddVar(const wchar_t *name)
1329
+ { return mgl_parser_add_varw(pr, name); }
1330
+ /// Find variable with given name or return NULL if no one
1331
+ /// NOTE !!! You must not delete obtained data arrays !!!
1332
+ inline mglData *FindVar(const char *name)
1333
+ { return mgl_parser_find_var(pr, name); }
1334
+ inline mglData *FindVar(const wchar_t *name)
1335
+ { return mgl_parser_find_varw(pr, name); }
1336
+ /// Get variable with given id. Can be NULL for temporary ones.
1337
+ /// NOTE !!! You must not delete obtained data arrays !!!
1338
+ inline mglData *GetVar(unsigned long id)
1339
+ { return mgl_parser_get_var(pr,id); }
1340
+ /// Get number of variables
1341
+ inline long GetNumVar()
1342
+ { return mgl_parser_num_var(pr); }
1343
+ /// Delete variable with name
1344
+ inline void DeleteVar(const char *name) { mgl_parser_del_var(pr, name); }
1345
+ inline void DeleteVar(const wchar_t *name) { mgl_parser_del_varw(pr, name); }
1346
+ /// Delete all data variables
1347
+ void DeleteAll() { mgl_parser_del_all(pr); }
1348
+ };
1349
+ //-----------------------------------------------------------------------------