LiveGraphicsRectangularPlot3D.pl - provide an interactive 3D rectangular plot.
LiveGraphicsRectangularPlot3D.pl
provides two macros 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 RectangularDomainPlot3D()
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 AnnularDomainPlot3D
works similarly for a function z = f(x,y)
over an annular domain specified in polar by rmin < r < rmax
and tmin < theta < tmax
.
RectangularPlot3DRectangularDomain(options)
Options are:
function => $f, $f is a MathObjects Formula
For example, in the setup section define
Context("Numeric");
Context()->variables->add(s=>"Real",t=>"Real");
$a = random(1,3,1);
$f = Formula("$a*s^2-2*t"); # use double quotes!
before calling RectangularPlot3DRectangularDomain()
xvar => "s", independent variable name, default "x"
yvar => "t", independent variable name, default "y"
xmin => -3, domain for xvar
xmax => 3,
ymin => -3, domain for yvar
ymax => 3,
xsamples => 20, deltax = (xmax - xmin) / xsamples
ysamples => 20, deltay = (ymax - ymin) / ysamples
axesframed => 1, 1 displays framed axes, 0 hides framed axes
xaxislabel => "S", Capital letters may be easier to read
yaxislabel => "T",
zaxislabel => "Z",
outputtype => 1, return string of only polygons (or mesh)
2, return string of only plotoptions
3, return string of polygons (or mesh) and plotoptions
4, return complete plot
RectangularPlot3DAnnularDomain(options)
Options are:
function => $f, $f is a MathObjects Formula
For example, in the setup section define
Context("Numeric");
Context()->variables->add(y=>"Real",r=>"Real",t=>"Real");
$a = random(1,3,1);
$f = Formula("$a*e^(- x^2 - y^2)"); # use double quotes!
before calling RectangularPlot3DAnnularDomain()
xvar => "x", independent variable name, default "x"
yvar => "y", independent variable name, default "y"
rvar => "r", independent variable name, default "r"
tvar => "t", independent variable name, default "t" (for theta)
rmin => -3, domain for rvar
rmax => 3,
tmin => -3, domain for tvar
tmax => 3,
rsamples => 20, deltar = (rmax - rmin) / rsamples
tsamples => 20, deltat = (tmax - tmin) / tsamples
axesframed => 1, 1 displays framed axes, 0 hides framed axes
xaxislabel => "X", Capital letters may be easier to read
yaxislabel => "Y",
zaxislabel => "Z",
outputtype => 1, return string of only polygons (or mesh)
2, return string of only plotoptions
3, return string of polygons (or mesh) and plotoptions
4, return complete plot