Next: , Previous: , Up: MathGL core   [Contents][Index]


5.15 Vector fields

These functions perform plotting of 2D and 3D vector fields. There are 5 generally different types of vector fields representations: simple vector field (Vect), vectors along the curve (Traj), vector field by dew-drops (Dew), flow threads (Flow, FlowP), flow pipes (Pipe). By default (if absent) values of x, y, z are equidistantly distributed in axis range. The minor dimensions of arrays x, y, z, ax should be equal. The size of ax, ay and az must be equal. Arrays x, y, z can be vectors (not matrices as ax). String sch sets the color scheme (see Color scheme) for plot. String opt contain command options (see Command options).

MGL command: traj xdat ydat udat vdat ['sch'='']
MGL command: traj xdat ydat zdat udat vdat wdat ['sch'='']
Method on mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
Method on mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
C function: void mgl_traj_xyz (HMGL gr, HCDTx, HCDTy, HCDTz, HCDTax, HCDTay, HCDTaz, const char *sch, const char *opt)
C function: void mgl_traj_xy (HMGL gr, HCDTx, HCDTy, HCDTax, HCDTay, const char *sch, const char *opt)

The function draws vectors {ax, ay, az} along a curve {x, y, z}. The length of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. String pen specifies the color (see Line styles). By default (pen="") color from palette is used (see Palette and colors). Option value set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if value=0). The minor sizes of all arrays must be equal and large 2. The plots are drawn for each row if one of the data is the matrix. See also vect. See Traj sample, for sample code and picture.

MGL command: vect udat vdat ['sch'='']
MGL command: vect xdat ydat udat vdat ['sch'='']
Method on mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
Method on mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
C function: void mgl_vect_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
C function: void mgl_vect_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)

The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z equal to minimal z-axis value. The length and color of arrows are proportional to \sqrt{ax^2+ay^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols:

See also flow, dew. See Vect sample, for sample code and picture.

MGL command: vect udat vdat wdat ['sch'='']
MGL command: vect xdat ydat zdat udat vdat wdat ['sch'='']
Method on mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
Method on mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
C function: void mgl_vect_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
C function: void mgl_vect_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the length and color of arrows is proportional to \sqrt{ax^2+ay^2+az^2}.

MGL command: vect3 udat vdat wdat ['sch'='' sval]
MGL command: vect3 xdat ydat zdat udat vdat wdat ['sch'='' sval]
Method on mglGraph: void Vect3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
Method on mglGraph: void Vect3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
C function: void mgl_vect3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
C function: void mgl_vect3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)

The function draws 3D vector field plot for the field {ax, ay, az} depending parametrically on coordinates x, y, z. Vector field is drawn at slice sVal in direction {‘x’, ‘y’, ‘z’} if sch contain corresponding symbol (by default, ‘y’ direction is used). The length and color of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols:

See also vect, flow, dew. See Vect3 sample, for sample code and picture.

MGL command: dew udat vdat ['sch'='']
MGL command: dew xdat ydat udat vdat ['sch'='']
Method on mglGraph: void Dew (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
Method on mglGraph: void Dew (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
C function: void mgl_dew (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
C function: void mgl_dew_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)

The function draws dew-drops for plane vector field {ax, ay} depending parametrically on coordinates x, y at level z equal to minimal z-axis value. Note that this is very expensive plot in memory usage and creation time! The color of drops is proportional to \sqrt{ax^2+ay^2}. The number of drops depend on meshnum. See also vect. See Dew sample, for sample code and picture.

MGL command: flow udat vdat ['sch'='']
MGL command: flow xdat ydat udat vdat ['sch'='']
Method on mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
Method on mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
C function: void mgl_flow_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
C function: void mgl_flow_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)

The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z equal to minimal z-axis value. Number of threads is proportional to value option (default is 5). String sch may contain:

See also pipe, vect, tape, barwidth. See Flow sample, for sample code and picture.

MGL command: flow udat vdat wdat ['sch'='']
MGL command: flow xdat ydat zdat udat vdat wdat ['sch'='']
Method on mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
Method on mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
C function: void mgl_flow_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
C function: void mgl_flow_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}.

MGL command: flow x0 y0 udat vdat ['sch'='']
MGL command: flow x0 y0 xdat ydat udat vdat ['sch'='']
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
C function: void mgl_flowp_2d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, const char *sch, const char *opt)
C function: void mgl_flowp_xy (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)

The same as first one (flow) but draws single flow thread starting from point p0={x0,y0,z0}.

MGL command: flow x0 y0 z0 udat vdat wdat ['sch'='']
MGL command: flow x0 y0 z0 xdat ydat zdat udat vdat wdat ['sch'='']
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
C function: void mgl_flowp_3d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
C function: void mgl_flowp_xyz (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)

This is 3D version of the previous functions.

MGL command: grad pdat ['sch'='']
MGL command: grad xdat ydat pdat ['sch'='']
MGL command: grad xdat ydat zdat pdat ['sch'='']
Method on mglGraph: void Grad (const mglDataA &phi, const char *sch="", const char *opt="")
Method on mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &phi, const char *sch="", const char *opt="")
Method on mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &phi, const char *sch="", const char *opt="")
C function: void mgl_grad (HMGL gr, HCDT phi, const char *sch, const char *opt)
C function: void mgl_grad_xy (HMGL gr, HCDT x, HCDT y, HCDT phi, const char *sch, const char *opt)
C function: void mgl_grad_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT phi, const char *sch, const char *opt)

The function draws gradient lines for scalar field phi[i,j] (or phi[i,j,k] in 3d case) specified parametrically {x[i,j,k], y[i,j,k], z[i,j,k]}. Number of lines is proportional to value option (default is 5). See also dens, cont, flow.

MGL command: pipe udat vdat ['sch'='' r0=0.05]
MGL command: pipe xdat ydat udat vdat ['sch'='' r0=0.05]
Method on mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
Method on mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
C function: void mgl_pipe_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
C function: void mgl_pipe_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)

The function draws flow pipes for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z equal to minimal z-axis value. Number of pipes is proportional to value option (default is 5). If ‘#’ symbol is specified then pipes start only from edges of axis range. The color of lines is proportional to \sqrt{ax^2+ay^2}. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). Parameter r0 set the base pipe radius. If r0<0 or symbol ‘i’ is specified then pipe radius is inverse proportional to amplitude. The vector field is plotted for each z slice of ax, ay. See also flow, vect. See Pipe sample, for sample code and picture.

MGL command: pipe udat vdat wdat ['sch'='' r0=0.05]
MGL command: pipe xdat ydat zdat udat vdat wdat ['sch'='' r0=0.05]
Method on mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
Method on mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
C function: void mgl_pipe_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
C function: void mgl_pipe_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)

This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}.





Next: , Previous: , Up: MathGL core   [Contents][Index]