This is documentation for an earlier version of webMathematica.
View current User Guide (Version 3.3)

Documentation3. Basic Examples


3.6 Live 3D Plotting: Plot3DLive.jsp

If you installed webMathematica as described above, you should be able to connect to this JSP via http://localhost:8080/webMathematica/Examples/Plot3DLive.jsp. (You may have some other URL for accessing your server.) It allows the user to enter a function to be plotted by the LiveGraphics3D applet. The source for this page is in webMathematica/Examples/Plot3DLive.jsp.

<%@ page language="java" %>
<%@ taglib uri="/webMathematica-taglib" prefix="msp" %>

<title>Live 3D Plotting</title>

<body text="#171717" bgcolor = "#ffffff">

$ImageBackground = "#ffffff";
$ImageSize = {300, 300};

<h1>Live 3D Plotting</h1>
<form action="Plot3DLive.jsp" method="post">
Plot3D of
<input type="text" name="fun" size="22" value =
"<msp:evaluate> MSPValue[ $$fun, "Sin[x y]^2"] </msp:evaluate>">
x from:
<input type="text" name="x0" size="10" value =
"<msp:evaluate>MSPValue[ $$x0, "-2"] </msp:evaluate>">
<input type="text" name="x1" size="10" value =
"<msp:evaluate>MSPValue[ $$x1, "2"] </msp:evaluate>">
y from:
<input type="text" name="y0" size="10" value =
"<msp:evaluate>MSPValue[ $$y0, "-2"] </msp:evaluate>">
<input type="text" name="y1" size="10" value =
"<msp:evaluate>MSPValue[ $$y1, "2"] </msp:evaluate>">
Number of points to plot
<input type="text" name="pts" size="5" value =
"<msp:evaluate>MSPValue[ $$pts, "20"] </msp:evaluate>">
   MSPBlock[ {$$fun, $$x0, $$x1, $$y0, $$y1, $$pts},
            {x, $$x0, $$x1}, {y, $$y0, $$y1}, PlotPoints -> $$pts]]]
<input type="submit" name="btnSubmit" value="Evaluate">

This example uses a number of evaluations to set up parameters. The last evaluation takes the values of these parameters and uses them in a call to Plot3D. The result of this goes to MSPLive3D, which calls the LiveGraphics3D applet. This gives a real-time rotation of the three-dimensional graphics object.