Next: RenderMan, Previous: OOGL.m, Up: Mathematica

### 9.2 Using Geomview as Mathematica's Default 3D Display

The package `Geomview.m` arranges for Geomview to be the default display program for 3D graphics in Mathematica. To load it, give the command `<< Geomview.m` to Mathematica. Thereafter, whenever you display 3D graphics with `Plot3D` or `Show`, Mathematica will send the graphics to Geomview.

Loading `Geomview.m` implicitly loads `OOGL.m` as well, so you can use the `Geomview` and `WriteOOGL` as described above after loading `Geomview.m`. You do not have to separately load `OOGL.m`.

         % math
         Mathematica 2.0 for SGI Iris
         Copyright 1988-91 Wolfram Research, Inc.
          -- GL graphics initialized --

         In[1] := <<Geomview.m

         In[2] := Plot3D[x^2 + y^2, {x, -2, 2}, {y, -2, 2}]

         Out[2] := -SurfaceGraphics-

This invokes geomivew and loads the graphics object into it.

         In[3] := Plot3D[{x*y + 6, RGBColor[0,x,y]}, {x,0,1}, {y,0,1}]

         Out[3] := -SurfaceGraphics-

This replaces the previous Geomview object by the new object.

         In[4] := Geomview[{%2,%3}]

         Out[4] := {-SurfaceGraphics-, -SurfaceGraphics-}

This displays both objects at once. You also can have more than one Mathematica object at a time on display in Geomview, and have separate control over them, by using the `Geomview` command with a name, See OOGL.m.

         In[5] := Graphics3D[ {RGBColor[1,0,0], Line[{ {2,2,2},{1,1,1} }] }]

         Out[5] := -Graphics3D-

         In[6] := Geomview["myline", %5]

This addes the `Line` specified in `In[5]` to the existing Geomview display. It can be controlled independently of the "Mathematica" object, which is currently the list of two plots.

         In[7] := <<GL.m

If you're on an SGI, loading `GL.m` returns Mathematica to its usual 3D graphics display. The following plot will appear in a normal static Mathematica window.

         In[8] := ParametricPlot3D[{Sin[x],Sin[y],Sin[x]*Cos[y]}, {x,0,Pi},{y,0,Pi}]

         Out[8] := -Graphics3D-

We can return to Geomview graphics at any time by reloading `Geomview.m`.

         In[9] := <<Geomview.m

         In[10] := Show[%8]

         Out[10] := -Graphics3D-

         In[11] := ParametricPlot3D[
                    {(2*(Cos[u] + u*Sin[u])*Sin[v])/(1 + u^2*Sin[v]^2),
                    (2*(Sin[u] - u*Cos[u])*Sin[v])/(1 + u^2*Sin[v]^2),
                    Log[Tan[v/2]] + (2*Cos[v])/(1 + u^2*Sin[v]^2)},
                   {u,-4,4},{v,.01,Pi-.01}]

         Out[11] := -Graphics3D-

This last plot is Kuen's surface, a surface of constant negative curvature. Parametrization from Alfred Gray's Modern Differential Geometry of Curves and Surfaces textbook.