[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.4.3 Plots for 3D data
Drawing procedures for 3D plot looks similarly to 1D and 2D plots described above. There are 3 general types of 3D plots (see section 3D plotting): (i) plots on slices or on projections, (ii) isosurfaces, (iii) cloud-like plots. Plots on slice are clear enough – one specifies a slice (as its index or as coordinate value) and MathGL draws contour lines or density plot on slice plane. Isosurface gives more information. Isosurface is 3D analogue of the contour line Cont()
. It shows the region where data array values exceed specified isosurface level. Plot becomes more informative if one adds transparency, lightning or sets color scheme depending on coordinates. Generalization of isosurface is the cloud-like plot. For this plot the darker color and less transparent regions correspond to higher values of data. Contrary, the regions with low values are transparent. For plotting of the phase of fields (or beams or pulses) one can use isosurface which transparency depends on the other data array (see function Surf3A()
). As example of 3D data plots let us draw the Gaussian beam diffraction in space. Beam propagates along x axis:
int sample(mglGraph *gr, void *) { gr->Alpha(true); gr->Light(true); gr->Light(0,mglPoint(0,0,1)); mglData a(30,30,30),b(30,30,30); a.Modify("exp(-16*((z-0.5)^2+(y-0.5)^2)/(1+4*x^2))"); b.Modify("16*((z-0.5)^2+(y-0.5)^2)*(x)/(1+4*x^2)"); gr->CAxis(0,1); gr->SubPlot(2,2,0); gr->Rotate(40,60); gr->Surf3(a,"wgk"); gr->Box(); gr->SubPlot(2,2,1); gr->Rotate(40,60); gr->DensA(a); gr->Box(); gr->Axis(); gr->SubPlot(2,2,2); gr->Rotate(40,60); gr->CloudQ(a); gr->Box(); gr->SubPlot(2,2,3); gr->Rotate(40,60); gr->Surf3A(b,a,"q");gr->Box(); return 0; }
Example of Gaussian beam diffraction (3D data)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |