MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Interactive surface manipulation with GUIkit


I don't know how this works with GUIkit.
For the interactive part, I would suggest parametric graphics
with LiveGraphics3D. The idea is to use variables (here: f1,f2,f3,f4)
in your graphics. Unfortunately Plot3D cannot handle such graphics,
thus, you have to build up it with low-level Mathematica graphics:

independentVariables = {f1 -> 2, f2 -> 1, f3 -> 0, f4 -> 2.5};
n1[x_, y_] := (1/4)(1 + x)(1 + y);
n2[x_, y_] := (1/4)(1 - x)(1 + y);
n3[x_, y_] := (1/4)(1 - x)(1 - y);
n4[x_, y_] := (1/4)(1 + x)(1 - y);
f[x_, y_] := {n1[x, y], n2[x, y], n3[x, y], n4[x, y]}.{f1, f2, f3, f4};
dx = 2/10; dy = 2/10;
g = Graphics3D[{{PointSize[0.02], RGBColor[0, 1, 0], Point[{1, 1,
    f1}], Point[{-1, 1, f2}], Point[{-1, -1, f3}], Point[{1, -1, f4}]},

    Table[Polygon[{{x, y, f[x, y]}, {x + dx, y, f[x + dx, y]}, {x +
         dx, y + dy, f[x + dx, y + dy]}, {x, y + dy, f[x, y + dy]}}],
{x, -1,
    1 - dx, dx}, {y, -1, 1 - dy, dy}]}];

To show this example in Mathematica, use:

Show[g //. independentVariables]

For use with LiveGraphics3D, use the WriteLiveForm function
from the LiveGraphics3D documentation
Then you need an HTML page calling this applet with the
additional parameter
<PARAM NAME="INDEPENDENT_VARIABLES" VALUE="{f1 -> 2, f2 -> 1, f3 -> 0,
f4 -> 2.5}">
The rest is a standard call of LiveGraphics3D as described
in the documentation.
I've set up an example (including Mathematica source and HTML file) here:

Note that the green points are included to have draggable
points in LiveGraphics3D. (They are draggable in z direction
because their z coordinate is specified directly by an
independent variable.)
Also note that the shading is never updated and only correct
for the initial values of the variables.
Finally note, that no Java programming was necessary to
create this example. Once you know how it works; it is actually
pretty straightforward to produce such examples.

Hope this helps

Martin Kraus

Marco Gabiccini ha escrito:

> Hi all,
> I need to create a GUI Object which should do the following:
> 1. The object should be a sort of Plot3D or parametric plot 3D of a
> bilinear surface hanging above the square (1,1), (-1,1), (-1,-1), (1,-1) in
> the x-y plane.
> 2. The surface should be the plot of the surface
> f(x,y)=[N1(x,y)  N2(x,y)  N3(x,y)  N4(x,y)].[f1  f2  f3  f4]
>      where the Ni(x,y) are the shape functions and fi are the values of the
> surface at the four nodes.
>      The shape functions are:
>      N1(x,y)=(1/4)(1+x)(1+y);  N2(x,y)=(1/4)(1-x)(1+y);
> N3(x,y)=(1/4)(1-x)(1-y);   N4(x,y)=(1/4)(1+x)(1-y)
> 3. I would be able to start with some f1, f2, f3, f4, plot the surface and
> then by dragging the surface at a node on the 3D plot, change interactively
>      the values of the function at the particular node picked. This should
> change in real time the shape of the surface as well.
>      The user should visually format the surface.
> 4. The values at the nodes should be updated and written in a vector.
> Does anybody know how to do this?
> Thanks in advance for any help,
> Marco

  • Prev by Date: MathML, Mozilla, fonts and Mathematica 5.2
  • Next by Date: Re: Visualization site updates
  • Previous by thread: Re: MathML, Mozilla, fonts and Mathematica 5.2
  • Next by thread: Re: Re: Interactive surface manipulation with GUIkit