Graphics Options Supported by JavaView
	by Konrad Polthier and Ulrich Reitebuch
	Version 1.00, 17.07.03)

Loading JavaView

Load the JavaView packages which provides the commands JavaView[g] and others.

<< JavaView`JLink`
viewer  =  InstallJavaView[];

Load Graphics Polyhedra. The simple example used in this Graphics Options test notebook is generated using this package.

<< Graphics`Polyhedra`

All images below are in fact interactive JavaView applets showing *.mgs models. The models were previously saved from a Mathematica session with the WriteMgs[] command included in the JavaView packages.

Working with Basic Options

Basic Options / Plot

PlotRange

PlotRange is an option for graphics functions that specifies what points to include in a plot.

pr  =  
        Graphics3D[
          Stellate[
            Dodecahedron[]], 
PlotRange -> {All, {0. , 
                2. }, {-0.7, 0.5}}];
Show[pr]

JavaView[pr]

AspectRatio

AspectRatio allows to scale the display in x and y direction, after the image is computed.

ar = 
      Graphics3D[
        Stellate[Dodecahedron[]], 
AspectRatio -> 
          0.5]
Show[ar]

Not supported in JavaView.

JavaView[ar]

PlotLabel

PlotLabel is an option for graphics functions that specifies an overall label for a plot.

Specify title of plot.

\(\(pl\  = \ 
        Graphics3D[
          Stellate[
            Dodecahedron[]], 
PlotLabel -> "Stellated Dodecahedron"];\)\)
Show[pl]

Works fine.

JavaView[pl]

Basic Options / Axes

Axes

Flag for graphics functions if axes are drawn.

sa  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        Axes -> True]
Show[sa]

JavaView may not show the axes at the same bounding box edges. The ticks are also not the same.

JavaView[sa]

AxesLabel

Specifies the labels for axes.

al  =  
      Graphics3D[
        Stellate[Dodecahedron[]], 
Axes -> True, 
        AxesLabel -> {"a", "b", "c"}]
Show[al]

Reading labels is supported but font settings and suchlike are ignored in JavaView.

JavaView[al]

Ticks

Specifies position and labels of ticks at axes.

\(tic = 
      Graphics3D[
        Stellate[
          Dodecahedron[]], 
Ticks -> {Automatic, 
            None, {{1.2, "+6/5", {0.05, 
                  0.01}}, {0. , "Null"}}}, 
Axes -> True]\)
Show[tic]

Ticks are not supported yet.

JavaView[tic]

AxesOrigin

AxesOrigin is an option for two-dimensional graphics functions which specifies where any axes drawn should cross.

ao  =  
      Plot[4  x^2, {x, -1, 1}, AxesOrigin -> {0, 1}]

Not supported yet.

JavaView[ao]

AxesStyle

AxesStyle is an option for graphics functions which specifies how axes should be rendered.

as  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        Axes -> 
          True, 
AxesStyle -> {{RGBColor[1, 0, 0], 
              Thickness[0.01]}, {RGBColor[0, 0, 1], Thickness[0.01], 
              Dashing[{0.05, 0.05}]}, {RGBColor[0, 1, 0], 
              Thickness[
                0.01]}}]

Show[as]

Just colors are supported; thickness, dashing and suchlike are ignored.

JavaView[as]

Working with 3D Options

3D Options / Box

Boxed

The bounding box can be switched on or off.

b  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        Boxed -> False]
Show[b]

JavaView[b]

With multiple geometries, there is still the problem, that the JavaView bounding box belongs to one geometry (the active geometry), but the Mathematica bounding box belongs to all geometries in the display. (SOLVED: JAVAVIEW 2.47.002)

bm  =  {Stellate[Polyhedron[Dodecahedron]], 
        Stellate[
          Polyhedron[Icosahedron, {2. , 0. , 0. }, 
            1. ] ] }

Show[bm]

JavaView[bm]

BoxRatios

BoxRatios is an option for Graphics3D and SurfaceGraphics which gives the ratios of side lengths for the bounding box of the three-dimensional picture.

br  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        BoxRatios -> {1. , 2. , 
            1.4}]

Show[br]

Not supported yet in JavaView.

JavaView[br]

FaceGrids

FaceGrids is an option for three-dimensional graphics functions that specifies grid lines to draw on the faces of the bounding box.

fg  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        FaceGrids -> {{-1, 0, 0}, {1, 0, 
              0}}]

Show[fg]

Not supported. Workaround: use the axis panel in JavaView which supplies different grids on the faces of the bounding box.

JavaView[fg]

AxesEdge

AxesEdge is an option for three-dimensional graphics functions that specifies on which edges of the bounding box axes should be drawn.

ae  =  
      Graphics3D[Stellate[Dodecahedron[]], Axes -> True, 
        AxesEdge -> {{-1, -1}, {-1, 1}, {1, 
              1}}]

Show[ae]

Not supported at all.

JavaView[ae]

BoxStyle

BoxStyle is an option for three-dimensional graphics functions which specifies how the bounding box should be rendered.

bs  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        BoxStyle -> {RGBColor[1, 0, 0], 
            Dashing[{0.05, 
                0.05}]}]

Show[bs]

Just the color settings are used.

JavaView[bs]

3D Options / Light

Lighting

Lighting is a flag to disable the automatics lighting and use default coloring by height or apply a ColorFunction.

plf = 
        Plot3D[Sin[x y], {x, 0, ((3  Pi)/2)}, {y, 0, ((3  Pi)/2)}, 
          Lighting -> False];

JavaView[plf]

LightSources

LightSources is an option forGraphics3Dand related functions that specifies the properties of point light sources for simulated illumination.

By default, Mathematica uses three light sources, a red light at {1.,0.,1.}, a green light at {1.,1.,1.}and blue light at {0.,1.,1} where the position in given in display coordinates. The Mathematica lighting will be transported to JavaView, but is at the same time simulated in JavaView by setting the face colors, which is much easier to handle and looks quite similar.
The Mathematica lights have fix positions with respect to the display, in JavaView to the scene, which is a slight difference.If the default light sources are found, the JavaView parser adds two more default light sources to this three light sources. This leads to little color changes at the faces visible in Mathematica, but it avoids seeing the black backside of surfaces when rotating the geometry in JavaView. If the light sources are set explicitly in Mathematica, then JavaView uses the same light sources to compute the surface colors. One little drawback: light source positions are used only as light directions in the computation, with very near or very far camera positions the colors look different. If JavaView lighting is used and face colors are deactivated, the colors change because directional light sources in JavaView are not oriented.
The computed light colors will overwrite the original local face colors in JavaView (when existing), so color informations can get lost.

Position a few light sources for illumination.

ls  =  
      Graphics3D[
        Stellate[
          Dodecahedron[]], 
LightSources -> {{{1. , 
                0. , 0. }, 
              RGBColor[1. , 0.4, 0.4]}, 
{{- .15,  .85, 
                0. }, RGBColor[0.4, 1. , 
                0.4]}, 
{{- .15, - .85, 0. }, 
              RGBColor[0.4, 0.4, 1. ]}}]
Show[ls]

Pretty good in JavaView.

JavaView[g2]

AmbientLight

First we have a look at the AmbientLight: It can be specified in Mathematica by GrayLevel or RGBColor. Here we use a little green AmbientLight.

al  =  
      Graphics3D[Stellate[Dodecahedron[]],  
        AmbientLight -> 
          RGBColor[0. , 0.3, 
            0. ]]

Show[al]

And, as they should, the faces of the geometry go greener in JavaView too:

JavaView[al]

Shading

Shading is an option that specifies whether the surfaces should be shaded.

s  =  
        Graphics3D[
Stellate[Dodecahedron[]], 
          Shading -> False];
Show[s]

Switch off the shading will also disable the color shading during translation to JavaView.

JavaView[s]

3D Options / Mesh

Mesh

Mesh is an option for SurfaceGraphics and DensityGraphics that specifies whether an explicit x–y mesh should be drawn.

nm = 
      SurfaceGraphics[
        Table[Sin[x]*Exp[y], 
{x, -Pi, Pi, 
            Pi/4. }, {y, -E, E, E/4. }], 
        Mesh -> False]
Show[nm]

The option Mesh is translated to JavaView perfectly.

JavaView[nm]

MeshStyle

MeshStyle is an option forPlot3D,DensityPlot and related functions which specifies how mesh lines should be rendered.

ms = 
      SurfaceGraphics[
Table[
          Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }], 
MeshStyle -> {Thickness[0.01], 
            RGBColor[1. , 0. , 
              0. ], 
Dashing[{0.02, 
                0.02}]}]
Show[ms]

Thickness/AbsoluteThickness and Colors are used, Dashing and suchlike are ignored.

JavaView[ms]

MeshRange

MeshRange->{{xmin, xmax}, {ymin, ymax}} is an option for ListPlot3D, SurfaceGraphics, ListContourPlot, ListDensityPlot and related functions which specifies the range of x and y coordinates that correspond to the array of z values given.

The default is MeshRange->Automatic where Mathematica puts the grid values to the integer indices of the array, starting with "1". JavaView copies this behaviour.

mra = 
      SurfaceGraphics[
        Table[Sin[x]*Exp[y], 
{x, -Pi, Pi, 
            Pi/4. }, {y, -E, E, E/4. }], 
        Axes -> True]
Show[mra]

Here we see the same strange x and y axis scaling, copied to JavaView.

JavaView[mra]

When defining a MeshRange it makes sense to use the same values used for z value computation.

mr =  
      SurfaceGraphics[
        Table[Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }], 
MeshRange -> {{-Pi, 
              Pi}, {-E, E}}, 
        Axes -> True]
Show[mr]

The option MeshRange is translated to JavaView perfectly.

JavaView[mr]

ClipFill

ClipFill is an option for SurfaceGraphics that specifies how clipped parts of the surface are to be drawn.

At First again a simple example:

sg = 
      SurfaceGraphics[
Table[
          Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }]]
Show[sg]

Here we see already an automatic feature of Mathematica: It allways tries to scale the SurfaceGraphics bounding box to x : y : z = 1 : 1 : 0.4 and cuts all z values, which exceed the z bounds of this box. JavaView does not scale the coordinate axes different and does not support such an automatic clipping.

JavaView[sg]

The ClipFill option allows to mark or not draw the clipped faces - as JavaView does not support the clipping, this option does not work in JavaView.

cf = 
      SurfaceGraphics[
Table[
          Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }], 
ClipFill -> {GrayLevel[0. ], 
            GrayLevel[1. ]}]
Show[cf]

JavaView[cf]

Shading

See 3  D Options/Light

HiddenSurface

HiddenSurface is an option for SurfaceGraphics which specifies whether faces are drawn. See also Shading.

hs = 
      SurfaceGraphics[
Table[
          Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }], 
HiddenSurface -> 
          False]
Show[hs]

The option Mesh is translated to JavaView perfectly.

JavaView[hs]

Shading Alltogether

Here is a plot with the default settings for surface rendering options.

gs = 
        Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 
            2}];

JavaView[gs]

This shows the surface without the mesh drawn. It is usually much harder to see the form of the surface if the mesh is not there.

gnm = 
        Plot3D[Exp[-(x^2 + y^2)] + 1, {x, -2, 2}, {y, -2, 2}, 
          Mesh -> False];

JavaView[gnm]

This shows the surface with no shading. Some display devices may not be able to show shading.

gns = 
        Plot3D[Exp[-(x^2 + y^2)] + 2, {x, -2, 2}, {y, -2, 2}, 
          Shading -> False];

JavaView[gns]

This shows just the mesh of the surface.

gnf = 
        Plot3D[Exp[-(x^2 + y^2)] + 3, {x, -2, 2}, {y, -2, 2}, 
          HiddenSurface -> False];

JavaView[gnf]

JavaView[{gs, gnm, gns, gnf}]

3D Options / View

ViewPoint

This option defines (in coordinates relative to the bounding box) the camera position. This looks nearly the same in JavaView.

vp  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        ViewPoint -> {3. , 3. , 
            1. }]

Show[vp]

JavaView[vp]

ViewCenter

The command ViewCenter modifies the interest of the camera.(in coordinates relative to the bounding box). Perfectly the same in JavaView.
If the Graphics object gets imported from a mgs file, this option does not work, because imported geometries are automatically fitted into the current display.

vc  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        ViewCenter -> {1, 1, 
            1}]

Show[vc]

JavaView[vc]

Set both, the focus and orientation of the camera.

gvv = 
        Plot3D[Sin[x*y], {x, 0, Pi}, {y, 0, Pi}, 
          ViewCenter -> {1, 1, 1}, 
          ViewVertical -> {1, 0, 0}];

JavaView[gvv];

ViewVertical

ViewVertical is an option for Graphics3D and SurfaceGraphics which specifies what direction in scaled coordinates should be vertical in the final image.

vv  =  
        Graphics3D[
Stellate[Dodecahedron[]], 
          ViewVertical -> {1. , 1. , 1. }];
Show[vv]

JavaView[vv]

SphericalRegion

Shows no effect. SphericalRegion is an option to scale the geometry inside the display such, that it could be rotated without exceeding the display size - this should be ever possible in JavaView.

sr  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        SphericalRegion -> 
          True]

Show[sr]

JavaView[sr]

PolygonIntersections

This command generates in Mathematica a model with broken faces. The model looks good in JavaView , the z-buffer will be switched on automatically. The Show command must be duplicated to see the option work.

pi  =  
        Show[Graphics3D[{Stellate[Dodecahedron[], -0.5], Icosahedron[]}, 
            PolygonIntersections -> 
              False]];

Show[pi, PlotRange -> All];

JavaView[pi]

Working with Advanced Options

Prolog & Epilog

Prolog and Epilog are options for graphics functions which gives a list of graphics primitives to be rendered before resp. after the main part of the graphics is rendered.

pe  =  
      Graphics3D[
        Stellate[
          Dodecahedron[]], 
Prolog -> {RGBColor[0. , 
              0. , 0. ], 
            Polygon[{{1. , 1. }, {1. , 0. }, {0. , 
                  1. }}]}, 
Epilog -> {RGBColor[1. , 
              0. , 0. ], Thickness[0.02], 
            Line[{{0.6, 0.9}, {0.776, 0.357}, {0.315, 0.693}, {0.885, 
                  0.693}, {0.424, 0.357}, {0.6, 
                  0.9}}]}]

Show[pe]

JavaView shows the Prolog and Epilog Graphics as 2D Graphics inside the 3D room instead of painting on the display window and the wall behind the room, which contains the main model.

JavaView[pe]

Background

Specifies a backgrond color.

bg  =  
      Graphics3D[
        Stellate[Dodecahedron[]], 
Background -> 
          RGBColor[1. , 0. , 0. ]]
Show[bg]

Backgrond colors are soupported.

JavaView[bg]

DefaultColor

DefaultColor is an option for graphics functions which specifies the default color to use for lines, points, etc.

dc  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        DefaultColor -> 
          RGBColor[1, 0, 0]]

Show[dc]

DefaultColor is used in JavaView.

JavaView[dc]

PlotRegion

PlotRegion is an option for graphics functions that specifies what region of the final display area a plot should fill.

pr  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        PlotRegion -> {{0. , 0.5}, {0. , 
              1. }}]

Show[pr]

Not supported at all.

JavaView[pr]

TextStyle

TextStyle is an option for graphics functions and for Text which specifies the default style and font options with which text should be rendered.

\(ts\  = \ 
      Graphics3D[
        Stellate[
          Dodecahedron[]], 
TextStyle -> {FontSlant -> "Italic", FontSize -> 12}, 
        Axes -> True]
\)
Show[ts]

Not supported at all.

JavaView[ts]

FormatType

FormatType is an option for output streams, graphics and functions such as Text which specifies the default format type to use when outputting expressions.

ft  =  
      Graphics3D[
        Stellate[Dodecahedron[]], 
FormatType -> 
          TraditionalForm, Axes -> True, 
        Ticks -> {{-1, -1/2, 0, 1/2, 1}, {-1, -1/2, 0, 
              1/2, 1}, {-1, -1/2, 0, 1/2, 
              1}}]

Show[ft]

Not supported at all.

JavaView[ft]

ColorFunction & ColorFunctionScaling

TheColorFunction option computes colors from z values.
The "&" at the end of the function seems to disturb the loader.

cf = 
      SurfaceGraphics[
Table[
          Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }], 
ColorFunction -> (RGBColor[
                Cos[Pi  #/2. ],  .707, 
Sin[
                  Pi  #/2. ]] &)]
Show[cf]

An example, that is parsed in JafvaView.

cf = 
      SurfaceGraphics[
Table[
          Sin[x]*Exp[y], {x, -Pi, Pi, Pi/4. }, {y, -E, E, 
            E/4. }], 
ColorFunction -> Automatic, 
        Lighting -> False]
Show[cf]

ColorFunction is not supported, so ColorFunctionScaling is not supported either.

JavaView[cf]

RenderAll

This shows no effect in JavaView. It is an option for the Mathematica Postscript export.

ra  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        RenderAll -> False]
Show[ra]

JavaView[ra]

ColorOutput

ColorOutput is an option for graphics functions which specifies the type of color output to produce.

co  =  
      Graphics3D[Stellate[Dodecahedron[]], 
        ColorOutput -> 
          GrayLevel]

Show[co]

In JavaView turning to black and white looks different.

JavaView[co]

ImageSize

This resizes the JavaView display to a given size in pixels. The gray Background color is set just to show the Mathematica display's size on a white notebook.

is  =  
      Graphics3D[Stellate[Dodecahedron[]], ImageSize -> {300, 200}, 
        Background -> 
          GrayLevel[0.4]]

Show[is]

JavaView[is]

FaceForm

FaceForm is a directive which specifies separate color directives to be used for drawing the front and back faces of a geometry.
The colors can be specified as RGBColor, GrayLevel, Hue, CMYKColor or SurfaceColor. Mathematica distinguishes two kinds of color models: Using the lighting model with LightSources and AmbientLight (Lighting->True), face colors can be specified by SurfaceColor only, giving a diffuse and a specular reflection component. With Lighting switched on and face colors defined without SurfaceColor, Mathematica assumes the reflection colors all to be white and ignores the color properties. If Lighting is switched off, SurfaceColors are ignored and different defined colors are shown only.
This example shows, that Mathematica unfortunately does not care about a consistent orientation of the faces: The spike showing to the viewer has the opposite orientation to all other spikes, so it shows the back side color.
In JavaView the Mathematica lighting is simulated by setting element colors.
What does JavaView do with these colors:
-- Without Lighting, colors defined without SurfaceColor: works fine.
-- Without Lighting, colors defined by SurfaceColor: Mathematica shows black faces without depth, JavaView shows white faces with depth shading.
-- With Lighting, colors defined without SurfaceColor: Looks similar to Mathematica in JavaView.
-- With Ligthing, colors defined by SurfaceColor: Mathematica uses the diffuse reflection color for the ambient light and the specular reflection color for the light sources - this is not handled correct by the MathLoader's color computation.
The simulation of lighting by setting face colors makes it impossible, to get the Mathematica behaviour transported to JavaView in the last case. The computed lighted colors upon faces overwrite the original colors, which can not be won back. .

At first an example with face colors defined by RGBColor directly:

ff  =  
      Graphics3D[{FaceForm[RGBColor[0. , 0. , 1. ], RGBColor[1. , 0. , 0. ]], 
          Stellate[Dodecahedron[]]}, 
        Lighting -> False]

Show[ff]

JavaView[ff]

... and now an example with SurfaceColor:

sc  =  
      Graphics3D[{FaceForm[
            SurfaceColor[RGBColor[0. , 0. , 1. ], RGBColor[0. , 1. , 1. ]], 
            SurfaceColor[RGBColor[1. , 0. , 0. ], 
              RGBColor[0. , 1. , 0. ]]], 
Stellate[
            Dodecahedron[]]}, 
LightSources -> {{{1. , 
                0. , 1. }, RGBColor[0. , 1. , 0. ]}, {{0. , 1. , 1. }, 
              RGBColor[0. , 0. , 1. ]}}, AmbientLight -> GrayLevel[0.3], 
        Lighting -> True]

Show[sc]

JavaView[sc]

EdgeForm

EdgeForm[ ] specifies the one or more graphics directives to be used for the drawing of edges.
The thickness of edges is handled nearly correctly by JavaView, the color is set correctly, if there is just one EdgeForm command. If the Color is changed in between, there is no possibility yet in JavaView to show the same edge colors, as a PgElementSet has no edge colors per element. Thickness in JavaView means an absolute thickness in pixels, in Mathematica the thickness in pixels depends on the size of the display; So the edge size in JavaView rather relates to AbsoluteThickness in Mathematica.

ef  =  
      Graphics3D[{EdgeForm[
            RGBColor[1. , 0. , 0. ], 
Thickness[ .01]], 
          Stellate[Dodecahedron[]]}]
Show[ef]

JavaView[ef]