LiveGraphicsRectangularPlot3D.pl - provide an interactive 3D rectangular plot.
This macro provides two methods for creating an interactive plot of a function of two variables z = f(x, y) in rectangular (Cartesian) coordinates via the LiveGraphics3D JavaScript applet. The routine "RectangularPlot3DRectangularDomain" takes a MathObject Formula of two variables defined over a rectangular domain and some plot options as input and returns a string of plot data that can be displayed using the Live3Ddata routine of the LiveGraphics3D.pl macro. The routine "RectangularPlot3DAnnularDomain" works similarly for a function z = f(x, y) over an annular domain specified in polar coordinates by rmin < r < rmax and tmin < theta < tmax (polar coordinates are converted to rectangular for evaluation of the function).
Usage: RectangularPlot3DRectangularDomain(%options)
The available options are as follows.
function => $f$f is a MathObject Formula. For example, in the setup section define
Context()->variables->are(x => 'Real', y => 'Real');
$a = random(1, 3);
$f = Formula("$a * x^2 - 2 * y");    # Use double quotes!before calling RectangularPlot3DRectangularDomain.
xvar => 'x'First independent variable name, default 'x'. This must correspond to the first variable used in the function.
yvar => 'y'Second independent variable name, default 'y'. This must correspond to the second variable used in the function.
xmin => -3Lower bound for the domain of the first independent variable.
xmax => 3Upper bound for the domain of the first independent variable.
ymin => -3Lower bound for the domain of the second independent variable.
ymax => 3Upper bound for the domain of the second independent variable.
xsamples => 20The number of sample values for the first independent variable in the interval from xmin to xmax to use.
ysamples => 20The number of sample values for the second independent variable in the interval from ymin to ymax to use.
axesframed => 1If set to 1 then the framed axes are displayed. If set to 0, the framed axes are not shown. This is 1 by default.
xaxislabel => 'x'Label for the axis corresponding to the first independent variable.
yaxislabel => 'y'Label for the axis corresponding to the second independent variable.
zaxislabel => 'z'Label for the axis corresponding to the dependent variable.
outputtype => 1This determines what is contained in the string that the method returns. The values of 1 through 4 are accepted, and have the following meaning.
Return a string of only polygons (or edge mesh).
Return a string of only plot options.
Return a string of polygons (or edge mesh) and plot options.
Return the complete plot to be passed directly to the Live3DData method.
Usage: RectangularPlot3DAnnularDomain(%options)
The available options are as follows.
function => $f$f is a MathObject Formula. For example, in the setup section define
Context()->variables->are(x => 'Real', y => 'Real');
$a = random(1, 3);
$f = Formula("$a * e^(-x^2 - y^2)");    # Use double quotes!before calling RectangularPlot3DRectangularDomain.
xvar => 'x'First independent variable name, default 'x'. This must correspond to the first variable used in the function.
yvar => 'y'Second independent variable name, default 'y'. This must correspond to the second variable used in the function.
rmin => -3Lower bound for the domain of radial coordinate.
rmax => 3Upper bound for the domain of radial coordinate.
tmin => -3Lower bound for the domain of angular coordinate.
tmax => 3Upper bound for the domain of angular coordinate.
rsamples => 20The number of radial values in the interval from rmin to rmax to use.
tsamples => 20The number of angular values in the interval from tmin to tmax to use.
axesframed => 1If set to 1 then the frames axes are displayed. If set to 0, the framed axes are not shown. This is 1 by default.
xaxislabel => 'x'Label for the axis corresponding to the first independent variable.
yaxislabel => 'y'Label for the axis corresponding to the second independent variable.
zaxislabel => 'z'Label for the axis corresponding to the dependent variable.
outputtype => 1This determines what is contained in the string that the method returns. The values of 1 through 4 are accepted, and have the following meaning.
Return a string of only polygons (or edge mesh).
Return a string of only plot options.
Return a string of polygons (or edge mesh) and plot options.
Return the complete plot to be passed directly to the Live3DData method.