Annotation of OpenXM_contrib/gnuplot/docs/old/README.3d, Revision 1.1
1.1 ! maekawa 1:
! 2: A tutorial on explicit/parametric
! 3: and
! 4: everything you did not dare to ask
! 5: about
! 6: curves and surfaces
! 7: in
! 8: gnuplot
! 9:
! 10: Several types of curves and surface are supported in gnuplot. Of those
! 11: not every operation is supported for every curve or surface type and it
! 12: can be therefore useful to understand the different types, their advantages
! 13: and limitations.
! 14:
! 15: Curves in gnuplot are almost always planar (with one exception which we
! 16: will deal with in the end) and are assumed to be in the XY plane.
! 17: Therefore only X and Y coordinates are needed for plotting curves.
! 18: The simplest curve is the `explicit function`. This curve is in fact a
! 19: function and for each given x, there is one and only one y value associated
! 20: with it. A gnuplot example for such type is `plot sin(x)` or
! 21: `plot "datafile" using 1". Note the later is using only a single column from
! 22: the data file which is assumed to be the y values.
! 23:
! 24: Alternatively one can define a `parametric curve` form. In this case
! 25: x and y are both functions of a third free parameter t, while independent
! 26: of each other. A circle can be expressed parametrically as x = cos(t),
! 27: y = sin(t) and be plotted using gnuplot as
! 28: 'set parametric; plot cos(t),sin(t)'.
! 29: This form is not a function since there can be unlimited number of y values
! 30: associated with same x. Furthermore the explicit form is a special case of
! 31: the parametric representation by letting x equal to t. The curve y = sin(x)
! 32: can be written in parametric form as y = sin(t), x = t.
! 33:
! 34: We are used to think of the plane in cartesian coordinate system.
! 35: In practice, some coordinate systems may be easier to use then others
! 36: under some circumstances. The polar form uses a different basis
! 37: to span the XY plane. In this representation the cartesian x coordinate
! 38: is equal to r cos(t) and the cartesian y coordinate is equal to r sin(t).
! 39: To draw a unit circle using the polar coordinate system in gnuplot use the
! 40: following simple command: 'set polar; plot 1'. To better understand this
! 41: explicit form lets backup a little.
! 42: When we plot a regular explicit function like `y = sin(x)` we march in equal
! 43: steps in x, evaluate the provided function and plot a piecewise linear curve
! 44: between the sampled points approximating the real function. In the polar
! 45: explicit form we do exactly the same thing, but we march along the angular
! 46: direction - we turn around the origin, computing the length of the radius
! 47: at that angle. Since for the unit circle, this radius is a constant 1,
! 48: `plot 1` in polar form plots a circle (if t domain is from 0 or 2Pi).
! 49: Note the polar form is explicit in that for each angle there is only a
! 50: single radius.
! 51:
! 52: Surprisingly (or maybe not so surprising) surfaces share the same
! 53: representations. Since surfaces are two dimensional entities, they
! 54: require two free parameters (like t for curves).
! 55:
! 56: A surface explicit function uses x and y as the free parameters. For
! 57: each such pair it provides a single z value. An example for this form
! 58: can be `splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)` for a three dimensional
! 59: sinc function or `splot 'datafile' using 1`. As for curves, the single column
! 60: used from the data file defines the function value or z in this case.
! 61: The order of the x and y function values is very strict in this form and
! 62: simply defines a rectangular grid in the XY plane. Fortunately this
! 63: strict form allows us to apply a very simplistic hidden line algorithm
! 64: called "the floating horizon". This hidden line algorithm exploits the
! 65: rectangular XY domain of the surface and therefore may be used for this
! 66: type of surfaces only. Since in gnuplot this is the only form of hidden
! 67: lines removing algorithm provided, only explicit surfaces may have their
! 68: hidden lines removed.
! 69:
! 70: Parametric surfaces are the exact extension for explicit surfaces as in
! 71: the curves case. the x, y, and z are defined in terms of two new free
! 72: variables and are totally independent of each other as x(u, v), y(u, v),
! 73: and z(u, v). Again the explicit surface is a special case of the parametric
! 74: representation where x = u, and y = v. Examples for plotting parametric
! 75: surfaces in gnuplot can be `splot cos(u)*cos(v),cos(u)*sin(v),sin(u)` which
! 76: defines a sphere, or `splot "datafile" using 1:2:3`. Since these are
! 77: parametric surfaces, gnuplot must be informed to handle them by issuing
! 78: `set parametric`.
! 79:
! 80: The curve polar form takes the obvious extensions in the surface world.
! 81: The first possible extension is spherical coordinate system, while the
! 82: second is the cylindrical one. These modes currently work for data files
! 83: only and both requires two parameters, theta and phi for mapping onto the
! 84: unit sphere, and theta and z form mapping on a unit radius cylinder as follow:
! 85:
! 86: Spherical coord. Cylin. coord.
! 87: ---------------- -------------
! 88: x = cos( theta ) * cos( phi ) x = cos( theta )
! 89: y = sin( theta ) * cos( phi ) y = sin( theta )
! 90: z = sin( phi ) z = z
! 91:
! 92: This subject brings us back to non planar curves. When surfaces are displayed
! 93: under gnuplot, isocurves are actually getting plotted. An isocurve is a
! 94: curve on the surface in which one of the two free parameters of the
! 95: surface is fixed. For example the u isolines of a surface are drawn by
! 96: setting u to be fixed and varying v along the entire v domain. The v isolines
! 97: are similarly drawn by fixing v. When data files are specified they are
! 98: classified internally into two types. A surface is tagged to have grid
! 99: topology if all its specified isolines are of the same length. A data mesh
! 100: of five isolines, seven points each is an example. In such a case the
! 101: surface cross isolines are drawn as well. Seven isolines with five points
! 102: each will be automatically created and drawn for grid type data. If
! 103: however, isolines of different length are found in the data, it is
! 104: tagged as nongrid surface and in fact is nothing more than a collection
! 105: of three dimensional curves. Only the provided data is plotted in that
! 106: case (see world.dem for such an example).
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>