Next: Pipe sample, Previous: Traj sample, Up: Vector field samples [Contents][Index]
Function flow is another standard way to visualize vector fields – 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 – you may want to use FlowP
to specify manual position of threads. Flow
use color scheme for coloring (see Color scheme). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source). The sample code is:
int sample(mglGraph *gr) { mglData a,b; mgls_prepare2v(&a,&b); gr->SubPlot(2,2,0,""); gr->Title("Flow plot (default)"); gr->Box(); gr->Flow(a,b); gr->SubPlot(2,2,1,""); gr->Title("'v' style"); gr->Box(); gr->Flow(a,b,"v"); gr->SubPlot(2,2,2,""); gr->Title("'\\#' style"); gr->Box(); gr->Flow(a,b,"#"); mglData ex,ey,ez; mgls_prepare3v(&ex,&ey,&ez); gr->SubPlot(2,2,3); gr->Title("3d variant"); gr->Rotate(50,60); gr->Box(); gr->Flow(ex,ey,ez); return 0; }
Next: Pipe sample, Previous: Traj sample, Up: Vector field samples [Contents][Index]