1 /*************************************************************************** 2 * mgl.h is part of Math Graphic Library 3 * Copyright (C) 2007-2016 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 { mglGraph(const mglGraph &)24 mglGraph(const mglGraph &) {gr=0;} // copying is not allowed 25 const mglGraph &operator=(const mglGraph &t) { gr=0; return t; } 26 protected: 27 HMGL gr; 28 public: 29 HMPR pr; ///< Pointer to associated MGL parser 30 mglGraph(int kind=-1) 31 { pr = NULL; 32 if(kind==0) gr=mgl_create_graph(600, 400); 33 #if MGL_HAVE_OPENGL 34 else if(kind==1) gr=mgl_create_graph_gl(); 35 #else 36 else if(kind==1) 37 { gr=mgl_default_graph(); mgl_use_graph(gr,1); 38 SetGlobalWarn("OpenGL support was disabled. Please, enable it and rebuild MathGL."); } 39 #endif 40 else { gr=mgl_default_graph(); mgl_use_graph(gr,1); } 41 } mglGraph(int kind,int width,int height)42 mglGraph(int kind, int width, int height) 43 { pr = NULL; 44 if(kind==0) gr=mgl_create_graph(width, height); 45 #if MGL_HAVE_OPENGL 46 else if(kind==1) gr=mgl_create_graph_gl(); 47 #else 48 else if(kind==1) 49 { gr=mgl_default_graph(); mgl_use_graph(gr,1); 50 SetGlobalWarn("OpenGL support was disabled. Please, enable it and rebuild MathGL."); } 51 #endif 52 else { gr=mgl_default_graph(); mgl_use_graph(gr,1); mgl_set_size(gr,width,height); } 53 } mglGraph(HMGL graph)54 mglGraph(HMGL graph) 55 { pr = NULL; gr = graph; mgl_use_graph(gr,1); } ~mglGraph()56 virtual ~mglGraph() 57 { if(mgl_use_graph(gr,-1)<1) mgl_delete_graph(gr); } 58 /// Get pointer to internal HMGL object Self()59 inline HMGL Self() { return gr; } 60 /// Set default parameters for plotting DefaultPlotParam()61 inline void DefaultPlotParam() { mgl_set_def_param(gr); } 62 /// Set name of plot for saving filename SetPlotId(const char * id)63 inline void SetPlotId(const char *id) { mgl_set_plotid(gr,id); } 64 /// Get name of plot for saving filename GetPlotId()65 inline const char *GetPlotId() { return mgl_get_plotid(gr); } 66 67 /// Ask to stop drawing 68 inline void Stop(bool stop=true) { mgl_ask_stop(gr, stop); } 69 /// Check if plot termination is asked NeedStop()70 inline bool NeedStop() { return mgl_need_stop(gr); } 71 72 /// Set the transparency on/off. Alpha(bool enable)73 inline void Alpha(bool enable) { mgl_set_alpha(gr, enable); } 74 /// Set the gray-scale mode on/off. Gray(bool enable)75 inline void Gray(bool enable) { mgl_set_gray(gr, enable); } 76 /// Set default value of alpha-channel SetAlphaDef(double alpha)77 inline void SetAlphaDef(double alpha) { mgl_set_alpha_default(gr, alpha); } 78 /// Set the transparency type (0 - usual, 1 - glass, 2 - lamp) SetTranspType(int type)79 inline void SetTranspType(int type) { mgl_set_transp_type(gr, type); } 80 /// Set the size of semi-transparent area around lines, marks, glyphs, ... Default is 1. SetPenDelta(double d)81 inline void SetPenDelta(double d) { mgl_pen_delta(gr,d); } 82 83 /// Set the using of light on/off. Light(bool enable)84 inline void Light(bool enable) { mgl_set_light(gr, enable); } 85 /// Switch on/off the specified light source. Light(int n,bool enable)86 inline void Light(int n,bool enable) { mgl_set_light_n(gr, n, enable); } 87 /// Use diffusive light (only for local light sources) -- OBSOLETE SetDifLight(bool dif)88 inline void SetDifLight(bool dif) { mgl_set_light_dif(gr, dif); } 89 /// Set to attach light settings to inplot. AttachLight(bool enable)90 inline void AttachLight(bool enable) { mgl_set_attach_light(gr, enable); } 91 /// Add a light source. 92 inline void AddLight(int n, mglPoint p, char col='w', double bright=0.5, double ap=0) 93 { mgl_add_light_ext(gr, n, p.x, p.y, p.z, col, bright, ap); } 94 inline void AddLight(int n, mglPoint r, mglPoint p, char col='w', double bright=0.5, double ap=0) 95 { mgl_add_light_loc(gr, n, r.x, r.y, r.z, p.x, p.y, p.z, col, bright, ap); } 96 /// Set ambient light brightness SetAmbient(double i)97 inline void SetAmbient(double i) { mgl_set_ambbr(gr, i); } 98 /// Set diffusive light brightness SetDiffuse(double i)99 inline void SetDiffuse(double i) { mgl_set_difbr(gr, i); } 100 /// Set the fog distance or switch it off (if d=0). 101 inline void Fog(double d, double dz=0.25) { mgl_set_fog(gr, d, dz); } 102 103 /// Set relative width of rectangles in Bars, Barh, BoxPlot, Candle, OHLC (default is 0.7) SetBarWidth(double width)104 inline void SetBarWidth(double width) { mgl_set_bar_width(gr, width); } 105 /// Set default size of marks (locally you can use "size" option) SetMarkSize(double size)106 inline void SetMarkSize(double size) { mgl_set_mark_size(gr, size); } 107 /// Set default size of arrows (locally you can use "size" option) SetArrowSize(double size)108 inline void SetArrowSize(double size) { mgl_set_arrow_size(gr, size); } 109 /// Set number of mesh lines (use 0 to draw all of them) SetMeshNum(int num)110 inline void SetMeshNum(int num) { mgl_set_meshnum(gr, num); } 111 /// Set number of visible faces (use 0 to draw all of them) SetFaceNum(int num)112 inline void SetFaceNum(int num) { mgl_set_facenum(gr, num); } 113 /// Set TeX parsing at text drawing SetTeXparse(bool val)114 inline void SetTeXparse(bool val) { mgl_set_tex_parse(gr, val); } 115 116 /// Set cutting for points outside of bounding box SetCut(bool cut)117 inline void SetCut(bool cut) { mgl_set_cut(gr, cut); } 118 /// Set additional cutting box SetCutBox(mglPoint p1,mglPoint p2)119 inline void SetCutBox(mglPoint p1, mglPoint p2) 120 { mgl_set_cut_box(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z); } 121 /// Set the cutting off condition (formula) CutOff(const char * EqC)122 inline void CutOff(const char *EqC) { mgl_set_cutoff(gr, EqC); } 123 124 /// Set default font size SetFontSize(double size)125 inline void SetFontSize(double size) { mgl_set_font_size(gr, size); } 126 /// Set default font style and color SetFontDef(const char * fnt)127 inline void SetFontDef(const char *fnt) { mgl_set_font_def(gr, fnt); } 128 /// Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72) 129 virtual void SetFontSizePT(double pt, int dpi=72) { SetFontSize(pt*27.f/dpi); } 130 /// Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt) 131 inline void SetFontSizeCM(double cm, int dpi=72) { SetFontSizePT(cm*28.45f,dpi); } 132 /// Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt) 133 inline void SetFontSizeIN(double in, int dpi=72) { SetFontSizePT(in*72.27f,dpi); } 134 /// Load font from file 135 inline void LoadFont(const char *name, const char *path=NULL) 136 { mgl_load_font(gr, name, path); } 137 /// Copy font from another mglGraph instance CopyFont(const mglGraph * GR)138 inline void CopyFont(const mglGraph *GR) { mgl_copy_font(gr, GR->gr);} 139 /// Restore font (load default font for new HMGL objects) RestoreFont()140 inline void RestoreFont() { mgl_restore_font(gr); } 141 /// Set to use or not text rotation SetRotatedText(bool enable)142 inline void SetRotatedText(bool enable) { mgl_set_rotated_text(gr, enable); } 143 /// Set to scale text in relative subplots too SetScaleText(bool enable)144 inline void SetScaleText(bool enable) { mgl_set_scale_text(gr, enable); } 145 /// Set default font for all new HMGL and mglGraph objects 146 static inline void SetDefFont(const char *name, const char *path="") { mgl_def_font(name,path); } 147 /// Add user-defined glyph for symbol and set its optional id DefineSymbol(char id,const mglData & x,const mglData & y)148 inline void DefineSymbol(char id, const mglData &x, const mglData &y) 149 { mgl_define_symbol(gr, id, &x, &y); } 150 151 /// Set default palette SetPalette(const char * colors)152 inline void SetPalette(const char *colors) { mgl_set_palette(gr, colors); } 153 /// Set default color scheme SetDefScheme(const char * sch)154 inline void SetDefScheme(const char *sch) { mgl_set_def_sch(gr, sch); } 155 156 /// Sets RGB values for color with given id SetColor(char id,double r,double g,double b)157 static inline void SetColor(char id, double r, double g, double b) { mgl_set_color(id, r, g, b); } 158 /// Set mask for face coloring as array of type 'unsigned char[8]' SetMask(char id,const char * mask)159 static inline void SetMask(char id, const char *mask) { mgl_set_mask(id, mask); } 160 /// Set mask for face coloring as uint64_t number SetMask(char id,uint64_t mask)161 static inline void SetMask(char id, uint64_t mask) { mgl_set_mask_val(id, mask); } 162 /// Set default mask rotation angle SetMaskAngle(int angle)163 inline void SetMaskAngle(int angle) { mgl_set_mask_angle(gr, angle); } 164 165 /// Get last warning code GetWarn()166 inline int GetWarn() { return mgl_get_warn(gr);} 167 /// Set warning code ant fill message SetWarn(int code,const char * info)168 inline void SetWarn(int code, const char *info) { mgl_set_warn(gr,code,info); } 169 /// Get text of warning message(s) Message()170 inline const char *Message() { return mgl_get_mess(gr); } 171 /// Set global warning message SetGlobalWarn(const char * text)172 static inline void SetGlobalWarn(const char *text) { mgl_set_global_warn(text); } 173 /// Get text of global warning message(s) GlobalWarn()174 static inline const char *GlobalWarn() { return mgl_get_global_warn(); } 175 /// Clear global warning message ClearGlobalWarn()176 static inline void ClearGlobalWarn() { mgl_clear_global_warn(); } 177 /// Suppress printing warnings to stderr SuppressWarn(bool on)178 static inline void SuppressWarn(bool on) { mgl_suppress_warn(on); } 179 /// Check if MathGL version is valid (return false) or not (return true) CheckVersion(const char * ver)180 static inline bool CheckVersion(const char *ver) { return mgl_check_version(ver); } 181 /// Display progress of something. Progress(int value,int maximal)182 inline void Progress(int value, int maximal) { mgl_progress(value, maximal, gr); } 183 184 /// Set axis range scaling -- simplified way to shift/zoom axis range -- need to replot whole image! 185 inline void ZoomAxis(mglPoint p1=mglPoint(0,0,0,0), mglPoint p2=mglPoint(1,1,1,1)) 186 { mgl_zoom_axis(gr, p1.x,p1.y,p1.z,p1.c, p2.x,p2.y,p2.z,p2.c); } 187 /// Add [v1, v2] to the current range in direction dir AddRange(char dir,double v1,double v2)188 inline void AddRange(char dir, double v1, double v2) 189 { mgl_add_range_val(gr, dir, v1, v2); } 190 /// Set range in direction dir as [v1, v2] SetRange(char dir,double v1,double v2)191 inline void SetRange(char dir, double v1, double v2) 192 { mgl_set_range_val(gr, dir, v1, v2); } 193 /// Set range in direction dir as minimal and maximal values of data a 194 inline void SetRange(char dir, const mglData &dat, bool add=false) 195 { mgl_set_range_dat(gr, dir, &dat, add); } 196 /// Set values of axis range as minimal and maximal values of corresponding data SetRanges(const mglData & xx,const mglData & yy,const mglData & zz,const mglData & cc)197 inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz, const mglData &cc) 198 { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0); 199 mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&cc,0); } 200 /// Set values of axis range as minimal and maximal values of corresponding data SetRanges(const mglData & xx,const mglData & yy,const mglData & zz)201 inline void SetRanges(const mglData &xx, const mglData &yy, const mglData &zz) 202 { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0); 203 mgl_set_range_dat(gr,'z',&zz,0); mgl_set_range_dat(gr,'c',&zz,0); } 204 /// Set values of axis range as minimal and maximal values of corresponding data SetRanges(const mglData & xx,const mglData & yy)205 inline void SetRanges(const mglData &xx, const mglData &yy) 206 { mgl_set_range_dat(gr,'x',&xx,0); mgl_set_range_dat(gr,'y',&yy,0); } 207 /// Set values of axis ranges 208 inline void SetRanges(double x1, double x2, double y1, double y2, double z1=0, double z2=0) 209 { mgl_set_ranges(gr, x1, x2, y1, y2, z1, z2); } 210 /// Set values of axis ranges SetRanges(mglPoint p1,mglPoint p2)211 inline void SetRanges(mglPoint p1, mglPoint p2) 212 { mgl_set_ranges(gr, p1.x, p2.x, p1.y, p2.y, p1.z, p2.z); } 213 /// Set ranges for automatic variables 214 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) 215 { mgl_set_auto_ranges(gr, x1, x2, y1, y2, z1, z2, c1, c2); } 216 /// Set ranges for automatic variables SetAutoRanges(mglPoint p1,mglPoint p2)217 inline void SetAutoRanges(mglPoint p1, mglPoint p2) 218 { mgl_set_auto_ranges(gr, p1.x, p2.x, p1.y, p2.y, p1.z, p2.z, p1.c, p2.c); } 219 /// Set axis origin SetOrigin(mglPoint p)220 inline void SetOrigin(mglPoint p) 221 { mgl_set_origin(gr, p.x, p.y, p.z); } 222 inline void SetOrigin(double x0, double y0, double z0=NaN) 223 { mgl_set_origin(gr, x0, y0, z0); } 224 225 /// Set the transformation formulas for coordinate. Use "" for built-in ones 226 inline void SetFunc(const char *EqX, const char *EqY, const char *EqZ=NULL, const char *EqA=NULL) 227 { mgl_set_func(gr, EqX, EqY, EqZ, EqA); } 228 /// Set one of predefined transformation rule SetCoor(int how)229 inline void SetCoor(int how) { mgl_set_coor(gr, how); } 230 /// Set to draw Ternary axis (triangle like axis, grid and so on) 231 /** val=1 for Ternary axis (a+b+c=1, z=z), 232 * val=2 for Quaternary axis (a+b+c+d=1), 233 * val|4 for projections. */ Ternary(int val)234 inline void Ternary(int val) { mgl_set_ternary(gr, val); } 235 236 /// Set to use or not tick labels rotation SetTickRotate(bool val)237 inline void SetTickRotate(bool val) { mgl_set_tick_rotate(gr,val); } 238 /// Set to use or not tick labels skipping SetTickSkip(bool val)239 inline void SetTickSkip(bool val) { mgl_set_tick_skip(gr,val); } 240 /// Set tick length 241 inline void SetTickLen(double len, double stt=1) 242 { mgl_set_tick_len(gr, len, stt); } 243 /// Set axis and ticks style 244 inline void SetAxisStl(const char *stl="k", const char *tck=0, const char *sub=0) 245 { mgl_set_axis_stl(gr, stl, tck, sub); } 246 247 /// Set time templates for ticks 248 inline void SetTicksTime(char dir, double d=0, const char *t="") 249 { mgl_set_ticks_time(gr,dir,d,t); } 250 /// Set ticks text (\n separated). Use "" to disable this feature. 251 inline void SetTicksVal(char dir, const char *lbl, bool add=false) 252 { mgl_set_ticks_str(gr,dir,lbl,add); } 253 inline void SetTicksVal(char dir, const wchar_t *lbl, bool add=false) 254 { mgl_set_ticks_wcs(gr,dir,lbl,add); } 255 /// Set ticks position and text (\n separated). Use "" to disable this feature. 256 inline void SetTicksVal(char dir, const mglData &v, const char *lbl, bool add=false) 257 { mgl_set_ticks_val(gr,dir,&v,lbl,add); } 258 inline void SetTicksVal(char dir, const mglData &v, const wchar_t *lbl, bool add=false) 259 { mgl_set_ticks_valw(gr,dir,&v,lbl,add); } 260 /// Add manual tick at given position. Use "" to disable this feature. AddTick(char dir,double val,const char * lbl)261 inline void AddTick(char dir, double val, const char *lbl) 262 { mgl_add_tick(gr,dir,val,lbl); } AddTick(char dir,double val,const wchar_t * lbl)263 inline void AddTick(char dir, double val, const wchar_t *lbl) 264 { mgl_add_tickw(gr,dir,val,lbl); } 265 /// Set the ticks parameters and string for its factor 266 inline void SetTicks(char dir, double d=0, int ns=0, double org=NaN, const char *factor="") 267 { mgl_set_ticks_fact(gr, dir, d, ns, org, factor); } SetTicks(char dir,double d,int ns,double org,const wchar_t * factor)268 inline void SetTicks(char dir, double d, int ns, double org, const wchar_t *factor) 269 { mgl_set_ticks_factw(gr, dir, d, ns, org, factor); } 270 /// Auto adjust ticks 271 inline void Adjust(const char *dir="xyzc") 272 { mgl_adjust_ticks(gr, dir); } 273 /// Set templates for ticks SetTickTempl(char dir,const char * t)274 inline void SetTickTempl(char dir, const char *t) 275 { mgl_set_tick_templ(gr,dir,t); } SetTickTempl(char dir,const wchar_t * t)276 inline void SetTickTempl(char dir, const wchar_t *t) 277 { mgl_set_tick_templw(gr,dir,t); } 278 /// Tune ticks (tune|1 for common multiplier, tune|2 for common component) 279 inline void SetTuneTicks(int tune, double fact_pos=1.15) 280 { mgl_tune_ticks(gr, tune, fact_pos); } 281 /// Set additional shift of tick labels SetTickShift(mglPoint p)282 inline void SetTickShift(mglPoint p) 283 { mgl_set_tick_shift(gr,p.x,p.y,p.z,p.c); } 284 /// Set to use UTC time instead of local time SetTimeUTC(bool enable)285 inline void SetTimeUTC(bool enable) 286 { mgl_set_flag(gr,enable, MGL_USE_GMTIME); } 287 /// Set to draw tick labels at axis origin 288 inline void SetOriginTick(bool enable=true) 289 { mgl_set_flag(gr,!enable, MGL_NO_ORIGIN); } 290 /// Set bit-value flag of HMGL state (for advanced users only) SetFlagAdv(int val,uint32_t flag)291 inline void SetFlagAdv(int val, uint32_t flag) 292 { mgl_set_flag(gr, val, flag); } 293 294 /// Put further plotting in m-th cell of nx*ny grid of the image. 295 /** String \a style may contain: 296 * '<' for reserving space at left 297 * '>' for reserving space at right 298 * '^' for reserving space at top 299 * '_' for reserving space at bottom 300 * '#' for using whole region. */ 301 inline void SubPlot(int nx,int ny,int m,const char *style="<>_^", double dx=0, double dy=0) 302 { mgl_subplot_d(gr, nx, ny, m, style, dx, dy); } 303 /// Put further plotting in rectangle of dx*dy cells starting from m-th cell of nx*ny grid of the image and shift it by distance {sx,sy}. 304 /** String \a style may contain: 305 * '<' for reserving space at left 306 * '>' for reserving space at right 307 * '^' for reserving space at top 308 * '_' for reserving space at bottom 309 * '#' for using whole region. */ 310 inline void MultiPlot(int nx,int ny,int m, int dx, int dy, const char *style="<>_^", double sx=0, double sy=0) 311 { mgl_multiplot_d(gr, nx, ny, m, dx, dy, style, sx, sy); } 312 /// Put further plotting in a region [x1,x2]*[y1,y2] of the image or subplot (x1,x2,y1,y2 in range [0, 1]). 313 inline void InPlot(double x1,double x2,double y1,double y2, bool rel=true) 314 { if(rel) mgl_relplot(gr, x1, x2, y1, y2); 315 else mgl_inplot(gr, x1, x2, y1, y2); } 316 /// Put further plotting in column cell of previous subplot 317 inline void ColumnPlot(int num, int ind, double d=0) 318 { mgl_columnplot(gr,num,ind,d); } 319 /// Put further plotting in matrix cell of previous subplot 320 inline void GridPlot(int nx, int ny, int ind, double d=0) 321 { mgl_gridplot(gr,nx,ny,ind,d); } 322 /// Put further plotting in cell of stick rotated on angles tet, phi StickPlot(int num,int i,double tet,double phi)323 inline void StickPlot(int num, int i, double tet, double phi) 324 { mgl_stickplot(gr,num,i,tet,phi); } 325 /// Put further plotting in cell of stick sheared on sx, sy. 326 inline void ShearPlot(int num, int i, mreal sx, mreal sy, mreal xd=1, mreal yd=0) 327 { mgl_shearplot(gr,num,i,sx,sy,xd,yd); } 328 329 /// Set factor of plot size SetPlotFactor(double val)330 inline void SetPlotFactor(double val) 331 { mgl_set_plotfactor(gr,val); } 332 /// Push transformation matrix into stack Push()333 inline void Push() { mgl_mat_push(gr); } 334 /// Pop transformation matrix from stack Pop()335 inline void Pop() { mgl_mat_pop(gr); } 336 337 /// Add title for current subplot/inplot 338 /** Style '#' draw box around the title. */ 339 inline void Title(const char *title,const char *stl="",double size=-2) 340 { mgl_title(gr,title,stl,size); } 341 /// Add title for current subplot/inplot 342 /** Style '#' draw box around the title. */ 343 inline void Title(const wchar_t *title,const char *stl="",double size=-2) 344 { mgl_titlew(gr,title,stl,size); } 345 /// Set aspect ratio for further plotting. 346 inline void Aspect(double Ax,double Ay,double Az=1) 347 { mgl_aspect(gr, Ax, Ay, Az); } 348 /// Shear a further plotting. Shear(double Sx,double Sy)349 inline void Shear(double Sx,double Sy) 350 { mgl_shear(gr, Sx, Sy); } 351 /// Rotate a further plotting. 352 inline void Rotate(double TetX,double TetZ=0,double TetY=0) 353 { mgl_rotate(gr, TetX, TetZ, TetY); } 354 /// Rotate a further plotting around vector {x,y,z}. RotateN(double Tet,double x,double y,double z)355 inline void RotateN(double Tet,double x,double y,double z) 356 { mgl_rotate_vector(gr, Tet, x, y, z); } 357 /// Set perspective (in range [0,1)) for plot. Set to zero for switching off. Perspective(double val)358 inline void Perspective(double val) 359 { mgl_perspective(gr, val); } 360 /// Set angle of view independently from Rotate(). 361 inline void View(double TetX,double TetZ=0,double TetY=0) 362 { mgl_view(gr, TetX, TetZ, TetY); } 363 /// Set angle of view independently from Rotate(). 364 inline void ViewAsRotate(double TetZ,double TetX,double TetY=0) 365 { mgl_view(gr, -TetX, -TetZ, -TetY); } 366 /// Zoom in/out a part of picture (use Zoom(0, 0, 1, 1) for restore default) Zoom(double x1,double y1,double x2,double y2)367 inline void Zoom(double x1, double y1, double x2, double y2) 368 { mgl_zoom(gr, x1, y1, x2, y2); } 369 370 /// Set size of frame in pixels. Normally this function is called internally. 371 inline void SetSize(int width, int height, bool clf=true) 372 { if(clf) mgl_set_size(gr, width, height); 373 else mgl_scale_size(gr, width, height); } 374 /// Scaling for all further set size calls. SetSizeScl(double scl)375 static inline void SetSizeScl(double scl) { mgl_set_size_scl(scl); } 376 /// Set plot quality 377 /** qual=0 -- no face drawing (fastest), 378 * qual=1 -- no color interpolation (fast), 379 * qual=2 -- high quality (normal), 380 * qual|4 -- direct bitmap drawing (low memory usage); 381 * qual|8 for dots drawing instead of primitives (extremely fast). */ 382 inline void SetQuality(int qual=MGL_DRAW_NORM) { mgl_set_quality(gr, qual); } 383 /// Get plot quality GetQuality()384 inline int GetQuality() { return mgl_get_quality(gr); } 385 /// Set drawing region for Quality&4 386 inline void SetDrawReg(long nx=1, long ny=1, long m=0) { mgl_set_draw_reg(gr,nx,ny,m); } 387 /// Start group of objects StartGroup(const char * name)388 inline void StartGroup(const char *name) { mgl_start_group(gr, name); } 389 /// End group of objects EndGroup()390 inline void EndGroup() { mgl_end_group(gr); } 391 /// Highlight objects with given id Highlight(int id)392 inline void Highlight(int id) { mgl_highlight(gr, id); } 393 /// Set boundary box for export graphics into 2D file formats. 394 /** If x2<0 (y2<0) then full width (height) will be used. 395 * If x1<0 or y1<0 or x1>=x2|Width or y1>=y2|Height then cropping will be disabled. */ 396 inline void SetBBox(int x1=0, int y1=0, int x2=-1, int y2=-1) 397 { mgl_set_bbox(gr,x1,y1,x2,y2); } 398 399 /// Show current image 400 inline void ShowImage(const char *viewer, bool keep=0) 401 { mgl_show_image(gr, viewer, keep); } 402 /// Write the frame in file (depending extension, write current frame if fname is empty) 403 inline void WriteFrame(const char *fname=0,const char *descr="") 404 { mgl_write_frame(gr, fname, descr); } 405 /// Write the frame in file using JPEG format 406 inline void WriteJPEG(const char *fname,const char *descr="") 407 { mgl_write_jpg(gr, fname, descr); } 408 /// Write the frame in file using PNG format with transparency 409 inline void WritePNG(const char *fname,const char *descr="", bool alpha=true) 410 { if(alpha) mgl_write_png(gr, fname, descr); 411 else mgl_write_png_solid(gr, fname, descr); } 412 /// Write the frame in file using BMP format 413 inline void WriteBMP(const char *fname,const char *descr="") 414 { mgl_write_bmp(gr, fname, descr); } 415 /// Write the frame in file using BMP format 416 inline void WriteTGA(const char *fname,const char *descr="") 417 { mgl_write_tga(gr, fname, descr); } 418 /// Write the frame in file using PostScript format 419 inline void WriteEPS(const char *fname,const char *descr="") 420 { mgl_write_eps(gr, fname, descr); } 421 /// Write the frame in file using LaTeX format 422 inline void WriteTEX(const char *fname,const char *descr="") 423 { mgl_write_tex(gr, fname, descr); } 424 /// Write the frame in file using PostScript format as bitmap 425 inline void WriteBPS(const char *fname,const char *descr="") 426 { mgl_write_bps(gr, fname, descr); } 427 /// Write the frame in file using SVG format 428 inline void WriteSVG(const char *fname,const char *descr="") 429 { mgl_write_svg(gr, fname, descr); } 430 /// Write the frame in file using GIF format (only for current frame!) 431 inline void WriteGIF(const char *fname,const char *descr="") 432 { mgl_write_gif(gr, fname, descr); } 433 434 /// Write the frame in file using OBJ format 435 inline void WriteOBJ(const char *fname,const char *descr="",bool use_png=true) 436 { mgl_write_obj(gr, fname, descr, use_png); } 437 /// Write the frame in file using OBJ format - Balakin way 438 inline void WriteOBJold(const char *fname,const char *descr="",bool use_png=true) 439 { mgl_write_obj_old(gr, fname, descr, use_png); } 440 /// Write the frame in file using XYZ format 441 inline void WriteXYZ(const char *fname,const char *descr="") 442 { mgl_write_xyz(gr, fname, descr); } 443 /// Write the frame in file using STL format (faces only) 444 inline void WriteSTL(const char *fname,const char *descr="") 445 { mgl_write_stl(gr, fname, descr); } 446 /// Write the frame in file using OFF format 447 inline void WriteOFF(const char *fname,const char *descr="", bool colored=false) 448 { mgl_write_off(gr, fname, descr,colored); } 449 // /// Write the frame in file using X3D format 450 // inline void WriteX3D(const char *fname,const char *descr="") 451 // { mgl_write_x3d(gr, fname, descr); } 452 /// Write the frame in file using PRC format 453 inline void WritePRC(const char *fname,const char *descr="",bool make_pdf=true) 454 { mgl_write_prc(gr, fname, descr, make_pdf); } 455 /// Export in JSON format suitable for later drawing by JavaScript 456 inline void WriteJSON(const char *fname,const char *descr="",bool force_z=false) 457 { if(force_z) mgl_write_json_z(gr, fname, descr); 458 else mgl_write_json(gr, fname, descr); } 459 /// Return string of JSON data suitable for later drawing by JavaScript GetJSON()460 inline const char *GetJSON() { return mgl_get_json(gr); } 461 462 /// Force preparing the image. It can be useful for OpenGL mode mostly. Finish()463 inline void Finish() { mgl_finish(gr); } 464 /// Create new frame. NewFrame()465 inline void NewFrame() { mgl_new_frame(gr); } 466 /// Finish frame drawing EndFrame()467 inline void EndFrame() { mgl_end_frame(gr); } 468 /// Get the number of created frames GetNumFrame()469 inline int GetNumFrame() { return mgl_get_num_frame(gr); } 470 /// Reset frames counter (start it from zero) ResetFrames()471 inline void ResetFrames() { mgl_reset_frames(gr); } 472 /// Delete primitives for i-th frame (work if MGL_VECT_FRAME is set on) DelFrame(int i)473 inline void DelFrame(int i) { mgl_del_frame(gr, i); } 474 /// Get drawing data for i-th frame (work if MGL_VECT_FRAME is set on) GetFrame(int i)475 inline void GetFrame(int i) { mgl_get_frame(gr, i); } 476 /// 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. SetFrame(int i)477 inline void SetFrame(int i) { mgl_set_frame(gr, i); } 478 /// Append drawing data from i-th frame (work if MGL_VECT_FRAME is set on) ShowFrame(int i)479 inline void ShowFrame(int i){ mgl_show_frame(gr, i); } 480 /// Clear list of primitives for current drawing ClearFrame()481 inline void ClearFrame() { mgl_clear_frame(gr); } 482 483 /// Start write frames to cinema using GIF format 484 inline void StartGIF(const char *fname, int ms=100) 485 { mgl_start_gif(gr, fname,ms); } 486 /// Stop writing cinema using GIF format CloseGIF()487 inline void CloseGIF() { mgl_close_gif(gr); } 488 /// Export points and primitives in file using MGLD format 489 inline void ExportMGLD(const char *fname, const char *descr=0) 490 { mgl_export_mgld(gr, fname, descr); } 491 /// Import points and primitives from file using MGLD format 492 inline void ImportMGLD(const char *fname, bool add=false) 493 { mgl_import_mgld(gr, fname, add); } 494 495 /// Copy RGB values into array which is allocated by user 496 /** Position of element {i,j} is [3*i + 3*Width*j]. */ GetRGB(char * imgdata,int imglen)497 inline bool GetRGB(char *imgdata, int imglen) 498 { 499 long w=mgl_get_width(gr), h=mgl_get_height(gr); 500 if(imglen>=3*w*h) memcpy(imgdata, mgl_get_rgb(gr),3*w*h); 501 return imglen>=3*w*h; 502 } 503 /// Get RGB values of current bitmap 504 /** Position of element {i,j} is [3*i + 3*Width*j]. */ GetRGB()505 inline const unsigned char *GetRGB() { return mgl_get_rgb(gr); } 506 /// Copy RGBA values into array which is allocated by user 507 /** Position of element {i,j} is [4*i + 4*Width*j]. */ GetRGBA(char * imgdata,int imglen)508 inline bool GetRGBA(char *imgdata, int imglen) 509 { 510 long w=mgl_get_width(gr), h=mgl_get_height(gr); 511 if(imglen>=4*w*h) memcpy(imgdata, mgl_get_rgba(gr),4*w*h); 512 return imglen>=4*w*h; 513 } 514 /// Get RGBA values of current bitmap 515 /** Position of element {i,j} is [4*i + 4*Width*j]. */ GetRGBA()516 inline const unsigned char *GetRGBA() { return mgl_get_rgba(gr); } 517 /// Copy BGRN values into array which is allocated by user GetBGRN(unsigned char * imgdata,int imglen)518 inline bool GetBGRN(unsigned char *imgdata, int imglen) 519 { 520 long w=mgl_get_width(gr), h=mgl_get_height(gr), i; 521 const unsigned char *buf=mgl_get_rgb(gr); 522 if(imglen>=4*w*h) for(i=0;i<w*h;i++) 523 { 524 imgdata[4*i] = buf[3*i+2]; 525 imgdata[4*i+1] = buf[3*i+1]; 526 imgdata[4*i+2] = buf[3*i]; 527 imgdata[4*i+3] = 255; 528 } 529 return imglen>=4*w*h; 530 } 531 /// Copy RGBA values of background image into array which is allocated by user 532 /** Position of element {i,j} is [4*i + 4*Width*j]. */ GetBackground(char * imgdata,int imglen)533 inline bool GetBackground(char *imgdata, int imglen) 534 { 535 long w=mgl_get_width(gr), h=mgl_get_height(gr); 536 if(imglen>=4*w*h) memcpy(imgdata, mgl_get_background(gr),4*w*h); 537 return imglen>=4*w*h; 538 } 539 /// Get RGBA values of background image 540 /** Position of element {i,j} is [4*i + 4*Width*j]. */ GetBackground()541 inline const unsigned char *GetBackground() { return mgl_get_background(gr); } 542 /// Get width of the image GetWidth()543 inline int GetWidth() { return mgl_get_width(gr); } 544 /// Get height of the image GetHeight()545 inline int GetHeight() { return mgl_get_height(gr);} 546 /// Calculate 3D coordinate {x,y,z} for screen point {xs,ys} CalcXYZ(int xs,int ys)547 inline mglPoint CalcXYZ(int xs, int ys) 548 { 549 mreal x,y,z; 550 mgl_calc_xyz(gr,xs,ys,&x,&y,&z); 551 return mglPoint(x,y,z); 552 } 553 /// Calculate screen point {xs,ys} for 3D coordinate {x,y,z} CalcScr(mglPoint p)554 inline mglPoint CalcScr(mglPoint p) 555 { 556 int xs,ys; 557 mgl_calc_scr(gr,p.x,p.y,p.z,&xs,&ys); 558 return mglPoint(xs,ys); 559 } 560 /// Set object/subplot id SetObjId(int id)561 inline void SetObjId(int id) { mgl_set_obj_id(gr,id); } 562 /// Get object id GetObjId(long x,long y)563 inline int GetObjId(long x,long y) { return mgl_get_obj_id(gr,x,y); } 564 /// Get subplot id GetSplId(long x,long y)565 inline int GetSplId(long x,long y) { return mgl_get_spl_id(gr,x,y); } 566 /// Check if {\a xs,\a ys} is close to active point with accuracy d, and return its position or -1 567 inline long IsActive(int xs, int ys, int d=1) { return mgl_is_active(gr,xs,ys,d); } 568 569 /// Combine plots from 2 canvases. Result will be saved into this Combine(const mglGraph * g)570 inline void Combine(const mglGraph *g) { mgl_combine_gr(gr,g->gr); } 571 572 /// Clear up the frame and fill background by specified color Clf(double r,double g,double b)573 inline void Clf(double r, double g, double b) { mgl_clf_rgb(gr, r, g, b); } 574 /// Clear up the frame and fill background by specified color with manual transparency Clf(const char * col)575 inline void Clf(const char *col) { mgl_clf_str(gr, col); } 576 /// Clear up the frame and fill background by specified color Clf(char col)577 inline void Clf(char col) { mgl_clf_chr(gr, col); } 578 /// Clear up the frame Clf()579 inline void Clf() { mgl_clf(gr); } 580 /// Clear unused points and primitives. Useful only in combination with SetFaceNum(). ClearUnused()581 inline void ClearUnused() { mgl_clear_unused(gr); } 582 583 /// Load background image (basic variant: no scaling, whole image) 584 inline void LoadBackground(const char *fname, double alpha=1) 585 { mgl_load_background(gr,fname,alpha); } 586 /// Load image for background from file. 587 /** Parameter 'how' can be: 588 * 'a' for filling current subplot only; 589 * 's' for scaling (resizing) image to whole area; 590 * 'c' for centering image; 591 * 'm' for tessellate image as mosaic. */ 592 void LoadBackground(const char *fname, const char *how, double alpha=1) 593 { mgl_load_background_ext(gr,fname,how,alpha); } 594 /// Fill background image by specified color FillBackground(const mglColor & cc)595 void FillBackground(const mglColor &cc) 596 { mgl_fill_background(gr, cc.r,cc.g,cc.b); } 597 /// Force drawing the image and use it as background one Rasterize()598 inline void Rasterize() { mgl_rasterize(gr); } 599 600 /// Draws the point (ball) at position {x,y,z} with color c 601 inline void Ball(mglPoint p, char c='r') 602 { char s[3]={'.',c,0}; mgl_mark(gr, p.x, p.y, p.z, s); } 603 /// Draws the mark at position p Mark(mglPoint p,const char * mark)604 inline void Mark(mglPoint p, const char *mark) 605 { mgl_mark(gr, p.x, p.y, p.z, mark); } 606 /// Draws the line between points by specified pen 607 /** Large \a n (for example, n=100) should be used for geodesic line in curved coordinates */ 608 inline void Line(mglPoint p1, mglPoint p2, const char *pen="B",int n=2) 609 { mgl_line(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, pen, n); } 610 /// Draws the spline curve between points by specified pen 611 inline void Curve(mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *pen="B", int n=100) 612 { 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); } 613 /// Draws the 3d error box e for point p 614 inline void Error(mglPoint p, mglPoint e, const char *pen="k") 615 { mgl_error_box(gr, p.x, p.y, p.z, e.x, e.y, e.z, pen); } 616 617 /// Draws Lamerey diagram for mapping x_new = f(x_old) 618 /** String \a stl may contain: ‘v’ for drawing arrows; ‘~’ for disable 1st segment. 619 * Option value set the number of segments (default is 20).*/ 620 inline void Lamerey(double x0, const mglData &f, const char *stl="", const char *opt="") 621 { mgl_lamerey_dat(gr,x0,&f,stl,opt); } 622 inline void Lamerey(double x0, const char *func, const char *stl="", const char *opt="") 623 { mgl_lamerey_str(gr,x0,func,stl,opt); } 624 /// Draws Bifurcation diagram for mapping x_new = f(x_old) in x-axis range 625 /** Option value set the number of stationary points (default is 1024).*/ 626 inline void Bifurcation(double dx, const mglData &f, const char *stl="", const char *opt="") 627 { mgl_bifurcation_dat(gr,dx,&f,stl,opt); } 628 inline void Bifurcation(double dx, const char *func, const char *stl="", const char *opt="") 629 { mgl_bifurcation_str(gr,dx,func,stl,opt); } 630 631 /// Draws Iris plots for determining cross-dependences of data arrays 632 /** NOTE: using the same ranges and empty ids will not draw axis. This will add data to existing Iris plot. 633 * Option value set the size of data labels ids, separated by ';'.*/ 634 inline void Iris(mglData &dats, const char *ids, const char *stl="", const char *opt="") 635 { mgl_iris_1(gr,&dats,ids,stl,opt); } 636 inline void Iris(mglData &dats, const wchar_t *ids, const char *stl="", const char *opt="") 637 { mgl_irisw_1(gr,&dats,ids,stl,opt); } 638 inline void Iris(mglData &dats, mglData &ranges, const char *ids, const char *stl="", const char *opt="") 639 { mgl_iris(gr,&dats,&ranges,ids,stl,opt); } 640 inline void Iris(mglData &dats, mglData &ranges, const wchar_t *ids, const char *stl="", const char *opt="") 641 { mgl_irisw(gr,&dats,&ranges,ids,stl,opt); } 642 643 /// Draws the face between points with color stl (include interpolation up to 4 colors). 644 inline void Face(mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="r") 645 { 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); } 646 /// Draws the face in y-z plane at point p with color stl (include interpolation up to 4 colors). 647 inline void FaceX(mglPoint p, double wy, double wz, const char *stl="w", double dx=0, double dy=0) 648 { mgl_facex(gr, p.x, p.y, p.z, wy, wz, stl, dx, dy); } 649 /// Draws the face in x-z plane at point p with color stl (include interpolation up to 4 colors). 650 inline void FaceY(mglPoint p, double wx, double wz, const char *stl="w", double dx=0, double dy=0) 651 { mgl_facey(gr, p.x, p.y, p.z, wx, wz, stl, dx, dy); } 652 /// Draws the face in x-y plane at point p with color stl (include interpolation up to 4 colors). 653 inline void FaceZ(mglPoint p, double wx, double wy, const char *stl="w", double dx=0, double dy=0) 654 { mgl_facez(gr, p.x, p.y, p.z, wx, wy, stl, dx, dy); } 655 /// Draws the drop at point p in direction d with color col and radius r 656 /** Parameter \a shift set the degree of drop oblongness: ‘0’ is sphere, ‘1’ is maximally oblongness drop. Parameter \a ap set relative width of the drop (this is analogue of “ellipticity” for the sphere).*/ 657 inline void Drop(mglPoint p, mglPoint d, double r, const char *col="r", double shift=1, double ap=1) 658 { mgl_drop(gr, p.x, p.y, p.z, d.x, d.y, d.z, r, col, shift, ap); } 659 /// Draws the sphere at point p with color col and radius r 660 inline void Sphere(mglPoint p, double r, const char *col="r") 661 { mgl_sphere(gr, p.x, p.y, p.z, r, col); } 662 /// Draws the cone between points p1,p2 with radius r1,r2 and with style stl 663 /** Parameter \a stl can contain: 664 * ‘@’ for drawing edges; 665 * ‘#’ for wired cones; 666 * ‘t’ for drawing tubes/cylinder instead of cones/prisms; 667 * ‘4’, ‘6’, ‘8’ for drawing square, hex- or octo-prism instead of cones.*/ 668 inline void Cone(mglPoint p1, mglPoint p2, double r1, double r2=-1, const char *stl="r@") 669 { mgl_cone(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z,r1,r2,stl); } 670 /// Draws the ellipse between points p1,p2 with color stl and width r 671 /** Parameter \a stl can contain: 672 * ‘#’ for wired figure (boundary only); 673 * ‘@’ for filled figure and with boundary (second color or black one is used for boundary).*/ 674 inline void Ellipse(mglPoint p1, mglPoint p2, double r, const char *stl="r") 675 { mgl_ellipse(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); } 676 /// Draws the circle at point p with color stl and radius r 677 /** Parameter \a stl can contain: 678 * ‘#’ for wired figure (boundary only); 679 * ‘@’ for filled figure and with boundary (second color or black one is used for boundary).*/ 680 inline void Circle(mglPoint p, double r, const char *stl="r") 681 { mgl_ellipse(gr, p.x, p.y, p.z, p.x, p.y, p.z, r,stl); } 682 /// Draws the rhomb between points p1,p2 with color stl and width r 683 /** Parameter \a stl can contain: 684 * ‘#’ for wired figure (boundary only); 685 * ‘@’ for filled figure and with boundary (second color or black one is used for boundary).*/ 686 inline void Rhomb(mglPoint p1, mglPoint p2, double r, const char *stl="r") 687 { mgl_rhomb(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, r,stl); } 688 /// Draws the polygon based on points p1,p2 with color stl 689 /** Parameter \a stl can contain: 690 * ‘#’ for wired figure (boundary only); 691 * ‘@’ for filled figure and with boundary (second color or black one is used for boundary).*/ 692 inline void Polygon(mglPoint p1, mglPoint p2, int n, const char *stl="r") 693 { mgl_polygon(gr, p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, n,stl); } 694 /// Draws the arc around axis pr with center at p0 and starting from p1, by color stl and angle a (in degrees) 695 inline void Arc(mglPoint p0, mglPoint pa, mglPoint p1, double a, const char *stl="r") 696 { mgl_arc_ext(gr, p0.x,p0.y,p0.z, pa.x,pa.y,pa.z, p1.x,p1.y,p1.z, a,stl); } 697 /// Draws the arc around axis 'z' with center at p0 and starting from p1, by color stl and angle a (in degrees) 698 inline void Arc(mglPoint p0, mglPoint p1, double a, const char *stl="r") 699 { mgl_arc_ext(gr, p0.x,p0.y,p0.z, 0,0,1, p1.x,p1.y,p0.z, a,stl); } 700 /// Draws bitmap (logo) which is stretched along whole axis range 701 inline void Logo(long w, long h, const unsigned char *rgba, bool smooth=false, const char *opt="") 702 { mgl_logo(gr, w, h, rgba, smooth, opt); } 703 inline void Logo(const char *fname, bool smooth=false, const char *opt="") 704 { mgl_logo_file(gr, fname, smooth, opt); } 705 706 /// Draw user-defined symbol in position p 707 inline void Symbol(mglPoint p, char id, const char *how="", double size=-1) 708 { mgl_symbol(gr, p.x, p.y, p.z, id, how, size); } 709 /// Draw user-defined symbol in position p along direction d 710 inline void Symbol(mglPoint p, mglPoint d, char id, const char *how="", double size=-1) 711 { mgl_symbol_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, id, how, size); } 712 /// Print text in position p with specified font 713 inline void Putsw(mglPoint p,const wchar_t *text,const char *font=":C",double size=-1) 714 { mgl_putsw(gr, p.x, p.y, p.z, text, font, size); } 715 /// Print text in position p with specified font 716 inline void Puts(mglPoint p,const char *text,const char *font=":C",double size=-1) 717 { mgl_puts(gr, p.x, p.y, p.z, text, font, size); } 718 /// Print text in position p with specified font 719 inline void Putsw(double x, double y,const wchar_t *text,const char *font=":AC",double size=-1) 720 { mgl_putsw(gr, x, y, 0, text, font, size); } 721 /// Print text in position p with specified font 722 inline void Puts(double x, double y,const char *text,const char *font=":AC",double size=-1) 723 { mgl_puts(gr, x, y, 0, text, font, size); } 724 /// Print text in position p along direction d with specified font 725 inline void Putsw(mglPoint p, mglPoint d, const wchar_t *text, const char *font=":L", double size=-1) 726 { mgl_putsw_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); } 727 /// Print text in position p along direction d with specified font 728 inline void Puts(mglPoint p, mglPoint d, const char *text, const char *font=":L", double size=-1) 729 { mgl_puts_dir(gr, p.x, p.y, p.z, d.x, d.y, d.z, text, font, size); } 730 731 /// Print text along the curve 732 inline void Text(const mglData &x, const mglData &y, const mglData &z, const char *text, const char *font="", const char *opt="") 733 { mgl_text_xyz(gr, &x, &y, &z, text, font, opt); } 734 /// Print text along the curve 735 inline void Text(const mglData &x, const mglData &y, const char *text, const char *font="", const char *opt="") 736 { mgl_text_xy(gr, &x, &y, text, font, opt); } 737 /// Print text along the curve 738 inline void Text(const mglData &y, const char *text, const char *font="", const char *opt="") 739 { mgl_text_y(gr, &y, text, font, opt); } 740 /// Print text along the curve 741 inline void Text(const mglData &x, const mglData &y, const mglData &z, const wchar_t *text, const char *font="", const char *opt="") 742 { mgl_textw_xyz(gr, &x, &y, &z, text, font, opt); } 743 /// Print text along the curve 744 inline void Text(const mglData &x, const mglData &y, const wchar_t *text, const char *font="", const char *opt="") 745 { mgl_textw_xy(gr, &x, &y, text, font, opt); } 746 /// Print text along the curve 747 inline void Text(const mglData &y, const wchar_t *text, const char *font="", const char *opt="") 748 { mgl_textw_y(gr, &y, text, font, opt); } 749 750 /// Draws bounding box outside the plotting volume with color c. 751 /** Style ‘@’ produce filled back faces. */ 752 inline void Box(const char *col="", bool ticks=true) 753 { mgl_box_str(gr, col, ticks); } 754 /// Draw axises with ticks in direction(s) dir. 755 /** Parameter \a dir may contain: 756 * ‘xyzt’for drawing axis in corresponding direction; 757 * ‘XYZT’ for drawing axis in corresponding direction but with inverted positions of labels; 758 * ‘~’, ‘_’ for disabling tick labels; 759 * ‘U’ for disabling rotation of tick labels; 760 * ‘^’ for inverting default axis origin; 761 * ‘!’ for disabling ticks tuning; 762 * ‘AKDTVISO’ for drawing arrow at the end of axis; 763 * ‘a’ for forced adjusting of axis ticks; 764 * ‘f’ for printing ticks labels in fixed format; 765 * ‘E’ for using ‘E’ instead of ‘e’ in ticks labels; 766 * ‘F’ for printing ticks labels in LaTeX format; 767 * ‘+’ for printing ‘+’ for positive ticks; 768 * ‘-’ for printing usual ‘-’ in ticks labels; 769 * ‘0123456789’ for precision at printing ticks labels. 770 * Option "value" set the manual rotation angle for the ticks. */ 771 inline void Axis(const char *dir="xyzt", const char *stl="", const char *opt="") 772 { mgl_axis(gr, dir,stl,opt); } 773 /// Draw grid lines perpendicular to direction(s) dir. 774 inline void Grid(const char *dir="xyzt",const char *pen="B", const char *opt="") 775 { mgl_axis_grid(gr, dir, pen, opt); } 776 /// Print the label text for axis dir. 777 /** Option "value" set additional shifting of the label. */ 778 inline void Label(char dir, const char *text, double pos=+1, const char *opt="") 779 { mgl_label(gr, dir, text, pos, opt); } 780 /// Print the label text for axis dir. 781 /** Option "value" set additional shifting of the label. */ 782 inline void Label(char dir, const wchar_t *text, double pos=+1, const char *opt="") 783 { mgl_labelw(gr, dir, text, pos, opt); } 784 785 /// Draw colorbar at edge of axis 786 /** Parameter \a sch may contain: 787 * ‘<>^_’ for positioning at left, at right, at top or at bottom correspondingly; 788 * ‘I’ for positioning near bounding (by default, at edges of subplot); 789 * ‘A’ for using absolute coordinates; 790 * ‘~’ for disabling tick labels. 791 * ‘!’ for disabling ticks tuning; 792 * ‘f’ for printing ticks labels in fixed format; 793 * ‘E’ for using ‘E’ instead of ‘e’ in ticks labels; 794 * ‘F’ for printing ticks labels in LaTeX format; 795 * ‘+’ for printing ‘+’ for positive ticks; 796 * ‘-’ for printing usual ‘-’ in ticks labels; 797 * ‘0123456789’ for precision at printing ticks labels.*/ 798 inline void Colorbar(const char *sch="") 799 { mgl_colorbar(gr, sch); } 800 /// Draw colorbar at manual position 801 /** Parameter \a sch may contain: 802 * ‘<>^_’ for positioning at left, at right, at top or at bottom correspondingly; 803 * ‘I’ for positioning near bounding (by default, at edges of subplot); 804 * ‘A’ for using absolute coordinates; 805 * ‘~’ for disabling tick labels. 806 * ‘!’ for disabling ticks tuning; 807 * ‘f’ for printing ticks labels in fixed format; 808 * ‘E’ for using ‘E’ instead of ‘e’ in ticks labels; 809 * ‘F’ for printing ticks labels in LaTeX format; 810 * ‘+’ for printing ‘+’ for positive ticks; 811 * ‘-’ for printing usual ‘-’ in ticks labels; 812 * ‘0123456789’ for precision at printing ticks labels.*/ 813 inline void Colorbar(const char *sch,double x,double y,double w=1,double h=1) 814 { mgl_colorbar_ext(gr, sch, x,y,w,h); } 815 /// Draw colorbar with manual colors at edge of axis 816 /** Parameter \a sch may contain: 817 * ‘<>^_’ for positioning at left, at right, at top or at bottom correspondingly; 818 * ‘I’ for positioning near bounding (by default, at edges of subplot); 819 * ‘A’ for using absolute coordinates; 820 * ‘~’ for disabling tick labels. 821 * ‘!’ for disabling ticks tuning; 822 * ‘f’ for printing ticks labels in fixed format; 823 * ‘E’ for using ‘E’ instead of ‘e’ in ticks labels; 824 * ‘F’ for printing ticks labels in LaTeX format; 825 * ‘+’ for printing ‘+’ for positive ticks; 826 * ‘-’ for printing usual ‘-’ in ticks labels; 827 * ‘0123456789’ for precision at printing ticks labels.*/ 828 inline void Colorbar(const mglData &val, const char *sch="") 829 { mgl_colorbar_val(gr, &val, sch); } 830 /// Draw colorbar with manual colors at manual position 831 /** Parameter \a sch may contain: 832 * ‘<>^_’ for positioning at left, at right, at top or at bottom correspondingly; 833 * ‘I’ for positioning near bounding (by default, at edges of subplot); 834 * ‘A’ for using absolute coordinates; 835 * ‘~’ for disabling tick labels. 836 * ‘!’ for disabling ticks tuning; 837 * ‘f’ for printing ticks labels in fixed format; 838 * ‘E’ for using ‘E’ instead of ‘e’ in ticks labels; 839 * ‘F’ for printing ticks labels in LaTeX format; 840 * ‘+’ for printing ‘+’ for positive ticks; 841 * ‘-’ for printing usual ‘-’ in ticks labels; 842 * ‘0123456789’ for precision at printing ticks labels.*/ 843 inline void Colorbar(const mglData &val, const char *sch,double x,double y,double w=1,double h=1) 844 { mgl_colorbar_val_ext(gr, &val, sch, x,y,w,h); } 845 846 /// Add string to legend AddLegend(const char * text,const char * style)847 inline void AddLegend(const char *text,const char *style) 848 { mgl_add_legend(gr, text, style); } AddLegend(const wchar_t * text,const char * style)849 inline void AddLegend(const wchar_t *text,const char *style) 850 { mgl_add_legendw(gr, text, style); } 851 /// Clear saved legend string ClearLegend()852 inline void ClearLegend() 853 { mgl_clear_legend(gr); } 854 /// Draw legend of accumulated strings at position {x,y} 855 /** Parameter fnt may contain: 856 * font style for legend text; 857 * colors for background (first one), border (second one) and text (last one); 858 * ‘A’ for positioning in absolute coordinates; 859 * ‘^’ for positioning outside of specified point; 860 * ‘-’ for arranging entries horizontally; 861 * ‘#’ for drawing box around legend. 862 * Option value set the space between line samples and text (default is 0.1).*/ 863 inline void Legend(double x, double y, const char *font="#", const char *opt="") 864 { mgl_legend_pos(gr, x, y, font, opt); } 865 /// Draw legend of accumulated strings 866 /** Parameter fnt may contain: 867 * font style for legend text; 868 * colors for background (first one), border (second one) and text (last one); 869 * ‘A’ for positioning in absolute coordinates; 870 * ‘^’ for positioning outside of specified point; 871 * ‘-’ for arranging entries horizontally; 872 * ‘#’ for drawing box around legend. 873 * Option value set the space between line samples and text (default is 0.1). 874 * Parameter \a where sets position: 0 at bottom-left, 1 at bottom-right, 2 at top-left, 3 at top-right (default).*/ 875 inline void Legend(int where=3, const char *font="#", const char *opt="") 876 { mgl_legend(gr, where, font, opt); } 877 /// Set number of marks in legend sample SetLegendMarks(int num)878 inline void SetLegendMarks(int num) { mgl_set_legend_marks(gr, num); } 879 880 /// Draw usual curve {x,y,z} 881 inline void Plot(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="") 882 { mgl_plot_xyz(gr, &x, &y, &z, pen, opt); } 883 /// Draw usual curve {x,y} 884 inline void Plot(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 885 { mgl_plot_xy(gr, &x, &y, pen,opt); } 886 /// Draw usual curve {x,y} with x in x-axis range 887 inline void Plot(const mglData &y, const char *pen="", const char *opt="") 888 { mgl_plot(gr, &y, pen,opt); } 889 /// Draw tapes which rotates as (bi-)normales of curve {x,y,z} 890 /** The width of tape is proportional to barwidth and can be changed by option "value".*/ 891 inline void Tape(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="") 892 { mgl_tape_xyz(gr, &x, &y, &z, pen, opt); } 893 /// Draw tapes which rotates as (bi-)normales of curve {x,y} 894 /** The width of tape is proportional to barwidth and can be changed by option "value".*/ 895 inline void Tape(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 896 { mgl_tape_xy(gr, &x, &y, pen,opt); } 897 /// Draw tapes which rotates as (bi-)normales of curve {x,y} with x in x-axis range 898 /** The width of tape is proportional to barwidth and can be changed by option "value".*/ 899 inline void Tape(const mglData &y, const char *pen="", const char *opt="") 900 { mgl_tape(gr, &y, pen,opt); } 901 /// Draw radar chart (plot in curved coordinates) 902 /** Option "value" set the additional shift of data (i.e. the data a+value is used instead of a).*/ 903 inline void Radar(const mglData &a, const char *pen="", const char *opt="") 904 { mgl_radar(gr, &a, pen, opt); } 905 906 /// Draw stairs for points in arrays {x,y,z} 907 inline void Step(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="") 908 { mgl_step_xyz(gr, &x, &y, &z, pen, opt); } 909 /// Draw stairs for points in arrays {x,y} 910 inline void Step(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 911 { mgl_step_xy(gr, &x, &y, pen, opt); } 912 /// Draw stairs for points in arrays {x,y} with x in x-axis range 913 inline void Step(const mglData &y, const char *pen="", const char *opt="") 914 { mgl_step(gr, &y, pen, opt); } 915 916 /// Draw curve {x,y,z} which is colored by c (like tension plot) 917 inline void Tens(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *pen="", const char *opt="") 918 { mgl_tens_xyz(gr, &x, &y, &z, &c, pen, opt); } 919 /// Draw curve {x,y} which is colored by c (like tension plot) 920 inline void Tens(const mglData &x, const mglData &y, const mglData &c, const char *pen="", const char *opt="") 921 { mgl_tens_xy(gr, &x, &y, &c, pen, opt); } 922 /// Draw curve {x,y} with x in x-axis range which is colored by c (like tension plot) 923 inline void Tens(const mglData &y, const mglData &c, const char *pen="", const char *opt="") 924 { mgl_tens(gr, &y, &c, pen, opt); } 925 926 /// Fill area between curve {x,y,z} and axis plane 927 /** Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 928 inline void Area(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="") 929 { mgl_area_xyz(gr, &x, &y, &z, pen, opt); } 930 /// Fill area between curve {x,y} and axis plane 931 /** Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 932 inline void Area(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 933 { mgl_area_xy(gr, &x, &y, pen, opt); } 934 /// Fill area between curve {x,y} with x in x-axis range and axis plane 935 /** Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 936 inline void Area(const mglData &y, const char *pen="", const char *opt="") 937 { mgl_area(gr, &y, pen, opt); } 938 939 /// Fill area between curves {x,y1} and {x,y2} with x in x-axis range 940 /** Style 'i' will fill area only if y1 < y2. 941 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 942 inline void Region(const mglData &y1, const mglData &y2, const char *pen="", const char *opt="") 943 { mgl_region(gr, &y1, &y2, pen, opt); } 944 /// Fill area between curves {x,y1} and {x,y2} 945 /** Style 'i' will fill area only if y1 < y2. 946 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 947 inline void Region(const mglData &x, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="") 948 { mgl_region_xy(gr, &x, &y1, &y2, pen, opt); } 949 /// Fill area (draw ribbon) between curves {x1,y1,z1} and {x2,y2,z2} 950 /** Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 951 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="") 952 { mgl_region_3d(gr, &x1, &y1, &z1, &x2, &y2, &z2, pen, opt); } 953 /// Fill area (draw ribbon) between curves {x1,y1} and {x2,y2} 954 /** Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 955 inline void Region(const mglData &x1, const mglData &y1, const mglData &x2, const mglData &y2, const char *pen="", const char *opt="") 956 { mgl_region_3d(gr, &x1, &y1, NULL, &x2, &y2, NULL, pen, opt); } 957 958 /// Draw lines with arrows between points {x1,y1,z1} and {x2,y2,z2} 959 inline void Lines(const mglData &x1, const mglData &y1, const mglData &z1, const mglData &x2, const mglData &y2, const mglData &z2, const char *pen="", const char *opt="") 960 { mgl_lines_xyz(gr, &x1, &y1, &z1, &x2, &y2, &z2, pen, opt); } 961 /// Draw lines with arrows between points {x1,y1,zMin} and {x2,y2,zMin} 962 inline void Lines(const mglData &x1, const mglData &y1, const mglData &x2, const mglData &y2, const char *pen="", const char *opt="") 963 { mgl_lines_xy(gr, &x1, &y1, &x2, &y2, pen, opt); } 964 /// Draw lines with arrows between: points {x1,y} and {x2,y} with y in y-axis range if \a pen contain 'x'; or points {x,y1} and {x,y2} with x in x-axis range. 965 inline void Lines(const mglData &y1, const mglData &y2, const char *pen="", const char *opt="") 966 { if(mglchr(pen,'x')) mgl_lines_x(gr, &y1, &y2, pen, opt); 967 else mgl_lines(gr, &y1, &y2, pen, opt); } 968 969 /// Draw vertical lines from points {x,y,z} to axis plane 970 inline void Stem(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="") 971 { mgl_stem_xyz(gr, &x, &y, &z, pen, opt); } 972 /// Draw vertical lines from points {x,y} to axis plane 973 inline void Stem(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 974 { mgl_stem_xy(gr, &x, &y, pen, opt); } 975 /// Draw vertical lines from points {x,y} with x in x-axis range to axis plane 976 inline void Stem(const mglData &y, const char *pen="", const char *opt="") 977 { mgl_stem(gr, &y, pen, opt); } 978 979 /// Draw vertical bars from points {x,y,z} to axis plane 980 /** String \a pen may contain: 981 * ‘a’ for drawing boxes one above another (like summation); 982 * ‘f’ for waterfall chart; 983 * ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right. 984 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 985 inline void Bars(const mglData &x, const mglData &y, const mglData &z, const char *pen="", const char *opt="") 986 { mgl_bars_xyz(gr, &x, &y, &z, pen, opt); } 987 /// Draw vertical bars from points {x,y} to axis plane 988 /** String \a pen may contain: 989 * ‘a’ for drawing boxes one above another (like summation); 990 * ‘f’ for waterfall chart; 991 * ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right. 992 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 993 inline void Bars(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 994 { mgl_bars_xy(gr, &x, &y, pen, opt); } 995 /// Draw vertical bars from points {x,y} with x in x-axis range to axis plane 996 /** String \a pen may contain: 997 * ‘a’ for drawing boxes one above another (like summation); 998 * ‘f’ for waterfall chart; 999 * ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right. 1000 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 1001 inline void Bars(const mglData &y, const char *pen="", const char *opt="") 1002 { mgl_bars(gr, &y, pen, opt); } 1003 /// Draw horizontal bars from points {x,y} to axis plane 1004 /** String \a pen may contain: 1005 * ‘a’ for drawing boxes one above another (like summation); 1006 * ‘f’ for waterfall chart; 1007 * ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right. 1008 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 1009 inline void Barh(const mglData &y, const mglData &v, const char *pen="", const char *opt="") 1010 { mgl_barh_yx(gr, &y, &v, pen, opt); } 1011 /// Draw horizontal bars from points {x,y} with y in y-axis range to axis plane 1012 /** String \a pen may contain: 1013 * ‘a’ for drawing boxes one above another (like summation); 1014 * ‘f’ for waterfall chart; 1015 * ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right. 1016 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 1017 inline void Barh(const mglData &v, const char *pen="", const char *opt="") 1018 { mgl_barh(gr, &v, pen, opt); } 1019 /// Draw chart for data a 1020 /** Space denote transparent color. Style '#' draw black borders. */ 1021 inline void Chart(const mglData &a, const char *colors="", const char *opt="") 1022 { mgl_chart(gr, &a, colors,opt); } 1023 1024 /// Draw Open-High-Low-Close (OHLC) diagram 1025 /** Different colors for up and down values are used if number of specified colors is equal to 2*number of curves. */ 1026 inline void OHLC(const mglData &x, const mglData &open, const mglData &high, const mglData &low, const mglData &close, const char *pen="", const char *opt="") 1027 { mgl_ohlc_x(gr, &x, &open,&high,&low,&close,pen,opt); } 1028 /// Draw Open-High-Low-Close (OHLC) diagram with x in x-axis range 1029 /** Different colors for up and down values are used if number of specified colors is equal to 2*number of curves. */ 1030 inline void OHLC(const mglData &open, const mglData &high, const mglData &low, const mglData &close, const char *pen="", const char *opt="") 1031 { mgl_ohlc(gr, &open,&high,&low,&close,pen,opt); } 1032 1033 /// Draw box-plot (special 5-value plot used in statistic) 1034 /** String \a pen may contain ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right.*/ 1035 inline void BoxPlot(const mglData &x, const mglData &y, const char *pen="", const char *opt="") 1036 { mgl_boxplot_xy(gr, &x, &y, pen,opt); } 1037 /// Draw box-plot (special 5-value plot used in statistic) with x in x-axis range 1038 /** String \a pen may contain ‘<’, ‘^’, ‘>’ for aligning boxes: at left, centered, at right.*/ 1039 inline void BoxPlot(const mglData &y, const char *pen="", const char *opt="") 1040 { mgl_boxplot(gr, &y, pen,opt); } 1041 1042 /// Draw candle plot 1043 /** Different colors are used for up and down values if 2 colors are specified. 1044 * Style ‘#’ force drawing wire candle even for 2-color scheme. */ 1045 inline void Candle(const mglData &x, const mglData &v1, const mglData &v2, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="") 1046 { mgl_candle_xyv(gr, &x, &v1, &v2, &y1, &y2, pen, opt); } 1047 /// Draw candle plot with x in x-axis range 1048 /** Different colors are used for up and down values if 2 colors are specified. 1049 * Style ‘#’ force drawing wire candle even for 2-color scheme. */ 1050 inline void Candle(const mglData &v1, const mglData &v2, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="") 1051 { mgl_candle_yv(gr, &v1, &v2, &y1, &y2, pen, opt); } 1052 inline void Candle(const mglData &v1, const mglData &v2, const char *pen="", const char *opt="") 1053 { mgl_candle_yv(gr, &v1, &v2, NULL, NULL, pen, opt); } 1054 /// Draw candle plot with v1=v[i], v2=v[i+1] 1055 /** Different colors are used for up and down values if 2 colors are specified. 1056 * Style ‘#’ force drawing wire candle even for 2-color scheme. */ 1057 inline void Candle(const mglData &y, const mglData &y1, const mglData &y2, const char *pen="", const char *opt="") 1058 { mgl_candle(gr, &y, &y1, &y2, pen, opt); } 1059 /// Draw candle plot with v1=v[i], v2=v[i+1] 1060 /** Different colors are used for up and down values if 2 colors are specified. 1061 * Style ‘#’ force drawing wire candle even for 2-color scheme. */ 1062 inline void Candle(const mglData &y, const char *pen="", const char *opt="") 1063 { mgl_candle(gr, &y, NULL, NULL, pen, opt); } 1064 1065 /// Draw cones from points {x,y,z} to axis plane 1066 /** String \a pen may contain: 1067 * ‘@’ for drawing edges; 1068 * ‘#’ for wired cones; 1069 * ‘t’ for drawing tubes/cylinders instead of cones/prisms; 1070 * ‘4’, ‘6’, ‘8’ for drawing square, hex- or octo-prism instead of cones; 1071 * ‘<’, ‘^’ or ‘>’ for aligning cones left, right or centering them at its x-coordinates. 1072 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 1073 inline void Cones(const mglData &x, const mglData &y, const mglData &z, const char *pen="@", const char *opt="") 1074 { mgl_cones_xyz(gr, &x, &y, &z, pen, opt); } 1075 /// Draw cones from points {x,z} to axis plane 1076 /** String \a pen may contain: 1077 * ‘@’ for drawing edges; 1078 * ‘#’ for wired cones; 1079 * ‘t’ for drawing tubes/cylinders instead of cones/prisms; 1080 * ‘4’, ‘6’, ‘8’ for drawing square, hex- or octo-prism instead of cones; 1081 * ‘<’, ‘^’ or ‘>’ for aligning cones left, right or centering them at its x-coordinates. 1082 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 1083 inline void Cones(const mglData &x, const mglData &z, const char *pen="@", const char *opt="") 1084 { mgl_cones_xz(gr, &x, &z, pen, opt); } 1085 /// Draw cones from points {x,z} with x in x-axis range to axis plane 1086 /** String \a pen may contain: 1087 * ‘@’ for drawing edges; 1088 * ‘#’ for wired cones; 1089 * ‘t’ for drawing tubes/cylinders instead of cones/prisms; 1090 * ‘4’, ‘6’, ‘8’ for drawing square, hex- or octo-prism instead of cones; 1091 * ‘<’, ‘^’ or ‘>’ for aligning cones left, right or centering them at its x-coordinates. 1092 * Gradient filling is used if number of specified colors is equal to 2*number of curves.*/ 1093 inline void Cones(const mglData &z, const char *pen="@", const char *opt="") 1094 { mgl_cones(gr, &z, pen, opt); } 1095 1096 /// Draw error boxes {ey} at points {x,y} with x in x-axis range 1097 /** Style ‘@’ set to draw large semitransparent mark instead of error box.*/ 1098 inline void Error(const mglData &y, const mglData &ey, const char *pen="", const char *opt="") 1099 { mgl_error(gr, &y, &ey, pen, opt); } 1100 /// Draw error boxes {ey} at points {x,y} 1101 /** Style ‘@’ set to draw large semitransparent mark instead of error box.*/ 1102 inline void Error(const mglData &x, const mglData &y, const mglData &ey, const char *pen="", const char *opt="") 1103 { mgl_error_xy(gr, &x, &y, &ey, pen, opt); } 1104 /// Draw error boxes {ex,ey} at points {x,y} 1105 /** Style ‘@’ set to draw large semitransparent mark instead of error box.*/ 1106 inline void Error(const mglData &x, const mglData &y, const mglData &ex, const mglData &ey, const char *pen="", const char *opt="") 1107 { mgl_error_exy(gr, &x, &y, &ex, &ey, pen, opt); } 1108 1109 /// Draw marks with size r at points {x,y,z} 1110 inline void Mark(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *pen, const char *opt="") 1111 { mgl_mark_xyz(gr, &x, &y, &z, &r, pen, opt); } 1112 /// Draw marks with size r at points {x,y} 1113 inline void Mark(const mglData &x, const mglData &y, const mglData &r, const char *pen, const char *opt="") 1114 { mgl_mark_xy(gr, &x, &y, &r, pen, opt); } 1115 /// Draw marks with size r at points {x,y} with x in x-axis range 1116 inline void Mark(const mglData &y, const mglData &r, const char *pen, const char *opt="") 1117 { mgl_mark_y(gr, &y, &r, pen, opt); } 1118 1119 /// Draw Poincare map at condition s==0 for curve {x,y,z} 1120 inline void Pmap(const mglData &x, const mglData &y, const mglData &z, const mglData &s, const char *pen, const char *opt="") 1121 { mgl_pmap_xyz(gr, &x, &y, &z, &s, pen, opt); } 1122 /// Draw Poincare map at condition s==0 for curve {x,y} 1123 inline void Pmap(const mglData &x, const mglData &y, const mglData &s, const char *pen, const char *opt="") 1124 { mgl_pmap_xy(gr, &x, &y, &s, pen, opt); } 1125 /// Draw Poincare map at condition s==0 for curve {x,y} with x in x-axis range 1126 inline void Pmap(const mglData &y, const mglData &s, const char *pen, const char *opt="") 1127 { mgl_pmap(gr, &y, &s, pen, opt); } 1128 1129 /// Draw textual marks with size r at points {x,y,z} 1130 inline void TextMark(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *text, const char *fnt="", const char *opt="") 1131 { mgl_textmark_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); } 1132 /// Draw textual marks with size r at points {x,y} 1133 inline void TextMark(const mglData &x, const mglData &y, const mglData &r, const char *text, const char *fnt="", const char *opt="") 1134 { mgl_textmark_xyr(gr, &x, &y, &r, text, fnt, opt); } 1135 /// Draw textual marks with size r at points {x,y} with x in x-axis range 1136 inline void TextMark(const mglData &y, const mglData &r, const char *text, const char *fnt="", const char *opt="") 1137 { mgl_textmark_yr(gr, &y, &r, text, fnt, opt); } 1138 /// Draw textual marks at points {x,y} with x in x-axis range 1139 inline void TextMark(const mglData &y, const char *text, const char *fnt="", const char *opt="") 1140 { mgl_textmark(gr, &y, text, fnt, opt); } 1141 /// Draw textual marks with size r at points {x,y,z} 1142 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="") 1143 { mgl_textmarkw_xyzr(gr, &x, &y, &z, &r, text, fnt, opt); } 1144 /// Draw textual marks with size r at points {x,y} 1145 inline void TextMark(const mglData &x, const mglData &y, const mglData &r, const wchar_t *text, const char *fnt="", const char *opt="") 1146 { mgl_textmarkw_xyr(gr, &x, &y, &r, text, fnt, opt); } 1147 /// Draw textual marks with size r at points {x,y} with x in x-axis range 1148 inline void TextMark(const mglData &y, const mglData &r, const wchar_t *text, const char *fnt="", const char *opt="") 1149 { mgl_textmarkw_yr(gr, &y, &r, text, fnt, opt); } 1150 /// Draw textual marks at points {x,y} with x in x-axis range 1151 inline void TextMark(const mglData &y, const wchar_t *text, const char *fnt="", const char *opt="") 1152 { mgl_textmarkw(gr, &y, text, fnt, opt); } 1153 1154 /// Draw labels for points coordinate(s) at points {x,y,z} 1155 /** String \a fnt may contain: 1156 * ‘f’ for fixed format of printed numbers; 1157 * ‘E’ for using ‘E’ instead of ‘e’; 1158 * ‘F’ for printing in LaTeX format; 1159 * ‘+’ for printing ‘+’ for positive numbers; 1160 * ‘-’ for printing usual ‘-’; 1161 * ‘0123456789’ for precision at printing numbers.*/ 1162 inline void Label(const mglData &x, const mglData &y, const mglData &z, const char *text, const char *fnt="", const char *opt="") 1163 { mgl_label_xyz(gr, &x, &y, &z, text, fnt, opt); } 1164 /// Draw labels for points coordinate(s) at points {x,y} 1165 /** String \a fnt may contain: 1166 * ‘f’ for fixed format of printed numbers; 1167 * ‘E’ for using ‘E’ instead of ‘e’; 1168 * ‘F’ for printing in LaTeX format; 1169 * ‘+’ for printing ‘+’ for positive numbers; 1170 * ‘-’ for printing usual ‘-’; 1171 * ‘0123456789’ for precision at printing numbers.*/ 1172 inline void Label(const mglData &x, const mglData &y, const char *text, const char *fnt="", const char *opt="") 1173 { mgl_label_xy(gr, &x, &y, text, fnt, opt); } 1174 /// Draw labels for points coordinate(s) at points {x,y} with x in x-axis range 1175 /** String \a fnt may contain: 1176 * ‘f’ for fixed format of printed numbers; 1177 * ‘E’ for using ‘E’ instead of ‘e’; 1178 * ‘F’ for printing in LaTeX format; 1179 * ‘+’ for printing ‘+’ for positive numbers; 1180 * ‘-’ for printing usual ‘-’; 1181 * ‘0123456789’ for precision at printing numbers.*/ 1182 inline void Label(const mglData &y, const char *text, const char *fnt="", const char *opt="") 1183 { mgl_label_y(gr, &y, text, fnt, opt); } 1184 /// Draw labels for points coordinate(s) at points {x,y,z} 1185 /** String \a fnt may contain: 1186 * ‘f’ for fixed format of printed numbers; 1187 * ‘E’ for using ‘E’ instead of ‘e’; 1188 * ‘F’ for printing in LaTeX format; 1189 * ‘+’ for printing ‘+’ for positive numbers; 1190 * ‘-’ for printing usual ‘-’; 1191 * ‘0123456789’ for precision at printing numbers.*/ 1192 inline void Label(const mglData &x, const mglData &y, const mglData &z, const wchar_t *text, const char *fnt="", const char *opt="") 1193 { mgl_labelw_xyz(gr, &x, &y, &z, text, fnt, opt); } 1194 /// Draw labels for points coordinate(s) at points {x,y} 1195 /** String \a fnt may contain: 1196 * ‘f’ for fixed format of printed numbers; 1197 * ‘E’ for using ‘E’ instead of ‘e’; 1198 * ‘F’ for printing in LaTeX format; 1199 * ‘+’ for printing ‘+’ for positive numbers; 1200 * ‘-’ for printing usual ‘-’; 1201 * ‘0123456789’ for precision at printing numbers.*/ 1202 inline void Label(const mglData &x, const mglData &y, const wchar_t *text, const char *fnt="", const char *opt="") 1203 { mgl_labelw_xy(gr, &x, &y, text, fnt, opt); } 1204 /// Draw labels for points coordinate(s) at points {x,y} with x in x-axis range 1205 /** String \a fnt may contain: 1206 * ‘f’ for fixed format of printed numbers; 1207 * ‘E’ for using ‘E’ instead of ‘e’; 1208 * ‘F’ for printing in LaTeX format; 1209 * ‘+’ for printing ‘+’ for positive numbers; 1210 * ‘-’ for printing usual ‘-’; 1211 * ‘0123456789’ for precision at printing numbers.*/ 1212 inline void Label(const mglData &y, const wchar_t *text, const char *fnt="", const char *opt="") 1213 { mgl_labelw_y(gr, &y, text, fnt, opt); } 1214 1215 /// Draw table for values val along given direction with row labels text 1216 /** String \a fnt may contain: 1217 * ‘#’ for drawing cell borders; 1218 * ‘|’ for limiting table widh by subplot one (equal to option ‘value 1’); 1219 * ‘=’ for equal width of all cells; 1220 * ‘f’ for fixed format of printed numbers; 1221 * ‘E’ for using ‘E’ instead of ‘e’; 1222 * ‘F’ for printing in LaTeX format; 1223 * ‘+’ for printing ‘+’ for positive numbers; 1224 * ‘-’ for printing usual ‘-’; 1225 * ‘0123456789’ for precision at printing numbers. 1226 * Option value set the width of the table (default is 1).*/ 1227 inline void Table(const mglData &val, const char *text, const char *fnt="#|", const char *opt="") 1228 { mgl_table(gr, 0, 0, &val, text, fnt, opt); } 1229 /// Draw table for values val along given direction with row labels text 1230 /** String \a fnt may contain: 1231 * ‘#’ for drawing cell borders; 1232 * ‘|’ for limiting table widh by subplot one (equal to option ‘value 1’); 1233 * ‘=’ for equal width of all cells; 1234 * ‘f’ for fixed format of printed numbers; 1235 * ‘E’ for using ‘E’ instead of ‘e’; 1236 * ‘F’ for printing in LaTeX format; 1237 * ‘+’ for printing ‘+’ for positive numbers; 1238 * ‘-’ for printing usual ‘-’; 1239 * ‘0123456789’ for precision at printing numbers. 1240 * Option value set the width of the table (default is 1).*/ 1241 inline void Table(const mglData &val, const wchar_t *text, const char *fnt="#|", const char *opt="") 1242 { mgl_tablew(gr, 0, 0, &val, text, fnt, opt); } 1243 /// Draw table for values val along given direction with row labels text at given position 1244 /** String \a fnt may contain: 1245 * ‘#’ for drawing cell borders; 1246 * ‘|’ for limiting table widh by subplot one (equal to option ‘value 1’); 1247 * ‘=’ for equal width of all cells; 1248 * ‘f’ for fixed format of printed numbers; 1249 * ‘E’ for using ‘E’ instead of ‘e’; 1250 * ‘F’ for printing in LaTeX format; 1251 * ‘+’ for printing ‘+’ for positive numbers; 1252 * ‘-’ for printing usual ‘-’; 1253 * ‘0123456789’ for precision at printing numbers. 1254 * Option value set the width of the table (default is 1).*/ 1255 inline void Table(double x, double y, const mglData &val, const char *text, const char *fnt="#|", const char *opt="") 1256 { mgl_table(gr, x, y, &val, text, fnt, opt); } 1257 /// Draw table for values val along given direction with row labels text at given position 1258 /** String \a fnt may contain: 1259 * ‘#’ for drawing cell borders; 1260 * ‘|’ for limiting table widh by subplot one (equal to option ‘value 1’); 1261 * ‘=’ for equal width of all cells; 1262 * ‘f’ for fixed format of printed numbers; 1263 * ‘E’ for using ‘E’ instead of ‘e’; 1264 * ‘F’ for printing in LaTeX format; 1265 * ‘+’ for printing ‘+’ for positive numbers; 1266 * ‘-’ for printing usual ‘-’; 1267 * ‘0123456789’ for precision at printing numbers. 1268 * Option value set the width of the table (default is 1).*/ 1269 inline void Table(double x, double y, const mglData &val, const wchar_t *text, const char *fnt="#|", const char *opt="") 1270 { mgl_tablew(gr, x, y, &val, text, fnt, opt); } 1271 1272 /// Draw tube with radius r around curve {x,y,z} 1273 inline void Tube(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *pen="", const char *opt="") 1274 { mgl_tube_xyzr(gr, &x, &y, &z, &r, pen, opt); } 1275 /// Draw tube with radius r around curve {x,y,z} 1276 inline void Tube(const mglData &x, const mglData &y, const mglData &z, double r, const char *pen="", const char *opt="") 1277 { mgl_tube_xyz(gr, &x, &y, &z, r, pen, opt); } 1278 /// Draw tube with radius r around curve {x,y} 1279 inline void Tube(const mglData &x, const mglData &y, const mglData &r, const char *pen="", const char *opt="") 1280 { mgl_tube_xyr(gr, &x, &y, &r, pen, opt); } 1281 /// Draw tube with radius r around curve {x,y} 1282 inline void Tube(const mglData &x, const mglData &y, double r, const char *pen="", const char *opt="") 1283 { mgl_tube_xy(gr, &x, &y, r, pen, opt); } 1284 /// Draw tube with radius r around curve {x,y} with x in x-axis range 1285 inline void Tube(const mglData &y, const mglData &r, const char *pen="", const char *opt="") 1286 { mgl_tube_r(gr, &y, &r, pen, opt); } 1287 /// Draw tube with radius r around curve {x,y} with x in x-axis range 1288 inline void Tube(const mglData &y, double r, const char *pen="", const char *opt="") 1289 { mgl_tube(gr, &y, r, pen, opt); } 1290 /// Draw surface of curve {r,z} rotation around axis 1291 /** Style ‘#’ produce wire plot. Style ‘.’ produce plot by dots.*/ 1292 inline void Torus(const mglData &r, const mglData &z, const char *pen="", const char *opt="") 1293 { mgl_torus(gr, &r, &z, pen,opt); } 1294 1295 /// Draw mesh lines for 2d data specified parametrically 1296 inline void Mesh(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1297 { mgl_mesh_xy(gr, &x, &y, &z, stl, opt); } 1298 /// Draw mesh lines for 2d data 1299 inline void Mesh(const mglData &z, const char *stl="", const char *opt="") 1300 { mgl_mesh(gr, &z, stl, opt); } 1301 1302 /// Draw waterfall plot for 2d data specified parametrically 1303 /** Style 'x' draw lines in x-direction. */ 1304 inline void Fall(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1305 { mgl_fall_xy(gr, &x, &y, &z, stl, opt); } 1306 /// Draw waterfall plot for 2d data 1307 /** Style 'x' draw lines in x-direction. */ 1308 inline void Fall(const mglData &z, const char *stl="", const char *opt="") 1309 { mgl_fall(gr, &z, stl, opt); } 1310 1311 /// Draw belts for 2d data specified parametrically 1312 /** Style 'x' draw belts in x-direction. */ 1313 inline void Belt(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1314 { mgl_belt_xy(gr, &x, &y, &z, stl, opt); } 1315 /// Draw belts for 2d data 1316 /** Style 'x' draw belts in x-direction. */ 1317 inline void Belt(const mglData &z, const char *stl="", const char *opt="") 1318 { mgl_belt(gr, &z, stl, opt); } 1319 /// Draw belts for 2d data specified parametrically with color proportional to c 1320 /** Style 'x' draw belts in x-direction. */ 1321 inline void BeltC(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *stl="", const char *opt="") 1322 { mgl_beltc_xy(gr, &x, &y, &z, &c, stl, opt); } 1323 /// Draw belts for 2d data with color proportional to c 1324 /** Style 'x' draw belts in x-direction. */ 1325 inline void BeltC(const mglData &z, const mglData &c, const char *stl="", const char *opt="") 1326 { mgl_beltc(gr, &z, &c, stl, opt); } 1327 1328 /// Draw surface for 2d data specified parametrically with color proportional to z 1329 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1330 inline void Surf(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1331 { mgl_surf_xy(gr, &x, &y, &z, stl, opt); } 1332 /// Draw surface for 2d data with color proportional to z 1333 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1334 inline void Surf(const mglData &z, const char *stl="", const char *opt="") 1335 { mgl_surf(gr, &z, stl, opt); } 1336 1337 /// Draw grid lines for density plot of 2d data specified parametrically 1338 inline void Grid(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1339 { mgl_grid_xy(gr, &x, &y, &z, stl, opt); } 1340 /// Draw grid lines for density plot of 2d data 1341 inline void Grid(const mglData &z, const char *stl="", const char *opt="") 1342 { mgl_grid(gr, &z, stl, opt); } 1343 1344 /// Draw vertical tiles with manual colors c for 2d data specified parametrically 1345 inline void Tile(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *stl="", const char *opt="") 1346 { mgl_tile_xyc(gr, &x, &y, &z, &c, stl, opt); } 1347 /// Draw vertical tiles for 2d data specified parametrically 1348 inline void Tile(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1349 { mgl_tile_xy(gr, &x, &y, &z, stl, opt); } 1350 /// Draw vertical tiles for 2d data 1351 inline void Tile(const mglData &z, const char *stl="", const char *opt="") 1352 { mgl_tile(gr, &z, stl, opt); } 1353 1354 /// Draw density plot for 2d data specified parametrically 1355 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1356 inline void Dens(const mglData &x, const mglData &y, const mglData &c, const char *stl="", const char *opt="") 1357 { mgl_dens_xy(gr, &x, &y, &c, stl, opt); } 1358 /// Draw density plot for 2d data 1359 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1360 inline void Dens(const mglData &c, const char *stl="", const char *opt="") 1361 { mgl_dens(gr, &c, stl, opt); } 1362 1363 /// Draw vertical boxes for 2d data specified parametrically 1364 /** Style ‘#’ draw filled boxes. */ 1365 inline void Boxs(const mglData &x, const mglData &y, const mglData &z, const char *stl="", const char *opt="") 1366 { mgl_boxs_xy(gr, &x, &y, &z, stl, opt); } 1367 /// Draw vertical boxes for 2d data 1368 /** Style ‘#’ draw filled boxes. */ 1369 inline void Boxs(const mglData &z, const char *stl="", const char *opt="") 1370 { mgl_boxs(gr, &z, stl, opt); } 1371 1372 /// Draw contour lines on parametric surface at manual levels for 2d data specified parametrically 1373 /** Style ‘f’ to draw solid contours. 1374 * Style 't'/'T' draw contour labels below/above contours.*/ 1375 inline void ContP(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="") 1376 { mgl_contp_val(gr, &v, &x, &y, &z, &a, sch, opt); } 1377 /// Draw contour lines on parametric surface at manual levels for 2d data specified parametrically 1378 /** Style ‘f’ to draw solid contours. 1379 * Style ‘t’/‘T’ draw contour labels below/above contours. 1380 * Option "value" set the number of contour levels (default is 7). */ 1381 inline void ContP(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="") 1382 { mgl_contp(gr, &x, &y, &z, &a, sch, opt); } 1383 /// Draw contour lines at manual levels for 2d data specified parametrically 1384 /** Style ‘_’ to draw contours at bottom of axis box. 1385 * Style 't'/'T' draw contour labels below/above contours.*/ 1386 inline void Cont(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1387 { mgl_cont_xy_val(gr, &v, &x, &y, &z, sch, opt); } 1388 /// Draw contour lines for 2d data 1389 /** Style ‘_’ to draw contours at bottom of axis box. 1390 * Style 't'/'T' draw contour labels below/above contours.*/ 1391 inline void Cont(const mglData &v, const mglData &z, const char *sch="", const char *opt="") 1392 { mgl_cont_val(gr, &v, &z, sch, opt); } 1393 /// Draw contour lines at manual levels for 2d data specified parametrically 1394 /** Style ‘_’ to draw contours at bottom of axis box. 1395 * Style ‘t’/‘T’ draw contour labels below/above contours. 1396 * Option "value" set the number of contour levels (default is 7). */ 1397 inline void Cont(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1398 { mgl_cont_xy(gr, &x, &y, &z, sch, opt); } 1399 /// Draw contour lines for 2d data 1400 /** Style ‘_’ to draw contours at bottom of axis box. 1401 * Style ‘t’/‘T’ draw contour labels below/above contours. 1402 * Option "value" set the number of contour levels (default is 7). */ 1403 inline void Cont(const mglData &z, const char *sch="", const char *opt="") 1404 { mgl_cont(gr, &z, sch, opt); } 1405 /// Draw contour lines at a[i,j]=val specified parametrically 1406 /** Style 't'/'T' draw contour labels below/above contours.*/ 1407 inline void ContGen(mreal val, const mglData &a, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1408 { mgl_cont_gen(gr, val, &a, &x, &y, &z, sch, opt); } 1409 1410 /// Draw solid contours at manual levels for 2d data specified parametrically 1411 /** Style ‘_’ to draw contours at bottom of axis box. */ 1412 inline void ContF(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1413 { mgl_contf_xy_val(gr, &v, &x, &y, &z, sch, opt); } 1414 /// Draw solid contours at manual levels for 2d data 1415 /** Style ‘_’ to draw contours at bottom of axis box. */ 1416 inline void ContF(const mglData &v, const mglData &z, const char *sch="", const char *opt="") 1417 { mgl_contf_val(gr, &v, &z, sch, opt); } 1418 /// Draw solid contours for 2d data specified parametrically 1419 /** Style ‘_’ to draw contours at bottom of axis box. 1420 * Option "value" set the number of contour levels (default is 7). */ 1421 inline void ContF(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1422 { mgl_contf_xy(gr, &x, &y, &z, sch, opt); } 1423 /// Draw solid contours for 2d data 1424 /** Style ‘_’ to draw contours at bottom of axis box. 1425 * Option "value" set the number of contour levels (default is 7). */ 1426 inline void ContF(const mglData &z, const char *sch="", const char *opt="") 1427 { mgl_contf(gr, &z, sch, opt); } 1428 /// Draw solid contours between a[i,j]=v1 and a[i,j]=v2 specified parametrically */ 1429 inline void ContFGen(mreal v1, mreal v2, const mglData &a, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1430 { mgl_contf_gen(gr, v1,v2, &a, &x, &y, &z, sch, opt); } 1431 1432 /// Draw solid contours at manual levels for 2d data specified parametrically with specified colors 1433 /** Style ‘_’ to draw contours at bottom of axis box. */ 1434 inline void ContD(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1435 { mgl_contd_xy_val(gr, &v, &x, &y, &z, sch, opt); } 1436 /// Draw solid contours at manual levels for 2d data with specified colors 1437 /** Style ‘_’ to draw contours at bottom of axis box. */ 1438 inline void ContD(const mglData &v, const mglData &z, const char *sch="", const char *opt="") 1439 { mgl_contd_val(gr, &v, &z, sch, opt); } 1440 /// Draw solid contours for 2d data specified parametrically with specified colors 1441 /** Style ‘_’ to draw contours at bottom of axis box. 1442 * Option "value" set the number of contour levels (default is 7). */ 1443 inline void ContD(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1444 { mgl_contd_xy(gr, &x, &y, &z, sch, opt); } 1445 /// Draw solid contours for 2d data with specified colors 1446 /** Style ‘_’ to draw contours at bottom of axis box. 1447 * Option "value" set the number of contour levels (default is 7). */ 1448 inline void ContD(const mglData &z, const char *sch="", const char *opt="") 1449 { mgl_contd(gr, &z, sch, opt); } 1450 1451 /// Draw contour tubes between manual levels for 2d data specified parametrically 1452 /** Style ‘_’ to draw contours at bottom of axis box. */ 1453 inline void ContV(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1454 { mgl_contv_xy_val(gr, &v, &x, &y, &z, sch, opt); } 1455 /// Draw contour tubes between manual levels for 2d data 1456 /** Style ‘_’ to draw contours at bottom of axis box. */ 1457 inline void ContV(const mglData &v, const mglData &z, const char *sch="", const char *opt="") 1458 { mgl_contv_val(gr, &v, &z, sch, opt); } 1459 /// Draw contour tubes for 2d data specified parametrically 1460 /** Style ‘_’ to draw contours at bottom of axis box. 1461 * Option "value" set the number of contour levels (default is 7). */ 1462 inline void ContV(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1463 { mgl_contv_xy(gr, &x, &y, &z, sch, opt); } 1464 /// Draw contour tubes for 2d data 1465 /** Style ‘_’ to draw contours at bottom of axis box. 1466 * Option "value" set the number of contour levels (default is 7). */ 1467 inline void ContV(const mglData &z, const char *sch="", const char *opt="") 1468 { mgl_contv(gr, &z, sch, opt); } 1469 1470 /// Draw axial-symmetric isosurfaces at manual levels for 2d data specified parametrically 1471 /** String \a sch may contain: 1472 * ‘#’ for wired plot; 1473 * ‘.’ for plot by dots; 1474 * ‘x’, ‘z’ for rotation around x-, z-axis correspondingly (default is y-axis). */ 1475 inline void Axial(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1476 { mgl_axial_xy_val(gr, &v, &x, &y, &z, sch,opt); } 1477 /// Draw axial-symmetric isosurfaces at manual levels for 2d data 1478 /** String \a sch may contain: 1479 * ‘#’ for wired plot; 1480 * ‘.’ for plot by dots; 1481 * ‘x’, ‘z’ for rotation around x-, z-axis correspondingly (default is y-axis). */ 1482 inline void Axial(const mglData &v, const mglData &z, const char *sch="", const char *opt="") 1483 { mgl_axial_val(gr, &v, &z, sch, opt); } 1484 /// Draw axial-symmetric isosurfaces for 2d data specified parametrically 1485 /** String \a sch may contain: 1486 * ‘#’ for wired plot; 1487 * ‘.’ for plot by dots; 1488 * ‘x’, ‘z’ for rotation around x-, z-axis correspondingly (default is y-axis). 1489 * Option "value" set the number of isosurfaces (default is 3). */ 1490 inline void Axial(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 1491 { mgl_axial_xy(gr, &x, &y, &z, sch, opt); } 1492 /// Draw axial-symmetric isosurfaces for 2d data 1493 /** String \a sch may contain: 1494 * ‘#’ for wired plot; 1495 * ‘.’ for plot by dots; 1496 * ‘x’, ‘z’ for rotation around x-, z-axis correspondingly (default is y-axis). 1497 * Option "value" set the number of isosurfaces (default is 3). */ 1498 inline void Axial(const mglData &z, const char *sch="", const char *opt="") 1499 { mgl_axial(gr, &z, sch, opt); } 1500 1501 /// Draw curves of cross-section of isosurfaces a and b at manual levels for 3d data specified parametrically 1502 /** Style ‘t’/‘T’ draw contour labels below/above contours. */ 1503 inline void DCont(const mglData &v, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *sch="", const char *opt="") 1504 { mgl_dcont_xyz(gr, &v, &x, &y, &z, &a, &b, sch, opt); } 1505 /// Draw curves of cross-section of isosurfaces a and b at manual levels for 3d data 1506 /** Style ‘t’/‘T’ draw contour labels below/above contours. */ 1507 inline void DCont(const mglData &v, const mglData &a, const mglData &b, const char *sch="", const char *opt="") 1508 { mgl_dcont(gr, &v, &a, &b, sch, opt); } 1509 /// Draw curves of cross-section of isosurfaces a and b at manual levels for 3d data specified parametrically 1510 /** Style ‘t’/‘T’ draw contour labels below/above contours. 1511 * Option "value" set the number of isosurfaces (default is 3). */ 1512 inline void DCont(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *sch="", const char *opt="") 1513 { mgl_dcont_xyz(gr, NULL, &x, &y, &z, &a, &b, sch, opt); } 1514 /// Draw curves of cross-section of isosurfaces a and b at manual levels for 3d data 1515 /** Style ‘t’/‘T’ draw contour labels below/above contours. 1516 * Option "value" set the number of isosurfaces (default is 3). */ 1517 inline void DCont(const mglData &a, const mglData &b, const char *sch="", const char *opt="") 1518 { mgl_dcont(gr, NULL, &a, &b, sch, opt); } 1519 1520 /// Draw grid lines for density plot at slice for 3d data specified parametrically 1521 /** Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly.*/ 1522 inline void Grid3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", double sVal=-1, const char *opt="") 1523 { mgl_grid3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); } 1524 /// Draw grid lines for density plot at slice for 3d data 1525 /** Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly.*/ 1526 inline void Grid3(const mglData &a, const char *stl="", double sVal=-1, const char *opt="") 1527 { mgl_grid3(gr, &a, stl, sVal, opt); } 1528 1529 /// Draw density plot at slice for 3d data specified parametrically 1530 /** Style ‘#’ draw grid lines. Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly.*/ 1531 inline void Dens3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", double sVal=-1, const char *opt="") 1532 { mgl_dens3_xyz(gr, &x, &y, &z, &a, stl, sVal, opt); } 1533 /// Draw density plot at slice for 3d data 1534 /** Style ‘#’ draw grid lines. Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly.*/ 1535 inline void Dens3(const mglData &a, const char *stl="", double sVal=-1, const char *opt="") 1536 { mgl_dens3(gr, &a, stl, sVal, opt); } 1537 1538 /// Draw isosurface for 3d data specified parametrically 1539 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots.*/ 1540 inline void Surf3(double Val, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", const char *opt="") 1541 { mgl_surf3_xyz_val(gr, Val, &x, &y, &z, &a, stl, opt); } 1542 /// Draw isosurface for 3d data 1543 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots.*/ 1544 inline void Surf3(double Val, const mglData &a, const char *stl="", const char *opt="") 1545 { mgl_surf3_val(gr, Val, &a, stl, opt); } 1546 /// Draw isosurfaces for 3d data specified parametrically 1547 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1548 * Option "value" set the number of isosurfaces (default is 3). */ 1549 inline void Surf3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", const char *opt="") 1550 { mgl_surf3_xyz(gr, &x, &y, &z, &a, stl, opt); } 1551 /// Draw isosurfaces for 3d data 1552 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1553 * Option "value" set the number of isosurfaces (default is 3). */ 1554 inline void Surf3(const mglData &a, const char *stl="", const char *opt="") 1555 { mgl_surf3(gr, &a, stl, opt); } 1556 1557 /// Draw a semi-transparent cloud for 3d data specified parametrically 1558 /** Style ‘.’ produce plot by dots. Style ‘i’ use inverted values for transparency. */ 1559 inline void Cloud(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *stl="", const char *opt="") 1560 { mgl_cloud_xyz(gr, &x, &y, &z, &a, stl, opt); } 1561 /// Draw a semi-transparent cloud for 3d data 1562 /** Style ‘.’ produce plot by dots. Style ‘i’ use inverted values for transparency. */ 1563 inline void Cloud(const mglData &a, const char *stl="", const char *opt="") 1564 { mgl_cloud(gr, &a, stl, opt); } 1565 1566 /// Draw contour lines at manual levels along slice for 3d data specified parametrically 1567 /** Style ‘#’ draw grid lines. 1568 * Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. 1569 * Style ‘t’/‘T’ draw contour labels below/above contours. */ 1570 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="") 1571 { mgl_cont3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); } 1572 /// Draw contour lines at manual levels along slice for 3d data 1573 /** Style ‘#’ draw grid lines. 1574 * Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. 1575 * Style ‘t’/‘T’ draw contour labels below/above contours. */ 1576 inline void Cont3(const mglData &v, const mglData &a, const char *sch="", double sVal=-1, const char *opt="") 1577 { mgl_cont3_val(gr, &v, &a, sch, sVal, opt); } 1578 /// Draw contour lines along slice for 3d data specified parametrically 1579 /** Style ‘#’ draw grid lines. 1580 * Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. 1581 * Style ‘t’/‘T’ draw contour labels below/above contours. 1582 * Option "value" set the number of contour levels (default is 7). */ 1583 inline void Cont3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", double sVal=-1, const char *opt="") 1584 { mgl_cont3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); } 1585 /// Draw contour lines along slice for 3d data 1586 /** Style ‘#’ draw grid lines. 1587 * Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. 1588 * Style ‘t’/‘T’ draw contour labels below/above contours. 1589 * Option "value" set the number of contour levels (default is 7). */ 1590 inline void Cont3(const mglData &a, const char *sch="", double sVal=-1, const char *opt="") 1591 { mgl_cont3(gr, &a, sch, sVal, opt); } 1592 1593 /// Draw solid contours at manual levels along slice for 3d data specified parametrically 1594 /** Style ‘#’ draw grid lines. Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. */ 1595 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="") 1596 { mgl_contf3_xyz_val(gr, &v, &x, &y, &z, &a, sch, sVal, opt); } 1597 /// Draw solid contours at manual levels along slice for 3d data 1598 /** Style ‘#’ draw grid lines. Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. */ 1599 inline void ContF3(const mglData &v, const mglData &a, const char *sch="", double sVal=-1, const char *opt="") 1600 { mgl_contf3_val(gr, &v, &a, sch, sVal, opt); } 1601 /// Draw solid contours along slice for 3d data specified parametrically 1602 /** Style ‘#’ draw grid lines. Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. 1603 * Option "value" set the number of contour levels (default is 7).*/ 1604 inline void ContF3(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", double sVal=-1, const char *opt="") 1605 { mgl_contf3_xyz(gr, &x, &y, &z, &a, sch, sVal, opt); } 1606 /// Draw solid contours along slice for 3d data 1607 /** Style ‘#’ draw grid lines. Style ‘x’ or ‘z’ produce plot perpendicular to x- or z-direction correspondingly. 1608 * Option "value" set the number of contour levels (default is 7).*/ 1609 inline void ContF3(const mglData &a, const char *sch="", double sVal=-1, const char *opt="") 1610 { mgl_contf3(gr, &a, sch, sVal, opt); } 1611 1612 /// Draw several isosurfaces for 3d beam in curvilinear coordinates 1613 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots. 1614 * Variable \a flag is bitwise: 1615 * ‘0x1’ - draw in accompanied (not laboratory) coordinates; 1616 * ‘0x2’ - draw projection to \rho-z plane; 1617 * ‘0x4’ - draw normalized in each slice field.*/ 1618 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) 1619 { mgl_beam(gr, &tr,&g1,&g2,&a,r,stl,flag,num); } 1620 /// Draw isosurface at value \a val for 3d beam in curvilinear coordinates 1621 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots. 1622 * Variable \a flag is bitwise: 1623 * ‘0x1’ - draw in accompanied (not laboratory) coordinates; 1624 * ‘0x2’ - draw projection to \rho-z plane; 1625 * ‘0x4’ - draw normalized in each slice field.*/ 1626 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) 1627 { mgl_beam_val(gr,val,&tr,&g1,&g2,&a,r,stl,flag); } 1628 1629 /// Draw vertical tiles with variable size r and manual colors c for 2d data specified parametrically 1630 inline void TileS(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const mglData &c, const char *stl="", const char *opt="") 1631 { mgl_tiles_xyc(gr, &x, &y, &z, &r, &c, stl, opt); } 1632 /// Draw vertical tiles with variable size r for 2d data specified parametrically 1633 inline void TileS(const mglData &x, const mglData &y, const mglData &z, const mglData &r, const char *stl="", const char *opt="") 1634 { mgl_tiles_xy(gr, &x, &y, &z, &r, stl, opt); } 1635 /// Draw vertical tiles with variable size r for 2d data 1636 inline void TileS(const mglData &z, const mglData &r, const char *stl="", const char *opt="") 1637 { mgl_tiles(gr, &z, &r, stl, opt); } 1638 1639 /// Draw surface for 2d data specified parametrically with color proportional to c 1640 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1641 inline void SurfC(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="") 1642 { mgl_surfc_xy(gr, &x, &y, &z, &c, sch,opt); } 1643 /// Draw surface for 2d data with color proportional to c 1644 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1645 inline void SurfC(const mglData &z, const mglData &c, const char *sch="", const char *opt="") 1646 { mgl_surfc(gr, &z, &c, sch,opt); } 1647 1648 /// Draw surface for 2d data specified parametrically with alpha proportional to c 1649 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1650 inline void SurfA(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="") 1651 { mgl_surfa_xy(gr, &x, &y, &z, &c, sch,opt); } 1652 /// Draw surface for 2d data with alpha proportional to c 1653 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1654 inline void SurfA(const mglData &z, const mglData &c, const char *sch="", const char *opt="") 1655 { mgl_surfa(gr, &z, &c, sch,opt); } 1656 1657 /// Draw surface for 2d data specified parametrically with color proportional to c and alpha proportional to a 1658 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1659 inline void SurfCA(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const mglData &a, const char *sch="", const char *opt="") 1660 { mgl_surfca_xy(gr, &x, &y, &z, &c, &a, sch,opt); } 1661 /// Draw surface for 2d data with color proportional to c and alpha proportional to a 1662 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1663 inline void SurfCA(const mglData &z, const mglData &c, const mglData &a, const char *sch="", const char *opt="") 1664 { mgl_surfca(gr, &z, &c, &a, sch,opt); } 1665 1666 /// Color map of matrix a to matrix b, both matrix can parametrically depend on coordinates 1667 /** Style ‘.’ produce plot by dots. */ 1668 inline void Map(const mglData &x, const mglData &y, const mglData &a, const mglData &b, const char *sch="", const char *opt="") 1669 { mgl_map_xy(gr, &x, &y, &a, &b, sch, opt); } 1670 /// Color map of matrix a to matrix b 1671 /** Style ‘.’ produce plot by dots. */ 1672 inline void Map(const mglData &a, const mglData &b, const char *sch="", const char *opt="") 1673 { mgl_map(gr, &a, &b, sch, opt); } 1674 1675 /// Draw density plot for spectra-gramm specified parametrically 1676 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1677 inline void STFA(const mglData &x, const mglData &y, const mglData &re, const mglData &im, int dn, const char *sch="", const char *opt="") 1678 { mgl_stfa_xy(gr, &x, &y, &re, &im, dn, sch, opt); } 1679 /// Draw density plot for spectra-gramm 1680 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1681 inline void STFA(const mglData &re, const mglData &im, int dn, const char *sch="", const char *opt="") 1682 { mgl_stfa(gr, &re, &im, dn, sch, opt); } 1683 1684 /// Draw isosurface for 3d data specified parametrically with alpha proportional to b 1685 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. */ 1686 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="") 1687 { mgl_surf3a_xyz_val(gr, Val, &x, &y, &z, &a, &b, stl, opt); } 1688 /// Draw isosurface for 3d data with alpha proportional to b 1689 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. */ 1690 inline void Surf3A(double Val, const mglData &a, const mglData &b, const char *stl="", const char *opt="") 1691 { mgl_surf3a_val(gr, Val, &a, &b, stl, opt); } 1692 /// Draw isosurfaces for 3d data specified parametrically with alpha proportional to b 1693 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1694 * Option "value" set the number of isosurfaces (default is 3). */ 1695 inline void Surf3A(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &b, const char *stl="", const char *opt="") 1696 { mgl_surf3a_xyz(gr, &x, &y, &z, &a, &b, stl, opt); } 1697 /// Draw isosurfaces for 3d data with alpha proportional to b 1698 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1699 * Option "value" set the number of isosurfaces (default is 3). */ 1700 inline void Surf3A(const mglData &a, const mglData &b, const char *stl="", const char *opt="") 1701 { mgl_surf3a(gr, &a, &b, stl, opt); } 1702 1703 /// Draw isosurface for 3d data specified parametrically with color proportional to c 1704 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. */ 1705 inline void Surf3C(double Val, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &c, const char *stl="", const char *opt="") 1706 { mgl_surf3c_xyz_val(gr, Val, &x, &y, &z, &a, &c, stl,opt); } 1707 /// Draw isosurface for 3d data with color proportional to c 1708 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. */ 1709 inline void Surf3C(double Val, const mglData &a, const mglData &c, const char *stl="", const char *opt="") 1710 { mgl_surf3c_val(gr, Val, &a, &c, stl, opt); } 1711 /// Draw isosurfaces for 3d data specified parametrically with color proportional to c 1712 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1713 * Option "value" set the number of isosurfaces (default is 3). */ 1714 inline void Surf3C(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &c, const char *stl="", const char *opt="") 1715 { mgl_surf3c_xyz(gr, &x, &y, &z, &a, &c, stl, opt); } 1716 /// Draw isosurfaces for 3d data specified parametrically with color proportional to c 1717 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1718 * Option "value" set the number of isosurfaces (default is 3). */ 1719 inline void Surf3C(const mglData &a, const mglData &c, const char *stl="", const char *opt="") 1720 { mgl_surf3c(gr, &a, &c, stl, opt); } 1721 1722 /// Draw isosurface for 3d data specified parametrically with color proportional to c and alpha proportional to b 1723 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. */ 1724 inline void Surf3CA(double Val, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &c, const mglData &b, const char *stl="", const char *opt="") 1725 { mgl_surf3ca_xyz_val(gr, Val, &x, &y, &z, &a, &c, &b, stl,opt); } 1726 /// Draw isosurface for 3d data with color proportional to c and alpha proportional to b 1727 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. */ 1728 inline void Surf3CA(double Val, const mglData &a, const mglData &c, const mglData &b, const char *stl="", const char *opt="") 1729 { mgl_surf3ca_val(gr, Val, &a, &c, &b, stl, opt); } 1730 /// Draw isosurfaces for 3d data specified parametrically with color proportional to c and alpha proportional to b 1731 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1732 * Option "value" set the number of isosurfaces (default is 3). */ 1733 inline void Surf3CA(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &c, const mglData &b, const char *stl="", const char *opt="") 1734 { mgl_surf3ca_xyz(gr, &x, &y, &z, &a, &c, &b, stl, opt); } 1735 /// Draw isosurfaces for 3d data with color proportional to c and alpha proportional to b 1736 /** Style ‘#’ draw wired plot. Style ‘.’ produce plot by dots. 1737 * Option "value" set the number of isosurfaces (default is 3). */ 1738 inline void Surf3CA(const mglData &a, const mglData &c, const mglData &b, const char *stl="", const char *opt="") 1739 { mgl_surf3ca(gr, &a, &c, &b, stl, opt); } 1740 1741 /// Plot dew drops for vector field {ax,ay} parametrically depended on coordinate {x,y} 1742 inline void Dew(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1743 { mgl_dew_xy(gr, &x, &y, &ax, &ay, sch, opt); } 1744 /// Plot dew drops for vector field {ax,ay} 1745 inline void Dew(const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1746 { mgl_dew_2d(gr, &ax, &ay, sch, opt); } 1747 1748 /// Plot vectors at position {x,y} along {ax,ay} with length/color proportional to |a| 1749 /** Option value set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if value=0). */ 1750 inline void Traj(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1751 { mgl_traj_xy(gr, &x, &y, &ax, &ay, sch, opt); } 1752 /// Plot vectors at position {x,y,z} along {ax,ay,az} with length/color proportional to |a| 1753 /** Option value set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if value=0). */ 1754 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="") 1755 { mgl_traj_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); } 1756 1757 /// Plot vector field {ax,ay} parametrically depended on coordinate {x,y} with length/color proportional to |a| 1758 /** String \a sch may contain: 1759 * ‘f’ for drawing arrows with fixed lengths, 1760 * ‘ >’, ‘<’ for drawing arrows to or from the ce*ll point (default is centering), 1761 * ‘.’ for drawing hachures with dots instead of arrows, 1762 * ‘=’ for enabling color gradient along arrows. */ 1763 inline void Vect(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1764 { mgl_vect_xy(gr, &x, &y, &ax, &ay, sch, opt); } 1765 /// Plot vector field {ax,ay} with length/color proportional to |a| 1766 /** String \a sch may contain: 1767 * ‘f’ for drawing arrows with fixed lengths, 1768 * ‘ >’, ‘<’ for drawing arrows to or from the ce*ll point (default is centering), 1769 * ‘.’ for drawing hachures with dots instead of arrows, 1770 * ‘=’ for enabling color gradient along arrows. */ 1771 inline void Vect(const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1772 { mgl_vect_2d(gr, &ax, &ay, sch, opt); } 1773 /// Plot vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with length/color proportional to |a| 1774 /** String \a sch may contain: 1775 * ‘f’ for drawing arrows with fixed lengths, 1776 * ‘ >’, ‘<’ for drawing arrows to or from the ce*ll point (default is centering), 1777 * ‘.’ for drawing hachures with dots instead of arrows, 1778 * ‘=’ for enabling color gradient along arrows. */ 1779 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="") 1780 { mgl_vect_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); } 1781 /// Plot vector field {ax,ay,az} with length/color proportional to |a| 1782 /** String \a sch may contain: 1783 * ‘f’ for drawing arrows with fixed lengths, 1784 * ‘ >’, ‘<’ for drawing arrows to or from the ce*ll point (default is centering), 1785 * ‘.’ for drawing hachures with dots instead of arrows, 1786 * ‘=’ for enabling color gradient along arrows. */ 1787 inline void Vect(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="") 1788 { mgl_vect_3d(gr, &ax, &ay, &az, sch, opt); } 1789 1790 /// Draw vector plot along slice for 3d data specified parametrically 1791 /** String \a sch may contain: 1792 * ‘f’ for drawing arrows with fixed lengths, 1793 * ‘ >’, ‘<’ for drawing arrows to or from the ce*ll point (default is centering), 1794 * ‘.’ for drawing hachures with dots instead of arrows, 1795 * ‘=’ for enabling color gradient along arrows, 1796 * ‘ x’, ‘z’ for producing plot perpendicular to x- or z-direction correspondingly. */ 1797 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="") 1798 { mgl_vect3_xyz(gr, &x, &y, &z, &ax,&ay,&az, stl, sVal, opt); } 1799 /// Draw vector plot along slice for 3d data 1800 /** String \a sch may contain: 1801 * ‘f’ for drawing arrows with fixed lengths, 1802 * ‘ >’, ‘<’ for drawing arrows to or from the ce*ll point (default is centering), 1803 * ‘.’ for drawing hachures with dots instead of arrows, 1804 * ‘=’ for enabling color gradient along arrows, 1805 * ‘ x’, ‘z’ for producing plot perpendicular to x- or z-direction correspondingly. */ 1806 inline void Vect3(const mglData &ax, const mglData &ay, const mglData &az, const char *stl="", double sVal=-1, const char *opt="") 1807 { mgl_vect3(gr, &ax,&ay,&az, stl, sVal, opt); } 1808 1809 /// Plot flows for vector field {ax,ay} parametrically depended on coordinate {x,y} with color proportional to |a| 1810 /** String \a sch may contain: 1811 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1812 * ‘#’ for starting threads from edges only; 1813 * ‘v’ for drawing arrows on the threads; 1814 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1815 * Option "value" sets the number of threads (default is 5). */ 1816 inline void Flow(const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1817 { mgl_flow_xy(gr, &x, &y, &ax, &ay, sch, opt); } 1818 /// Plot flows for vector field {ax,ay} with color proportional to |a| 1819 /** String \a sch may contain: 1820 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1821 * ‘#’ for starting threads from edges only; 1822 * ‘v’ for drawing arrows on the threads; 1823 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1824 * Option "value" sets the number of threads (default is 5). */ 1825 inline void Flow(const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1826 { mgl_flow_2d(gr, &ax, &ay, sch, opt); } 1827 /// Plot flows for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color proportional to |a| 1828 /** String \a sch may contain: 1829 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1830 * ‘#’ for starting threads from edges only; 1831 * ‘v’ for drawing arrows on the threads; 1832 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1833 * Option "value" sets the number of threads (default is 5). */ 1834 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="") 1835 { mgl_flow_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, opt); } 1836 /// Plot flows for vector field {ax,ay,az} with color proportional to |a| 1837 /** String \a sch may contain: 1838 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1839 * ‘#’ for starting threads from edges only; 1840 * ‘v’ for drawing arrows on the threads; 1841 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1842 * Option "value" sets the number of threads (default is 5). */ 1843 inline void Flow(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="") 1844 { mgl_flow_3d(gr, &ax, &ay, &az, sch, opt); } 1845 1846 /// Plot flow from point p for vector field {ax,ay} parametrically depended on coordinate {x,y} with color proportional to |a| 1847 /** String \a sch may contain: 1848 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1849 * ‘#’ for starting threads from edges only; 1850 * ‘v’ for drawing arrows on the threads. */ 1851 inline void FlowP(mglPoint p, const mglData &x, const mglData &y, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1852 { mgl_flowp_xy(gr, p.x, p.y, p.z, &x, &y, &ax, &ay, sch, opt); } 1853 /// Plot flow from point p for vector field {ax,ay} with color proportional to |a| 1854 /** String \a sch may contain: 1855 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1856 * ‘#’ for starting threads from edges only; 1857 * ‘v’ for drawing arrows on the threads. */ 1858 inline void FlowP(mglPoint p, const mglData &ax, const mglData &ay, const char *sch="", const char *opt="") 1859 { mgl_flowp_2d(gr, p.x, p.y, p.z, &ax, &ay, sch, opt); } 1860 /// Plot flow from point p for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color proportional to |a| 1861 /** String \a sch may contain: 1862 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1863 * ‘#’ for starting threads from edges only; 1864 * ‘v’ for drawing arrows on the threads; 1865 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. */ 1866 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="") 1867 { mgl_flowp_xyz(gr, p.x, p.y, p.z, &x, &y, &z, &ax, &ay, &az, sch, opt); } 1868 /// Plot flow from point p for vector field {ax,ay,az} with color proportional to |a| 1869 /** String \a sch may contain: 1870 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1871 * ‘#’ for starting threads from edges only; 1872 * ‘v’ for drawing arrows on the threads; 1873 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. */ 1874 inline void FlowP(mglPoint p, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", const char *opt="") 1875 { mgl_flowp_3d(gr, p.x, p.y, p.z, &ax, &ay, &az, sch, opt); } 1876 1877 /// Plot flows from given plain for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color proportional to |a| 1878 /** String \a sch may contain: 1879 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1880 * 'v' for drawing arrows on the threads; 1881 * 't' for drawing tapes of normals in x-y and y-z planes. 1882 * Option "value" sets the number of threads (default is 5). */ 1883 inline void Flow3(const mglData &x, const mglData &y, const mglData &z, const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", double sVal=-1, const char *opt="") 1884 { mgl_flow3_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, sVal, opt); } 1885 /// Plot flows from given plain for vector field {ax,ay,az} with color proportional to |a| 1886 /** String \a sch may contain: 1887 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1888 * 'v' for drawing arrows on the threads; 1889 * 't' for drawing tapes of normals in x-y and y-z planes. 1890 * Option "value" sets the number of threads (default is 5). */ 1891 inline void Flow3(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", double sVal=-1, const char *opt="") 1892 { mgl_flow3(gr, &ax, &ay, &az, sch, sVal, opt); } 1893 /// Plot flows for gradient of scalar field phi parametrically depended on coordinate {x,y,z} 1894 /** String \a sch may contain: 1895 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1896 * ‘#’ for starting threads from edges only; 1897 * ‘v’ for drawing arrows on the threads; 1898 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1899 * Option "value" sets the number of threads (default is 5). */ 1900 inline void Grad(const mglData &x, const mglData &y, const mglData &z, const mglData &phi, const char *sch="", const char *opt="") 1901 { mgl_grad_xyz(gr,&x,&y,&z,&phi,sch,opt); } 1902 /// Plot flows for gradient of scalar field phi parametrically depended on coordinate {x,y} 1903 /** String \a sch may contain: 1904 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1905 * ‘#’ for starting threads from edges only; 1906 * ‘v’ for drawing arrows on the threads; 1907 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1908 * Option "value" sets the number of threads (default is 5). */ 1909 inline void Grad(const mglData &x, const mglData &y, const mglData &phi, const char *sch="", const char *opt="") 1910 { mgl_grad_xy(gr,&x,&y,&phi,sch,opt); } 1911 /// Plot flows for gradient of scalar field phi 1912 /** String \a sch may contain: 1913 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1914 * ‘#’ for starting threads from edges only; 1915 * ‘v’ for drawing arrows on the threads; 1916 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1917 * Option "value" sets the number of threads (default is 5). */ 1918 inline void Grad(const mglData &phi, const char *sch="", const char *opt="") 1919 { mgl_grad(gr,&phi,sch,opt); } 1920 1921 /// Plot flow pipes for vector field {ax,ay} parametrically depended on coordinate {x,y} with color and radius proportional to |a| 1922 /** String \a sch may contain: 1923 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1924 * ‘#’ for starting threads from edges only; 1925 * ‘i’ for pipe radius to be inverse proportional to amplitude. 1926 * Option "value" sets the number of threads (default is 5). */ 1927 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="") 1928 { mgl_pipe_xy(gr, &x, &y, &ax, &ay, sch, r0, opt); } 1929 /// Plot flow pipes for vector field {ax,ay} with color and radius proportional to |a| 1930 /** String \a sch may contain: 1931 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1932 * ‘#’ for starting threads from edges only; 1933 * ‘i’ for pipe radius to be inverse proportional to amplitude. 1934 * Option "value" sets the number of threads (default is 5). */ 1935 inline void Pipe(const mglData &ax, const mglData &ay, const char *sch="", double r0=0.05, const char *opt="") 1936 { mgl_pipe_2d(gr, &ax, &ay, sch, r0, opt); } 1937 /// Plot flow pipes for vector field {ax,ay,az} parametrically depended on coordinate {x,y,z} with color and radius proportional to |a| 1938 /** String \a sch may contain: 1939 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1940 * ‘#’ for starting threads from edges only; 1941 * ‘i’ for pipe radius to be inverse proportional to amplitude; 1942 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1943 * Option "value" sets the number of threads (default is 5). */ 1944 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="") 1945 { mgl_pipe_xyz(gr, &x, &y, &z, &ax, &ay, &az, sch, r0, opt); } 1946 /// Plot flow pipes for vector field {ax,ay,az} with color and radius proportional to |a| 1947 /** String \a sch may contain: 1948 * color scheme: up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source); 1949 * ‘#’ for starting threads from edges only; 1950 * ‘i’ for pipe radius to be inverse proportional to amplitude; 1951 * ‘x’, ‘z’ for drawing tapes of normals in x-y and y-z planes correspondingly. 1952 * Option "value" sets the number of threads (default is 5). */ 1953 inline void Pipe(const mglData &ax, const mglData &ay, const mglData &az, const char *sch="", double r0=0.05, const char *opt="") 1954 { mgl_pipe_3d(gr, &ax, &ay, &az, sch, r0, opt); } 1955 1956 /// Draw density plot for data at x = sVal 1957 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1958 inline void DensX(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1959 { mgl_dens_x(gr, &a, stl, sVal, opt); } 1960 /// Draw density plot for data at y = sVal 1961 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1962 inline void DensY(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1963 { mgl_dens_y(gr, &a, stl, sVal, opt); } 1964 /// Draw density plot for data at z = sVal 1965 /** Style ‘#’ draw grid lines. Style ‘.’ produce plot by dots.*/ 1966 inline void DensZ(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1967 { mgl_dens_z(gr, &a, stl, sVal, opt); } 1968 1969 /// Draw contour lines for data at x = sVal 1970 /** Style ‘t’/‘T’ draw contour labels below/above contours. 1971 * Option "value" set the number of contour levels (default is 7). */ 1972 inline void ContX(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1973 { mgl_cont_x(gr, &a, stl, sVal, opt); } 1974 /// Draw contour lines at manual levels for data at x = sVal 1975 /** Style ‘t’/‘T’ draw contour labels below/above contours. */ 1976 inline void ContX(const mglData &v, const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1977 { mgl_cont_x_val(gr, &v, &a, stl, sVal, opt); } 1978 /// Draw contour lines for data at y = sVal 1979 /** Style ‘t’/‘T’ draw contour labels below/above contours. 1980 * Option "value" set the number of contour levels (default is 7). */ 1981 inline void ContY(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1982 { mgl_cont_y(gr, &a, stl, sVal, opt); } 1983 /// Draw contour lines at manual levels for data at y = sVal 1984 /** Style ‘t’/‘T’ draw contour labels below/above contours. */ 1985 inline void ContY(const mglData &v, const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1986 { mgl_cont_y_val(gr, &v, &a, stl, sVal, opt); } 1987 /// Draw contour lines for data at z = sVal 1988 /** Style ‘t’/‘T’ draw contour labels below/above contours. 1989 * Option "value" set the number of contour levels (default is 7). */ 1990 inline void ContZ(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1991 { mgl_cont_z(gr, &a, stl, sVal, opt); } 1992 /// Draw contour lines at manual levels for data at z = sVal 1993 /** Style ‘t’/‘T’ draw contour labels below/above contours. */ 1994 inline void ContZ(const mglData &v, const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 1995 { mgl_cont_z_val(gr, &v, &a, stl, sVal, opt); } 1996 1997 /// Draw solid contours for data at x = sVal 1998 /** Option "value" set the number of contour levels (default is 7). */ 1999 inline void ContFX(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 2000 { mgl_contf_x(gr, &a, stl, sVal, opt); } 2001 /// Draw solid contours at manual levels for data at x = sVal 2002 inline void ContFX(const mglData &v, const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 2003 { mgl_contf_x_val(gr, &v, &a, stl, sVal, opt); } 2004 /// Draw solid contours for data at y = sVal 2005 /** Option "value" set the number of contour levels (default is 7). */ 2006 inline void ContFY(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 2007 { mgl_contf_y(gr, &a, stl, sVal, opt); } 2008 /// Draw solid contours at manual levels for data at y = sVal 2009 inline void ContFY(const mglData &v, const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 2010 { mgl_contf_y_val(gr, &v, &a, stl, sVal, opt); } 2011 /// Draw solid contours for data at z = sVal 2012 /** Option "value" set the number of contour levels (default is 7). */ 2013 inline void ContFZ(const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 2014 { mgl_contf_z(gr, &a, stl, sVal, opt); } 2015 /// Draw solid contours at manual levels for data at z = sVal 2016 inline void ContFZ(const mglData &v, const mglData &a, const char *stl="", double sVal=mglNaN, const char *opt="") 2017 { mgl_contf_z_val(gr, &v, &a, stl, sVal, opt); } 2018 2019 /// Draw curve for formula with x in x-axis range 2020 /** Option "value" set initial number of points. */ 2021 inline void FPlot(const char *fy, const char *stl="", const char *opt="") 2022 { mgl_fplot(gr, fy, stl, opt); } 2023 /// Draw curve for formulas parametrically depended on t in range [0,1] 2024 /** Option "value" set initial number of points. */ 2025 inline void FPlot(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="") 2026 { mgl_fplot_xyz(gr, fx, fy, fz, stl, opt); } 2027 /// Draw surface by formula with x,y in axis range 2028 /** Option "value" set initial number of points. */ 2029 inline void FSurf(const char *fz, const char *stl="", const char *opt="") 2030 { mgl_fsurf(gr, fz, stl, opt); } 2031 /// Draw surface by formulas parametrically depended on u,v in range [0,1] 2032 /** Option "value" set initial number of points. */ 2033 inline void FSurf(const char *fx, const char *fy, const char *fz, const char *stl, const char *opt="") 2034 { mgl_fsurf_xyz(gr, fx, fy, fz, stl, opt); } 2035 2036 /// Draw triangle mesh for points in arrays {x,y,z} with specified color c. 2037 /** Style ‘#’ produce wire plot. If id.ny=c.nx then c set the triangle colors, else vertex colors. */ 2038 inline void TriPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="") 2039 { mgl_triplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); } 2040 /// Draw triangle mesh for points in arrays {x,y,z} 2041 /** Style ‘#’ produce wire plot. */ 2042 inline void TriPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2043 { mgl_triplot_xyz(gr, &nums, &x, &y, &z, sch, opt); } 2044 /// Draw triangle mesh for points in arrays {x,y} 2045 /** Style ‘#’ produce wire plot. */ 2046 inline void TriPlot(const mglData &nums, const mglData &x, const mglData &y, const char *sch="", const char *opt="") 2047 { mgl_triplot_xy(gr, &nums, &x, &y, sch, opt); } 2048 2049 /// Draw quad mesh for points in arrays {x,y,z} with specified color c 2050 /** Style ‘#’ produce wire plot. If id.ny=c.nx then c set the quadrangle colors, else vertex colors. */ 2051 inline void QuadPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &c, const char *sch="", const char *opt="") 2052 { mgl_quadplot_xyzc(gr, &nums, &x, &y, &z, &c, sch, opt); } 2053 /// Draw quad mesh for points in arrays {x,y,z} 2054 /** Style ‘#’ produce wire plot. */ 2055 inline void QuadPlot(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2056 { mgl_quadplot_xyz(gr, &nums, &x, &y, &z, sch, opt); } 2057 /// Draw quad mesh for points in arrays {x,y} 2058 /** Style ‘#’ produce wire plot. */ 2059 inline void QuadPlot(const mglData &nums, const mglData &x, const mglData &y, const char *sch="", const char *opt="") 2060 { mgl_quadplot_xy(gr, &nums, &x, &y, sch, opt); } 2061 2062 /// Draw contour lines for triangle mesh for points in arrays {x,y,z} 2063 /** Style ‘_’ to draw contours at bottom of axis box. 2064 * Style ‘t’/‘T’ draw contour labels below/above contours. 2065 * If id.ny=c.nx then c set the quadrangle colors, else vertex colors. */ 2066 inline void TriCont(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2067 { mgl_tricont_xyc(gr, &nums, &x, &y, &z, sch, opt); } 2068 /// Draw contour lines for triangle mesh for points in arrays {x,y,z} 2069 /** Style ‘_’ to draw contours at bottom of axis box. 2070 * Style ‘t’/‘T’ draw contour labels below/above contours. 2071 * If id.ny=c.nx then c set the quadrangle colors, else vertex colors. 2072 * Option "value" set the number of contour levels (default is 7). */ 2073 inline void TriContV(const mglData &v, const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2074 { mgl_tricont_xycv(gr, &v, &nums, &x, &y, &z, sch, opt); } 2075 /// Draw contour lines for triangle mesh for points in arrays {x,y,z} with specified color c. 2076 /** Style ‘_’ to draw contours at bottom of axis box. 2077 * Style ‘t’/‘T’ draw contour labels below/above contours. 2078 * If id.ny=c.nx then c set the quadrangle colors, else vertex colors. */ 2079 inline void TriCont(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="") 2080 { mgl_tricont_xyzc(gr, &nums, &x, &y, &z, &a, sch, opt); } 2081 /// Draw contour lines for triangle mesh for points in arrays {x,y,z} with specified color c. 2082 /** Style ‘_’ to draw contours at bottom of axis box. 2083 * Style ‘t’/‘T’ draw contour labels below/above contours. 2084 * If id.ny=c.nx then c set the quadrangle colors, else vertex colors. */ 2085 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="") 2086 { mgl_tricont_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); } 2087 /// Draw contour lines for triangle mesh for points in arrays {x,y,z} with specified color c. 2088 /** Style ‘_’ to draw contours at bottom of axis box. 2089 * Style ‘t’/‘T’ draw contour labels below/above contours. 2090 * If id.ny=c.nx then c set the quadrangle colors, else vertex colors. */ 2091 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="") 2092 { mgl_tricont_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); } 2093 2094 /// Draw contour tubes for triangle mesh for points in arrays {x,y,z} 2095 /** Option "value" set the number of contour levels (default is 7). */ 2096 inline void TriContVt(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2097 { mgl_tricontv_xyc(gr, &nums, &x, &y, &z, sch, opt); } 2098 /// Draw contour tubes for triangle mesh for points in arrays {x,y,z} with specified color c 2099 /** Option "value" set the number of contour levels (default is 7). */ 2100 inline void TriContVt(const mglData &nums, const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="") 2101 { mgl_tricontv_xyzc(gr, &nums, &x, &y, &z, &a, sch, opt); } 2102 /// Draw contour tubes for triangle mesh for points in arrays {x,y,z} with specified color c 2103 /** If id.ny=c.nx then c set the quadrangle colors, else vertex colors. */ 2104 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="") 2105 { mgl_tricontv_xyzcv(gr, &v, &nums, &x, &y, &z, &a, sch, opt); } 2106 2107 /// Draw dots in points {x,y,z}. 2108 inline void Dots(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2109 { mgl_dots(gr, &x, &y, &z, sch, opt); } 2110 /// Draw semitransparent dots in points {x,y,z} with specified alpha a. 2111 inline void Dots(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *sch="", const char *opt="") 2112 { mgl_dots_a(gr, &x, &y, &z, &a, sch, opt); } 2113 /// Draw semitransparent dots in points {x,y,z} with specified color c and alpha a. 2114 inline void Dots(const mglData &x, const mglData &y, const mglData &z, const mglData &c, const mglData &a, const char *sch="", const char *opt="") 2115 { mgl_dots_ca(gr, &x, &y, &z, &c, &a, sch, opt); } 2116 /// Draw surface reconstructed for points in arrays {x,y,z}. 2117 /** Style ‘#’ produce wired plot. */ 2118 inline void Crust(const mglData &x, const mglData &y, const mglData &z, const char *sch="", const char *opt="") 2119 { mgl_crust(gr, &x, &y, &z, sch, opt); } 2120 2121 /// Fit data along x-direction for each data row. Return array with values for found formula. 2122 inline mglData Fit(const mglData &y, const char *eq, const char *vars, const char *opt="") 2123 { return mglData(true,mgl_fit_1(gr, &y, eq,vars,0, opt)); } 2124 /// Fit data along x-direction for each data row starting from \a ini values. Return array with values for found formula. 2125 inline mglData Fit(const mglData &y, const char *eq, const char *vars, mglData &ini, const char *opt="") 2126 { return mglData(true,mgl_fit_1(gr, &y, eq, vars, &ini, opt)); } 2127 /// Fit data along x-, y-directions for each data slice. Return array with values for found formula. 2128 inline mglData Fit2(const mglData &z, const char *eq, const char *vars, const char *opt="") 2129 { return mglData(true,mgl_fit_2(gr, &z, eq, vars,0, opt)); } 2130 /// Fit data along x-, y-direction for each data slice starting from \a ini values. Return array with values for found formula. 2131 inline mglData Fit2(const mglData &z, const char *eq, const char *vars, mglData &ini, const char *opt="") 2132 { return mglData(true,mgl_fit_2(gr, &z, eq, vars, &ini, opt)); } 2133 /// Fit data along along all directions. Return array with values for found formula. 2134 inline mglData Fit3(const mglData &a, const char *eq, const char *vars, const char *opt="") 2135 { return mglData(true,mgl_fit_3(gr, &a, eq, vars,0, opt)); } 2136 /// Fit data along all directions starting from \a ini values. Return array with values for found formula. 2137 inline mglData Fit3(const mglData &a, const char *eq, const char *vars, mglData &ini, const char *opt="") 2138 { return mglData(true,mgl_fit_3(gr, &a, eq, vars, &ini, opt)); } 2139 2140 /// Fit data along x-direction for each data row. Return array with values for found formula. 2141 inline mglData Fit(const mglData &x, const mglData &y, const char *eq, const char *vars, const char *opt="") 2142 { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, vars,0, opt)); } 2143 /// Fit data along x-direction for each data row starting from \a ini values. Return array with values for found formula. 2144 inline mglData Fit(const mglData &x, const mglData &y, const char *eq, const char *vars, mglData &ini, const char *opt="") 2145 { return mglData(true,mgl_fit_xy(gr, &x, &y, eq, vars, &ini, opt)); } 2146 /// Fit data along x-, y-directions for each data slice. Return array with values for found formula. 2147 inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const char *eq, const char *vars, const char *opt="") 2148 { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, vars,0, opt)); } 2149 /// Fit data along x-, y-directions for each data slice starting from \a ini values. Return array with values for found formula. 2150 inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const char *eq, const char *vars, mglData &ini, const char *opt="") 2151 { return mglData(true,mgl_fit_xyz(gr, &x, &y, &z, eq, vars, &ini, opt)); } 2152 /// Fit data along along all directions. Return array with values for found formula. 2153 inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *eq, const char *vars, const char *opt="") 2154 { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq, vars,0, opt)); } 2155 /// Fit data along along all directions starting from \a ini values. Return array with values for found formula. 2156 inline mglData Fit(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *eq, const char *vars, mglData &ini, const char *opt="") 2157 { return mglData(true,mgl_fit_xyza(gr, &x, &y, &z, &a, eq,vars, &ini, opt)); } 2158 2159 /// Fit data with dispersion s along x-direction for each data row. Return array with values for found formula. 2160 inline mglData FitS(const mglData &y, const mglData &s, const char *eq, const char *vars, const char *opt="") 2161 { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, vars,0, opt)); } 2162 /// Fit data with dispersion s along x-direction for each data row starting from \a ini values. Return array with values for found formula. 2163 inline mglData FitS(const mglData &y, const mglData &s, const char *eq, const char *vars, mglData &ini, const char *opt="") 2164 { return mglData(true,mgl_fit_ys(gr, &y, &s, eq, vars, &ini, opt)); } 2165 /// Fit data with dispersion s along x-direction for each data row. Return array with values for found formula. 2166 inline mglData FitS(const mglData &x, const mglData &y, const mglData &s, const char *eq, const char *vars, const char *opt="") 2167 { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, vars,0, opt)); } 2168 /// Fit data with dispersion s along x-direction for each data row starting from \a ini values. Return array with values for found formula. 2169 inline mglData FitS(const mglData &x, const mglData &y, const mglData &s, const char *eq, const char *vars, mglData &ini, const char *opt="") 2170 { return mglData(true,mgl_fit_xys(gr, &x, &y, &s, eq, vars, &ini, opt)); } 2171 /// Fit data with dispersion s along x-, y-directions for each data slice. Return array with values for found formula. 2172 inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &s, const char *eq, const char *vars, const char *opt="") 2173 { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, vars,0, opt)); } 2174 /// Fit data with dispersion s along x-, y-directions for each data slice starting from \a ini values. Return array with values for found formula. 2175 inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &s, const char *eq, const char *vars, mglData &ini, const char *opt="") 2176 { return mglData(true,mgl_fit_xyzs(gr, &x, &y, &z, &s, eq, vars, &ini, opt)); } 2177 /// Fit data with dispersion s along all directions. Return array with values for found formula. 2178 inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &s, const char *eq, const char *vars, const char *opt="") 2179 { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, vars,0, opt)); } 2180 /// Fit data with dispersion s along all directions starting from \a ini values. Return array with values for found formula. 2181 inline mglData FitS(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const mglData &s, const char *eq, const char *vars, mglData &ini, const char *opt="") 2182 { return mglData(true,mgl_fit_xyzas(gr, &x, &y, &z, &a, &s, eq, vars, &ini, opt)); } 2183 2184 /// Print fitted last formula (with coefficients) 2185 inline void PutsFit(mglPoint p, const char *prefix=0, const char *font="", double size=-1) 2186 { mgl_puts_fit(gr, p.x, p.y, p.z, prefix, font, size); } 2187 /// Get last fitted formula GetFit()2188 inline const char *GetFit() const 2189 { return mgl_get_fit(gr); } 2190 /// Get chi for last fitted formula GetFitChi()2191 static inline mreal GetFitChi() 2192 { return mgl_get_fit_chi(); } 2193 /// Get covariance matrix for last fitted formula GetFitCovar()2194 static inline mglData GetFitCovar() 2195 { return mglData(mgl_get_fit_covar()); } 2196 2197 /// Solve PDE with x,y,z in range axis range 2198 inline mglData PDE(const char *ham, const mglData &ini_re, const mglData &ini_im, double dz=0.1, double k0=100, const char *opt="") 2199 { return mglData(true,mgl_pde_solve(gr,ham,&ini_re,&ini_im,dz,k0, opt)); } 2200 /// Solve PDE with x,y,z in range axis range 2201 inline mglDataC PDEc(const char *ham, const mglData &ini_re, const mglData &ini_im, double dz=0.1, double k0=100, const char *opt="") 2202 { return mglDataC(true,mgl_pde_solve_c(gr,ham,&ini_re,&ini_im,dz,k0, opt)); } 2203 2204 /// Solve PDE with x,y,z in range axis range using advanced (slow!!!) method (2d only) 2205 inline mglData APDE(const char *ham, const mglData &ini_re, const mglData &ini_im, double dz=0.1, double k0=100, const char *opt="") 2206 { return mglData(true,mgl_pde_adv(gr,ham,&ini_re,&ini_im,dz,k0, opt)); } 2207 /// Solve PDE with x,y,z in range axis range using advanced (slow!!!) method (2d only) 2208 inline mglDataC APDEc(const char *ham, const mglData &ini_re, const mglData &ini_im, double dz=0.1, double k0=100, const char *opt="") 2209 { return mglDataC(true,mgl_pde_adv_c(gr,ham,&ini_re,&ini_im,dz,k0, opt)); } 2210 2211 /// Fill data by formula with x,y,z in range axis range 2212 inline void Fill(mglData &u, const char *eq, const char *opt="") 2213 { mgl_data_fill_eq(gr, &u, eq, 0, 0, opt); } 2214 inline void Fill(mglData &u, const char *eq, const mglData &v, const char *opt="") 2215 { mgl_data_fill_eq(gr, &u, eq, &v, 0, opt); } 2216 inline void Fill(mglData &u, const char *eq, const mglData &v, const mglData &w, const char *opt="") 2217 { mgl_data_fill_eq(gr, &u, eq, &v, &w, opt); } 2218 /// Fill data by formula with x,y,z in range axis range 2219 inline void Fill(mglDataC &u, const char *eq, const char *opt="") 2220 { mgl_datac_fill_eq(gr, &u, eq, 0, 0, opt); } 2221 inline void Fill(mglDataC &u, const char *eq, const mglData &v, const char *opt="") 2222 { mgl_datac_fill_eq(gr, &u, eq, &v, 0, opt); } 2223 inline void Fill(mglDataC &u, const char *eq, const mglData &v, const mglData &w, const char *opt="") 2224 { mgl_datac_fill_eq(gr, &u, eq, &v, &w, opt); } 2225 2226 /// Fill dat by interpolated values of vdat parametrically depended on xdat for x in axis range 2227 inline void Refill(mglData &dat, const mglData &xdat, const mglData &vdat, long sl=-1, const char *opt="") 2228 { mgl_data_refill_gr(gr,&dat,&xdat,0,0,&vdat,sl,opt); } 2229 /// Fill dat by interpolated values of vdat parametrically depended on xdat,ydat for x,y in axis range 2230 inline void Refill(mglData &dat, const mglData &xdat, const mglData &ydat, const mglData &vdat, long sl=-1, const char *opt="") 2231 { mgl_data_refill_gr(gr,&dat,&xdat,&ydat,0,&vdat,sl,opt); } 2232 /// Fill dat by interpolated values of vdat parametrically depended on xdat,ydat,zdat for x,y,z in axis range 2233 inline void Refill(mglData &dat, const mglData &xdat, const mglData &ydat, const mglData &zdat, const mglData &vdat, const char *opt="") 2234 { mgl_data_refill_gr(gr,&dat,&xdat,&ydat,&zdat,&vdat,-1,opt); } 2235 2236 /// Fill dat by interpolated values of vdat parametrically depended on xdat for x in axis range 2237 inline void Refill(mglDataC &dat, const mglData &xdat, const mglData &vdat, long sl=-1, const char *opt="") 2238 { mgl_datac_refill_gr(gr,&dat,&xdat,0,0,&vdat,sl,opt); } 2239 /// Fill dat by interpolated values of vdat parametrically depended on xdat,ydat for x,y in axis range 2240 inline void Refill(mglDataC &dat, const mglData &xdat, const mglData &ydat, const mglData &vdat, long sl=-1, const char *opt="") 2241 { mgl_datac_refill_gr(gr,&dat,&xdat,&ydat,0,&vdat,sl,opt); } 2242 /// Fill dat by interpolated values of vdat parametrically depended on xdat,ydat,zdat for x,y,z in axis range 2243 inline void Refill(mglDataC &dat, const mglData &xdat, const mglData &ydat, const mglData &zdat, const mglData &vdat, const char *opt="") 2244 { mgl_datac_refill_gr(gr,&dat,&xdat,&ydat,&zdat,&vdat,-1,opt); } 2245 2246 /// Set the data by triangulated surface values assuming x,y,z in range axis range 2247 inline void DataGrid(mglData &d, const mglData &x, const mglData &y, const mglData &z, const char *opt="") 2248 { mgl_data_grid(gr,&d,&x,&y,&z,opt); } 2249 2250 /// Make histogram (distribution) of data. This function do not plot data. 2251 /** Option "value" sets the size of output array (default is mglFitPnts=100). */ 2252 inline mglData Hist(const mglData &x, const mglData &a, const char *opt="") 2253 { return mglData(true, mgl_hist_x(gr, &x, &a, opt)); } 2254 /// Make histogram (distribution) of data. This function do not plot data. 2255 /** Option "value" sets the size of output array (default is mglFitPnts=100). */ 2256 inline mglData Hist(const mglData &x, const mglData &y, const mglData &a, const char *opt="") 2257 { return mglData(true, mgl_hist_xy(gr, &x, &y, &a, opt)); } 2258 /// Make histogram (distribution) of data. This function do not plot data. 2259 /** Option "value" sets the size of output array (default is mglFitPnts=100). */ 2260 inline mglData Hist(const mglData &x, const mglData &y, const mglData &z, const mglData &a, const char *opt="") 2261 { return mglData(true, mgl_hist_xyz(gr, &x, &y, &z, &a, opt)); } 2262 Compression(bool)2263 inline void Compression(bool){} // NOTE: Add later -- IDTF 2264 /// Set the preference for vertex color on/off (for formats that support it, now only PRC does). VertexColor(bool enable)2265 inline void VertexColor(bool enable) { mgl_set_flag(gr,enable, MGL_PREFERVC); } 2266 /// Render only front side of surfaces for dubugging purposes (for formats that support it, now only PRC does). DoubleSided(bool enable)2267 inline void DoubleSided(bool enable) { mgl_set_flag(gr,!enable, MGL_ONESIDED); } 2268 // inline void TextureColor(bool){} // NOTE: Add later -- IDTF 2269 }; 2270 //----------------------------------------------------------------------------- 2271 /// Wrapper class for MGL parsing 2272 class mglParse 2273 { 2274 HMPR pr; 2275 mglParse &operator=(mglParse &p) 2276 { pr = p.pr; mgl_use_parser(pr,1); return p; } 2277 public: mglParse(HMPR p)2278 mglParse(HMPR p) { pr = p; mgl_use_parser(pr,1); } mglParse(mglParse & p)2279 mglParse(mglParse &p) { pr = p.pr; mgl_use_parser(pr,1); } 2280 mglParse(bool setsize=false) 2281 { pr=mgl_create_parser(); mgl_parser_allow_setsize(pr, setsize); } ~mglParse()2282 ~mglParse() { if(mgl_use_parser(pr,-1)<1) mgl_delete_parser(pr); } 2283 /// Get pointer to internal mglParser object Self()2284 inline HMPR Self() { return pr; } 2285 /// Parse and draw single line of the MGL script Parse(mglGraph * gr,const char * str,int pos)2286 inline int Parse(mglGraph *gr, const char *str, int pos) 2287 { return mgl_parse_line(gr->Self(), pr, str, pos); } Parse(mglGraph * gr,const wchar_t * str,int pos)2288 inline int Parse(mglGraph *gr, const wchar_t *str, int pos) 2289 { return mgl_parse_linew(gr->Self(), pr, str, pos); } 2290 /// Execute MGL script text with '\n' separated lines Execute(mglGraph * gr,const char * str)2291 inline void Execute(mglGraph *gr, const char *str) 2292 { mgl_parse_text(gr->Self(), pr, str); } Execute(mglGraph * gr,const wchar_t * str)2293 inline void Execute(mglGraph *gr, const wchar_t *str) 2294 { mgl_parse_textw(gr->Self(), pr, str); } 2295 /// Execute and draw script from the file 2296 inline void Execute(mglGraph *gr, FILE *fp, bool print=false) 2297 { mgl_parse_file(gr->Self(), pr, fp, print); } 2298 2299 /// Return type of command: 0 - not found, 1 - other data plot, 2 - func plot, 2300 /// 3 - setup, 4 - data handle, 5 - data create, 6 - subplot, 7 - program 2301 /// 8 - 1d plot, 9 - 2d plot, 10 - 3d plot, 11 - dd plot, 12 - vector plot 2302 /// 13 - axis, 14 - primitives, 15 - axis setup, 16 - text/legend, 17 - data transform CmdType(const char * name)2303 inline int CmdType(const char *name) 2304 { return mgl_parser_cmd_type(pr, name); } 2305 /// Return string of command format (command name and its argument[s]) CmdFormat(const char * name)2306 inline const char *CmdFormat(const char *name) 2307 { return mgl_parser_cmd_frmt(pr, name); } 2308 /// Return description of MGL command CmdDesc(const char * name)2309 inline const char *CmdDesc(const char *name) 2310 { return mgl_parser_cmd_desc(pr, name); } 2311 /// Get name of command with number n GetCmdName(long n)2312 inline const char *GetCmdName(long n) 2313 { return mgl_parser_cmd_name(pr,n); } 2314 /// Get number of defined commands GetCmdNum()2315 inline long GetCmdNum() 2316 { return mgl_parser_cmd_num(pr); } 2317 /// Load new commands from external dynamic Library (must have "const mglCommand *mgl_cmd_extra" variable) LoadDLL(const char * fname)2318 inline void LoadDLL(const char *fname) 2319 { mgl_parser_load(pr, fname); } 2320 /// Apply one step for equation d vars[i]/dt = eqs[i] using Runge-Kutta method 2321 inline void RK_Step(const char *eqs, const char *vars, mreal dt=1) 2322 { mgl_rk_step(pr, eqs, vars, dt); } 2323 inline void RK_Step(const wchar_t *eqs, const wchar_t *vars, mreal dt=1) 2324 { mgl_rk_step_w(pr, eqs, vars, dt); } 2325 // Open all data arrays from HDF file and assign it as variables of parser p OpenHDF(const char * fname)2326 inline void OpenHDF(const char *fname) 2327 { mgl_parser_openhdf(pr, fname); } 2328 2329 /// Set value for parameter $N AddParam(int id,const char * str)2330 inline void AddParam(int id, const char *str) 2331 { mgl_parser_add_param(pr, id, str); } AddParam(int id,const wchar_t * str)2332 inline void AddParam(int id, const wchar_t *str) 2333 { mgl_parser_add_paramw(pr, id, str); } 2334 /// Restore once flag RestoreOnce()2335 inline void RestoreOnce() { mgl_parser_restore_once(pr); } 2336 /// Allow changing size of the picture AllowSetSize(bool allow)2337 inline void AllowSetSize(bool allow) { mgl_parser_allow_setsize(pr, allow); } 2338 /// Allow reading/saving files AllowFileIO(bool allow)2339 inline void AllowFileIO(bool allow) { mgl_parser_allow_file_io(pr, allow); } 2340 /// Allow loading commands from external libraries AllowDllCall(bool allow)2341 inline void AllowDllCall(bool allow) { mgl_parser_allow_dll_call(pr, allow); } 2342 /// Set flag to stop script parsing Stop()2343 inline void Stop() { mgl_parser_stop(pr); } 2344 /// Set variant of argument(s) separated by '?' to be used in further commands 2345 inline void SetVariant(int var=0) 2346 { mgl_parser_variant(pr, var); } 2347 /// Set starting object ID 2348 inline void StartID(int id=0) 2349 { mgl_parser_start_id(pr, id); } 2350 2351 /// Return result of formula evaluation Calc(const char * formula)2352 inline mglData Calc(const char *formula) 2353 { return mglData(true,mgl_parser_calc(pr,formula)); } Calc(const wchar_t * formula)2354 inline mglData Calc(const wchar_t *formula) 2355 { return mglData(true,mgl_parser_calcw(pr,formula)); } 2356 2357 /// Find variable with given name or add a new one 2358 /// NOTE !!! You must not delete obtained data arrays !!! AddVar(const char * name)2359 inline mglData *AddVar(const char *name) 2360 { return mgl_parser_add_var(pr, name); } AddVar(const wchar_t * name)2361 inline mglData *AddVar(const wchar_t *name) 2362 { return mgl_parser_add_varw(pr, name); } 2363 /// Find variable with given name or return NULL if no one 2364 /// NOTE !!! You must not delete obtained data arrays !!! FindVar(const char * name)2365 inline mglData *FindVar(const char *name) 2366 { return mgl_parser_find_var(pr, name); } FindVar(const wchar_t * name)2367 inline mglData *FindVar(const wchar_t *name) 2368 { return mgl_parser_find_varw(pr, name); } 2369 /// Get variable with given id. Can be NULL for temporary ones. 2370 /// NOTE !!! You must not delete obtained data arrays !!! GetVar(unsigned long id)2371 inline mglData *GetVar(unsigned long id) 2372 { return mgl_parser_get_var(pr,id); } 2373 /// Get number of variables GetNumVar()2374 inline long GetNumVar() 2375 { return mgl_parser_num_var(pr); } 2376 /// Delete variable with name DeleteVar(const char * name)2377 inline void DeleteVar(const char *name) { mgl_parser_del_var(pr, name); } DeleteVar(const wchar_t * name)2378 inline void DeleteVar(const wchar_t *name) { mgl_parser_del_varw(pr, name); } 2379 /// Delete all data variables DeleteAll()2380 void DeleteAll() { mgl_parser_del_all(pr); } 2381 }; 2382 //----------------------------------------------------------------------------- 2383 //mglGraph mglGr; 2384 //----------------------------------------------------------------------------- 2385