This file is indexed.

/usr/share/doc/mathgl/mathgl_en/mathgl_en_17.html is in mathgl-doc-en 2.1.3.1-4ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- This manual is for MathGL (version 2.1.2), a collection of classes and routines for scientific plotting. Please report any errors in this manual to mathgl.abalakin@gmail.org.

Copyright C 2008-2012 Alexey A. Balakin.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts.  A copy of the license is included in the section entitled "GNU
Free Documentation License."


 -->
<!-- Created on December 22, 2013 by texi2html 1.82
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>MathGL 2.1.2: 2.8 Vector field samples</title>

<meta name="description" content="MathGL 2.1.2: 2.8 Vector field samples">
<meta name="keywords" content="MathGL 2.1.2: 2.8 Vector field samples">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="Vector-field-samples"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="mathgl_en_16.html#Dots-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vect-sample" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Vector-field-samples-1"></a>
<h2 class="section">2.8 Vector field samples</h2>

<p>Vector field visualization (especially in 3d case) is more or less complex task. MathGL provides 3 general types of plots: vector field itself (<code>Vect</code>), flow threads (<code>Flow</code>), and flow pipes with radius proportional to field amplitude (<code>Pipe</code>).
</p>
<p>However, the plot may look tangly &ndash; there are too many overlapping lines. I may suggest 2 ways to solve this problem. The first one is to change <code>SetMeshNum</code> for decreasing the number of hachures. The second way is to use the flow thread chart <code>Flow</code>, or possible many flow thread from manual position (<code>FlowP</code>). Unfortunately, I don&rsquo;t know any other methods to visualize 3d vector field. If you know any, e-mail me and I shall add it to MathGL.
</p>
<p>Most of samples will use the same data for plotting. So, I put its initialization in separate function
</p><pre class="verbatim">void mgls_prepare2v(mglData *a, mglData *b)
{
  register long i,j,n=20,m=30,i0;
  if(a) a-&gt;Create(n,m);   if(b) b-&gt;Create(n,m);
  mreal x,y;
  for(i=0;i&lt;n;i++)  for(j=0;j&lt;m;j++)
  {
    x=i/(n-1.); y=j/(m-1.); i0 = i+n*j;
    if(a) a-&gt;a[i0] = 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
    if(b) b-&gt;a[i0] = 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y);
  }
}
void mgls_prepare3v(mglData *ex, mglData *ey, mglData *ez)
{
  register long i,j,k,n=10,i0;
  if(!ex || !ey || !ez) return;
  ex-&gt;Create(n,n,n);  ey-&gt;Create(n,n,n);  ez-&gt;Create(n,n,n);
  mreal x,y,z, r1,r2;
  for(i=0;i&lt;n;i++)  for(j=0;j&lt;n;j++)  for(k=0;k&lt;n;k++)
  {
    x=2*i/(n-1.)-1; y=2*j/(n-1.)-1; z=2*k/(n-1.)-1; i0 = i+n*(j+k*n);
    r1 = pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5);
    r2 = pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5);
    ex-&gt;a[i0]=0.2*x/r1 - 0.2*x/r2;
    ey-&gt;a[i0]=0.2*y/r1 - 0.2*y/r2;
    ez-&gt;a[i0]=0.2*(z-0.3)/r1 - 0.2*(z+0.3)/r2;
  }
}
</pre><p>or using C functions
</p><pre class="verbatim">void mgls_prepare2v(HMDT a, HMDT b)
{
  register long i,j,n=20,m=30,i0;
  if(a) mgl_data_create(a,n,m,1);
  if(b) mgl_data_create(b,n,m,1);
  mreal x,y;
  for(i=0;i&lt;n;i++)  for(j=0;j&lt;m;j++)
  {
    x=i/(n-1.); y=j/(m-1.); i0 = i+n*j;
    if(a) mgl_data_set_value(a, 0.6*sin(2*M_PI*x)*sin(3*M_PI*y)+0.4*cos(3*M_PI*x*y), i,j,0);
    if(b) mgl_data_set_value(b, 0.6*cos(2*M_PI*x)*cos(3*M_PI*y)+0.4*cos(3*M_PI*x*y), i,j,0);
  }
}
void mgls_prepare3v(HMDT ex, HMDT ey, HMDT ez)
{
  register long i,j,k,n=10,i0;
  if(!ex || !ey || !ez) return;
  mgl_data_create(ex,n,n,n);
  mgl_data_create(ey,n,n,n);
  mgl_data_create(ez,n,n,n);
  mreal x,y,z, r1,r2;
  for(i=0;i&lt;n;i++)  for(j=0;j&lt;n;j++)  for(k=0;k&lt;n;k++)
  {
    x=2*i/(n-1.)-1; y=2*j/(n-1.)-1; z=2*k/(n-1.)-1; i0 = i+n*(j+k*n);
    r1 = pow(x*x+y*y+(z-0.3)*(z-0.3)+0.03,1.5);
    r2 = pow(x*x+y*y+(z+0.3)*(z+0.3)+0.03,1.5);
    mgl_data_set_value(ex, 0.2*x/r1 - 0.2*x/r2, i,j,k);
    mgl_data_set_value(ey, 0.2*y/r1 - 0.2*y/r2, i,j,k);
    mgl_data_set_value(ez, 0.2*(z-0.3)/r1 - 0.2*(z+0.3)/r2, i,j,k);
  }
}
</pre>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Vect-sample">2.8.1 Vect sample</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Vect3-sample">2.8.2 Vect3 sample</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Traj-sample">2.8.3 Traj sample</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Flow-sample">2.8.4 Flow sample</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Pipe-sample">2.8.5 Pipe sample</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Dew-sample">2.8.6 Dew sample</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>


<hr size="6">
<a name="Vect-sample"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Vector-field-samples" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vect3-sample" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Vect-sample-1"></a>
<h3 class="subsection">2.8.1 Vect sample</h3>

<p>Function <a href="mathgl_en_43.html#vect">vect</a> is most standard way to visualize vector fields &ndash; it draw a lot of arrows or hachures for each data cell. It have a lot of options which can be seen on the figure (and in the sample code). <code>Vect</code> use color scheme for coloring (see <a href="mathgl_en_24.html#Color-scheme">Color scheme</a>). The sample code is:
</p><pre class="verbatim">int sample(mglGraph *gr)
{
  mglData a,b;  mgls_prepare2v(&amp;a,&amp;b);
  gr-&gt;SubPlot(3,2,0,&quot;&quot;); gr-&gt;Title(&quot;Vect plot (default)&quot;);
  gr-&gt;Box();  gr-&gt;Vect(a,b);

  gr-&gt;SubPlot(3,2,1,&quot;&quot;);  gr-&gt;Title(&quot;'.' style; '=' style&quot;);
  gr-&gt;Box();  gr-&gt;Vect(a,b,&quot;=.&quot;);

  gr-&gt;SubPlot(3,2,2,&quot;&quot;);  gr-&gt;Title(&quot;'f' style&quot;);
  gr-&gt;Box();  gr-&gt;Vect(a,b,&quot;f&quot;);

  gr-&gt;SubPlot(3,2,3,&quot;&quot;);  gr-&gt;Title(&quot;'&gt;' style&quot;);
  gr-&gt;Box();  gr-&gt;Vect(a,b,&quot;&gt;&quot;);

  gr-&gt;SubPlot(3,2,4,&quot;&quot;);  gr-&gt;Title(&quot;'&lt;' style&quot;);
  gr-&gt;Box();  gr-&gt;Vect(a,b,&quot;&lt;&quot;);

  mglData ex,ey,ez; mgls_prepare3v(&amp;ex,&amp;ey,&amp;ez);
  gr-&gt;SubPlot(3,2,5); gr-&gt;Title(&quot;3d variant&quot;);  gr-&gt;Rotate(50,60);
  gr-&gt;Box();  gr-&gt;Vect(ex,ey,ez);
  return 0;
}
</pre>
 <img src="../png/vect.png" alt="Example of Vect()">

<hr size="6">
<a name="Vect3-sample"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Vect-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Traj-sample" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Vect3-sample-1"></a>
<h3 class="subsection">2.8.2 Vect3 sample</h3>

<p>Function <a href="mathgl_en_43.html#vect3">vect3</a> draw just usual vector field plot but at slices of 3D data. The sample code is:
</p><pre class="verbatim">int sample(mglGraph *gr)
{
  mglData ex,ey,ez; mgls_prepare3v(&amp;ex,&amp;ey,&amp;ez);
  gr-&gt;SubPlot(2,1,0); gr-&gt;Title(&quot;Vect3 sample&quot;);    gr-&gt;SetOrigin(0,0,0);
  gr-&gt;Rotate(50,60);    gr-&gt;Axis(&quot;_xyz&quot;);   gr-&gt;Box();
  gr-&gt;Vect3(ex,ey,ez,&quot;x&quot;);  gr-&gt;Vect3(ex,ey,ez);    gr-&gt;Vect3(ex,ey,ez,&quot;z&quot;);

  gr-&gt;SubPlot(2,1,1);   gr-&gt;Title(&quot;'f' style&quot;);
  gr-&gt;Rotate(50,60);    gr-&gt;Axis(&quot;_xyz&quot;);   gr-&gt;Box();
  gr-&gt;Vect3(ex,ey,ez,&quot;fx&quot;); gr-&gt;Vect3(ex,ey,ez,&quot;f&quot;);gr-&gt;Vect3(ex,ey,ez,&quot;fz&quot;);
  gr-&gt;Grid3(ex,&quot;Wx&quot;);   gr-&gt;Grid3(ex,&quot;W&quot;);  gr-&gt;Grid3(ex,&quot;Wz&quot;);
  return 0;
}
</pre>
 <img src="../png/vecta.png" alt="Example of Vect3()">

<hr size="6">
<a name="Traj-sample"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Vect3-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Flow-sample" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Traj-sample-1"></a>
<h3 class="subsection">2.8.3 Traj sample</h3>

<p>Function <a href="mathgl_en_43.html#traj">traj</a> is 1D analogue of <code>Vect</code>. It draw vectors from specified points. The sample code is:
</p><pre class="verbatim">int sample(mglGraph *gr)
{
  mglData x,y,y1,y2;  mgls_prepare1d(&amp;y,&amp;y1,&amp;y2,&amp;x);
  gr-&gt;SubPlot(1,1,0,&quot;&quot;); gr-&gt;Title(&quot;Traj plot&quot;);
  gr-&gt;Box();  gr-&gt;Plot(x,y);  gr-&gt;Traj(x,y,y1,y2);
  return 0;
}
</pre>
 <img src="../png/traj.png" alt="Example of Traj()">


<hr size="6">
<a name="Flow-sample"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Traj-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Pipe-sample" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Flow-sample-1"></a>
<h3 class="subsection">2.8.4 Flow sample</h3>

<p>Function <a href="mathgl_en_43.html#flow">flow</a> is another standard way to visualize vector fields &ndash; it draw lines (threads) which is tangent to local vector field direction. MathGL draw threads from edges of bounding box and from central slices. Sometimes it is not most appropriate variant &ndash; you may want to use <code>FlowP</code> to specify manual position of threads. <code>Flow</code> use color scheme for coloring (see <a href="mathgl_en_24.html#Color-scheme">Color scheme</a>). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). The sample code is:
</p><pre class="verbatim">int sample(mglGraph *gr)
{
  mglData a,b;  mgls_prepare2v(&amp;a,&amp;b);
  gr-&gt;SubPlot(2,2,0,&quot;&quot;); gr-&gt;Title(&quot;Flow plot (default)&quot;);
  gr-&gt;Box();  gr-&gt;Flow(a,b);

  gr-&gt;SubPlot(2,2,1,&quot;&quot;);  gr-&gt;Title(&quot;'v' style&quot;);
  gr-&gt;Box();  gr-&gt;Flow(a,b,&quot;v&quot;);

  gr-&gt;SubPlot(2,2,2,&quot;&quot;);  gr-&gt;Title(&quot;'\\#' style&quot;);
  gr-&gt;Box();  gr-&gt;Flow(a,b,&quot;#&quot;);

  mglData ex,ey,ez; mgls_prepare3v(&amp;ex,&amp;ey,&amp;ez);
  gr-&gt;SubPlot(2,2,3); gr-&gt;Title(&quot;3d variant&quot;);  gr-&gt;Rotate(50,60);
  gr-&gt;Box();  gr-&gt;Flow(ex,ey,ez);
  return 0;
}
</pre>
 <img src="../png/flow.png" alt="Example of Flow()">

<hr size="6">
<a name="Pipe-sample"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Flow-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Dew-sample" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Pipe-sample-1"></a>
<h3 class="subsection">2.8.5 Pipe sample</h3>

<p>Function <a href="mathgl_en_43.html#pipe">pipe</a> is similar to <a href="mathgl_en_43.html#flow">flow</a> but draw pipes (tubes) which radius is proportional to the amplitude of vector field. <code>Pipe</code> use color scheme for coloring (see <a href="mathgl_en_24.html#Color-scheme">Color scheme</a>). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). The sample code is:
</p><pre class="verbatim">int sample(mglGraph *gr)
{
  mglData a,b;  mgls_prepare2v(&amp;a,&amp;b);
  gr-&gt;SubPlot(2,2,0,&quot;&quot;); gr-&gt;Title(&quot;Pipe plot (default)&quot;);
  gr-&gt;Light(true);  gr-&gt;Box();  gr-&gt;Pipe(a,b);

  gr-&gt;SubPlot(2,2,1,&quot;&quot;);  gr-&gt;Title(&quot;'i' style&quot;);
  gr-&gt;Box();  gr-&gt;Pipe(a,b,&quot;i&quot;);

  gr-&gt;SubPlot(2,2,2,&quot;&quot;);  gr-&gt;Title(&quot;'\\#' style&quot;);
  gr-&gt;Box();  gr-&gt;Pipe(a,b,&quot;#&quot;);

  mglData ex,ey,ez; mgls_prepare3v(&amp;ex,&amp;ey,&amp;ez);
  gr-&gt;SubPlot(2,2,3); gr-&gt;Title(&quot;3d variant&quot;);  gr-&gt;Rotate(50,60);
  gr-&gt;Box();  gr-&gt;Pipe(ex,ey,ez,&quot;&quot;,0.1);
  return 0;
}
</pre>
 <img src="../png/pipe.png" alt="Example of Pipe()">

<hr size="6">
<a name="Dew-sample"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Pipe-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_18.html#Hints" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_88.html#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Dew-sample-1"></a>
<h3 class="subsection">2.8.6 Dew sample</h3>

<p>Function <a href="mathgl_en_43.html#dew">dew</a> is similar to <code>Vect</code> but use drops instead of arrows. The sample code is:
</p><pre class="verbatim">int sample(mglGraph *gr)
{
  mglData a,b;  mgls_prepare2v(&amp;a,&amp;b);
  gr-&gt;SubPlot(1,1,0,&quot;&quot;); gr-&gt;Title(&quot;Dew plot&quot;);
  gr-&gt;Box();  gr-&gt;Light(true);  gr-&gt;Dew(a,b);
  return 0;
}
</pre>
 <img src="../png/dew.png" alt="Example of Dew()">



<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Pipe-sample" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_18.html#Hints" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="mathgl_en_9.html#Examples" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Vector-field-samples" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="mathgl_en_20.html#General-concepts" title="Next chapter"> &gt;&gt; </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>Build Daemon user</em> on <em>December 22, 2013</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
 </font>
 <br>

</p>
</body>
</html>