Display Mathematica Graphics with JavaView
	by Konrad Polthier and Ulrich Reitebuch
	Draft 0.91, 16.05.03)

Introduction

Mathematica graphics objects cover a broad range of 2D and 3D shapes. A single command like JavaView[g] suffices to transfer these shapes to JavaView as interactive geometries. Behind the scenes JavaView analyzes the graphics object g, parses its the internal representation, and, in some case, performs necessary computations.
The purpose of the following sections is to demonstrate that a variety of Mathematica graphics primitives are successfully parsed by JavaView, and that JavaView renders the shapes as expected by a Mathematica user and as defined by the rendering options included in the graphics objects. Each example below links to a separate page which compares the rendering of a Mathematica graphics in a JavaView and a JavaView-lite applet with an image originally rendered by Mathematica.
Mathematica and JavaView deeply integrate via the J/Link connection, for example, changes on a geometry performed in JavaView may be returned to a Mathematica session. In order to focus on the parsing and display issues we constrain to the use of the command JavaView[] in this text.

JavaView commands used in this section.

Note on the HTML Version of this Notebook

There exists an HTML version of this notebook which were all graphics as shown with an embedded JavaView applet.

The models in HTML are precomputed Mathematica graphics stored in *.mgs files. All models were exported from Mathematica with the command WriteMgs[] which is part of the JavaView packages for Mathematica. All models may be imported back into a Mathematica notebook using the Mathematica command Get.

Loading JavaView and Remarks

The above commands are available after loading the JavaView package.

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

<<JavaView`JLink`
viewer=InstallJavaView[]

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.

Rendering Issues in 2D

If primitives in 2D overlap then Mathematica renders each primitive above the previous primitives. In JavaView disable the checkbox SORTING on the display inspector.

A graphics is non-uniformly scaled in Mathematica if the graphics extend more in one direction than in another. In JavaView enable the checkbox BOX RATIO on the display inspector to allow non-uniform scaling (functionality not enabled yet).

Rendering Issues in 3D

Lighting is applied to all 3D shapes in Mathematica by default although 2D primitives in a 3D scene keep their individual color.

When JavaView parses a Mathematica graphics then JavaView simulates the lighting process and calculates individual surface colors for rendering speed. Therefore, when enabling true lighting in JavaView be sure to disable usage of local surface colors in the color menu.

Oberview of Graphics Objects and Primitives

Mathematica uses different kinds of high-level graphics objects to described geometric shapes.

High level built-in graphics objects in Mathematica.

The following set of low-level geometric primitives are not a priori displayable but must be casted to Graphics respectively Graphics3D objects. Note that Mathematica allows to create own low level geometry primitives.

Low level built-in (and other) graphics objects in 2D and 3D.

Producing Graphics Objects

Most visualization commands produce Graphics and Graphics3D objects depending whether they generate 2D or 3D geometry items. In this section we list most commands of the standard package which produce either of the higher-level graphics objects.

Producing Contour-, Density- and SurfaceGraphics[ ], and GraphicsArray[ ]

Commands producing high level graphics objects (beside Graphics and Graphics3D).

Producing Graphics[ ]

Two-dimensional objects are produced by the following collection of commands. This table includes most commands of the standard packages of Mathematica.

Commands producing composite Graphics[ ] objects in 2D.

Producing Graphics3D[ ] Objects

Three-dimensional objects are identified by a suffix 3D, but additionally there exist several commands without suffix which simply modify an existing 3D graphics object. The following table includes most commands of the standard packages of Mathematica.

Commands producing composite Graphics3D[ ] objects.

Working with Graphics Objects and Primitives

Graphics Primitives

Graphics primitives are simple geometric items which are often used to built more complex shapes. In Mathematica the primitives must be converted to a Graphics[] respectively Graphics3D[] object for visualization with the Show[] command.

Point

The primitive Point[{x,y}] respectively Point[{x,y,z}] represents a single point.
A point may have a diameter and color. The size and color attributes apply to all points following the attribute setting.

Three vertices of a planar triangle.

pt=Graphics[{PointSize[0.1],Point[{3,0}],
Point[{1,0.3}],RGBColor[0,1,0],Point[{2,1}]}];
Show[pt];

JavaView[pt]

Three vertices of a triangle in 3D.

pt3D=Graphics3D[{PointSize[0.1],Point[{3,0,0}],
Point[{1,0.3,1}],RGBColor[0,1,0],Point[{2,1,0}]}];
Show[pt3D]

JavaView[pt3D]

Generate dots on a function curve from a set of points.

ptc=Graphics[Table[Point[{x,2Sin[1/x]}],{x,-Pi,Pi,.01}],Axes->Automatic]
Show[ptc];

JavaView[ptc]

Line

The primitive Line[{x1,y1},{x2,y2}] respectively Line[{x1,y1,z1},{x2,y2,z2}] connects two or more points with one or more straight line segments.
A line may have a thickness and color. The thickness and color attributes apply to all segments of a line.

Three lines form a planar triangle.

ln=Graphics[{Thickness[0.01],Line[{{3,0},{1,0.3},{2,1}}],
RGBColor[1,0,0],Line[{{2,1},{3,0}}]}];
Show[ln]

JavaView[ln]

Use Line[] to generate a function curve as polygon.

lnc=Graphics[{RGBColor[1,0.7,0],
Line[Table[{x,2Sin[1/x]},{x,-Pi,Pi,.01}]]},
Axes->Automatic];
Show[lnc];

JavaView[lnc]

Rectangle

The primitive Rectangle[{x1,y1},{x2,y2}] represents a filled axis-parallel rectangle.
A rectangle may have a color. The color attribute applies to all rectangles following the attribute setting.

Two overlapping colored rectangles in the plane.

rct=Graphics[{Rectangle[{0,0},{5,1}],
Hue[.3],Rectangle[{3,0},{4,2}]}];
Show[rct]

JavaView[rct]

Polygon

Polygon[{x1,y1},{x2,y2},...] respectively Polygon[{x1,y1,z1},{x2,y2,z2},...] represents a closed filled polygon where the last vertex is automatically joined with the first. Polygons are a basic primitive to describe surfaces.
In 3D polygons are affected by lighting. A polygon has a front and back side where the orientation is determined by the ordering of the vertices.

Three vertices of a planar triangle shown with default color black.

pol=Graphics[{Polygon[{{3,0},{1,0.3},{2,1}}]}];
Show[pol,AspectRatio->Automatic]

JavaView[pol]

Two polygons, one of them has green surface colors.

wedge=Graphics3D[{Polygon[{{0,0,0},{0,1,0},{0,1,1},{0,0,1}}],
{SurfaceColor[RGBColor[0,1,0]],
Polygon[{{0,0,0},{1,0,0},{1,1,0},{0,1,0}}]}}];
Show[wedge]

JavaView[wedge]

Cuboid

The primitive Cuboid[{x,y,z}] represents a square block in 3D with edge size 1 and given lower left corner. A cubical with different size can be generated by specifying the upper right corner too.
Cuboids are handled as polygons by Mathematica and rendered with default lighting.

Several cuboids, and additional cuboid with different surface color.

cub=Graphics3D[{Cuboid[{0,0,0}],Cuboid[{0,0,1}],Cuboid[{0,1,1}],Cuboid[{1,1,1}],
{SurfaceColor[RGBColor[0,1,0]],
Cuboid[{1.25,0.25,0.25},{1.75,0.75,0.75}]}}];
Show[cub]

JavaView[cub]

Circle

The Circle[{x,y}, r] primitive is a circle with given radius, or with more arguments it describes a circle arc or an ellipse. The command is similar to the command Disk[ ].

A circle with given radius.

cs=Graphics[Circle[{1,1},1.5],
AspectRatio->Automatic,Axes->Automatic];
Show[cs]

JavaView[cs]

A sequence of circles with increasing radius.

a=0.07;csp=Graphics[Table[Circle[Exp[a x]{Cos[x],Sin[x]},Exp[a x]/4],
{x,0,10Pi,.5}],AspectRatio->Automatic];
Show[csp];

JavaView[csp]

The three different Circle[] commands in action.

cc=Graphics[{Circle[{0,0},1],Circle[{0,0},{2,1}],Circle[{0,0},2,{0,1}]},
AspectRatio->Automatic,Axes->Automatic];
Show[cc]

JavaView[cc]

Disk

The Disk[{x,y}, r] primitive is a filled disk with given radius, or with more arguments it describes a filled circle arc or a filled ellipse. The command is similar to Circle[].

A disk with given radius and color.

ds=Graphics[{RGBColor[0,1,0],Disk[{1,1},1.5]},
AspectRatio->Automatic,Axes->Automatic];
Show[ds]

JavaView[cs]

A sequence of disks with increasing radius.

a=0.07;
len=10Pi;
dsp=Graphics[Table[{Hue[x/len],Disk[Exp[a x]{Cos[x],Sin[x]},Exp[a x]/4]},
{x,0,len,.5}],AspectRatio->Automatic];
Show[dsp];

JavaView[dsp]

The three different Disk[] commands in action.

dc=Graphics[{{RGBColor[0,0,1],Disk[{0,0},{2,1}]},{RGBColor[0,1,1],Disk[{0,0},1]},{RGBColor[1,1,0],Disk[{0,0},2,{0,1}]}},
AspectRatio->Automatic,Axes->Automatic];
Show[dc]

JavaView[dc]

Raster

Raster[] produces an array with grayscale cells. Optionally, the xy-range of the rectangle can be specified.
JavaView converts a Raster to a colored planar xy-mesh.

Generate a grayscale image as rectangular grid.

rs=Graphics[Raster[Table[.1Mod[i,j],{i,10},{j,10}]]];
Show[rs]

JavaView[rs]

RasterArray

RasterArray[] produces an array with colored cells. Optionally, the xy-range of the rectangle can be specified.
JavaView converts a RasterArray to a colored planar xy-mesh.

Generate a color image as rectangular grid.

rsc=Graphics[RasterArray[Table[Hue[.1Mod[i,j]],{i,2,10},{j,2,10}]],
AspectRatio->Automatic];
Show[rsc]

JavaView[rsc]

PostScript

The PostScript[] command allows the inclusion of native PostScript methods into a graphics.
Probably the command will never be supported by JavaView.

A line rendered with PostScript

ps=Graphics[{PostScript[".005 setlinewidth"],PostScript[".1 .1 moveto"],
PostScript["1.1 .6 -.1 .6 .9 .1 curveto stroke"]},
Frame->True];
Show[ps]

Text

The primitive Text["string",{x,y}] and  Text["string",{x,y,z}] shows the string centered at the given position. Optionally, an offset can be used to change the alignment in 2D.
Different options exist to change the color, alignment, direction, font etc of a text. JavaView supports neither of the additional options.

Four strings around a center point.

txt=Graphics[{Text["Left",{-1,0},{-1,0}],{RGBColor[0,1,0],Text["Right",{1,0},{1,0}]},Text["Above",{0,1},{0,-1}],Text["Below",{0,-1},{0,1}],{PointSize[.075],RGBColor[1,0,0],Point[{0,0}]}},
PlotRange->All];
Show[txt]

JavaView[txt]

Labels in 3D.

txt3D=Graphics3D[{Text["LeftUp",{-1,0,0.5}],Text["RightUp",{1,0,0.5}],Text["BackLow",{0,1,-0.5}],Text["FrontLow",{0,-1,-0.5}],{PointSize[.075],
RGBColor[1,0,0],Point[{0,0,0}]}},PlotRange->All];
Show[txt3D]

JavaView[txt3D]

Arrow

Arrow[{x1,y1},{x2,y2}] specifies base and end point of an arrow in the plane or in space. Different options allow to change the size and appearance of the arrow head.
Arrows are converted to a point set with vectors in JavaView. Currently, individual coloring of vectors is not enabled in JavaView.

This loads the package.

<<Graphics`Arrow`

Two arrows in different colors.

arr=Graphics[{Arrow[{0,0},{1,1}],
Hue[0],Arrow[{.75,.25},{.25,.75}]}];
Show[arr]

JavaView[arr]

You can even place arrows in options.

pa=Plot[2 Sin[x],{x,0,2Pi},Epilog->{Arrow[{4,.25},{Pi/2,1}],Text["Here",{4,.15},{0,-1}]}];

JavaView[pa]

Spline

The Spline[{{x1,y1},..}] primitive describes a cubic polynomial, a Bezier or a composite Bezier curve based on a set of given control points.
Splines will soon be enabled in JavaView. Currently JavaView renders the polygon only.

This loads the package.

<<Graphics`Spline`

This is a graph of the cubic Spline primitive combined with other primitives. Here a line of a different color connects the points making up the spline.

pts={{0,0},{1,2},{-1,3},{0,1},{3,0}};

ctl=Graphics[{Hue[0],Line[pts]}];
spl=Graphics[Spline[pts,Cubic]];
Show[ctl,spl]

JavaView[{ctl,spl}]

This fails in JavaView.

JavaView[spl]

ContourGraphics Object

ContourPlot[] is used to produce level lines. The command generates a ContourGraphics[] objects containing a rectangular array of scalar values. The contour lines itself are produced in a subsequent Show[] command or by a conversion to a Graphics[] object. The command produces both flat faces and the level curves.
Before being passed to JavaView a ContourGraphics will be casted to Graphics in Mathematica. The received Graphics object consists of Lines[] as contour lines and of Polygons[] as level regions. The first polygon is a rectangle of GrayLevel 0.5 filling the whole display. It is followed by polygons in falling and ascending order of GrayLevel, each bright polygon is part of each darker polygon surrounding it down to GrayLevel 0.5, and each dark polygon is part of each brighter polygon surrounding it up to GrayLevel 0.5.
In the JavaView display SORTING must be disabled in order to keep the original order of faces. All faces are in the same plane and would otherwise not correctly ordered.

This gives a contour plot of the function sin(x)sin(y).

c=ContourPlot[Sin[x] Sin[y],{x,-2,2},{y,-2,2}]

Assure that SORTING is disabled in the JavaView display inspector.

JavaView[c]

Switches off the shading avoids the problem of overlapping faces in JavaView.

gcns=ContourPlot[Sin[x] Sin[y],{x,-2,2},{y,-2,2},ContourShading->False]

JavaView[gcns]

Switches off the contours and views just the shading.

gcnl=ContourPlot[Sin[x] Sin[y],{x,-2,2},{y,-2,2},ContourLines->False]

JavaView[gcnl]

DensityGraphics Object

DensityGraphics[] shows a the values of a scalar function over a rectangular array of points in the plane as grayscale image. Lighter regions have higher values.

Density plots of an array of scalars.

gd=DensityPlot[Sin[x] Sin[y],{x,-2,2},{y,-2,2}]

JavaView[gd]

Suppresses the grid lines.

gdnm=DensityPlot[Sin[x] Sin[y],{x,-2,2},{y,-2,2},Mesh->False]

JavaView[gdnm]

SurfaceGraphics Object

The Plot3D[] command evaluates a function over a rectangular domain and shows the graph as SurfaceGraphics.

Show the graph of a function over a rectangular planar domain.

plt=Plot3D[Sin[x y],{x,0,4},{y,0,4}];

JavaView[plt]

The SurfaceGraphics[] command takes a height field of z-coordinates to visualize a graph over a rectangular xy-domain with given size. Note, the size of the domain must be specified explicitly using the option MeshRange, otherwise Mathematica puts grid values for x and y to the values 1, 2, 3 ...
JavaView parses the height field and automatically calculates the mesh based on the size of the domain and the number of grid points.

Use the option MeshRange to show the x and y coordinates at that values where the z coordinates are computed:

sgM=SurfaceGraphics[
Table[Sin[x]*Cos[y],{x,-Pi,Pi,Pi/4.},{y,-Pi,Pi,Pi/4.}],
MeshRange->{{-Pi,Pi},{-Pi,Pi}},Axes->True];
Show[sgM]

JavaView[sgM]

A SurfaceGraphics object where MeshRange is not defined. Note the wrong tick values.

sg=SurfaceGraphics[Table[Sin[x]*Cos[y],
{x,-Pi,Pi,Pi/4.},{y,-Pi,Pi,Pi/4.}],Axes->True];
Show[sg]

JavaView[sg]

ListPlot3D[array] generates a three-dimensional plot of a surface representing an array of height values. ListPlot3D[array, shades] generates a plot with each element of the surface shaded according to the specification in shades.

Here is a 3D plot made from a perturbed list of data.

lp=ListPlot3D[Table[5(Sin[x y]+Random[Real,{-0.15,0.15}]),{x,0,((3Pi)/2),(Pi/15)},{y,0,((3Pi)/2),(Pi/15)}]]

JavaView[lp]

GraphicsArray Object

Several graphics objects can be combined into a single image using GraphicsArray[].

Take a simple surface graphics.

gp=Plot3D[Sin[x] Sin[y],{x,-2,2},{y,-2,2}]

.. and draw its height as grayscale image.

dp=DensityPlot[Sin[x] Sin[y],{x,-2,2},{y,-2,2}]

Combine the surface and the height image into a single image.

ga=GraphicsArray[{gp,dp}];
Show[ga]

JavaView fails badly:

JavaView[ga]

This generates a list of graphics objects. Setting DisplayFunction -> Identity stops Plot3D from rendering the graphics it produces. Explicitly setting PlotRange ensures that the scale is the same in each piece of graphics.

table=Table[Plot3D[BesselJ[0,Sqrt[x^2+y^2]+t],{x,-10,10},{y,-10,10},Axes->False,PlotRange->{-0.5,1.0},DisplayFunction->Identity],{t,0,8}]

This partitions the graphics into three rows, and shows the resulting array of images.

gt=GraphicsArray[Partition[table,3]];
Show[gt]

JavaView[gt]

Working with Graphics Packages

Standard

The built-in commands in 2D allow to render function graphs and parametrized planar curves.

Function Graph

Graph of a sin curve.

p1=Plot[3Sin[t],{t,-π,π}]

JavaView[p1]

2D Curves

Parametrized planar curve.

p2=ParametricPlot[{Cos[5t],Sin[3t]},{t,0,2π},AspectRatio->Automatic];

JavaView[p2]

Graphics`ComplexMap`

<<Graphics`ComplexMap`

This plots the image of a complex function for a given domain.

pm=PolarMap[Exp,{0,4,1/4},{Pi/2,Pi,Pi/16}]

JavaView[pm]

Graphics`FilledPlot`

<<Graphics`FilledPlot`

This specifies which curves to fill between and the colors of the filled regions.

fp=FilledPlot[{Exp[-x],Cos[x],Sin[x]},{x,0,2 Pi},Fills->{{{1,Axis},RGBColor[1,0,0]},{{3,2},RGBColor[0,0,1]}},Curves->Front]

JavaView[fp]

Graphics`Graphics`

<<Graphics`Graphics`

This plots an ellipse and a limacon on the same graph.

gp=PolarPlot[{4/(2+Cos[t]),4Cos[t]-2},{t,0,2π}];

JavaView[gp]

Graphics`ImplicitPlot`

<<Graphics`ImplicitPlot`

This plots an ellipse using the Solve method.

ip=ImplicitPlot[x^2+2 y^2==3,{x,-2,2}]

JavaView[ip]

Graphics`Legend`

<<Graphics`Legend`

Here are sine and cosine curves with a legend.

l=Plot[{Sin[x],Cos[x]},{x,-2 Pi,2 Pi},PlotStyle->{GrayLevel[0],Dashing[{.03}]},PlotLegend->{"Sine","Cosine"}]

JavaView fails: Graphics inside a rectangle command are not parsed.

JavaView[l]

Graphics`MultipleListPlot`

<<Graphics`MultipleListPlot`

(list1=Table[{x,Sin[2 Pi x]},{x,0,1,0.1}];
list2=Table[{x,Cos[2 Pi x]},{x,0,1,0.1}]);

This shows two sets of points, displayed as little stars.

mlp=MultipleListPlot[list1,list2,PlotJoined->True]

JavaView fails: MultipleListPlot makes intense use of  Offset, which is not supported.

JavaView[mlp]

Graphics`PlotField`

Draws two-dimensional vector fields on a planar domain.

<<Graphics`PlotField`

The two components of this vector field are given by sin(x) and cos(y).

gv=PlotVectorField[{Sin[x],Cos[y]},{x,0,π},{y,0,π}];

JavaView[gv]

Package WorldPlot`

The package generates country maps of the world. Note: package is becoming obsolete and since 6.0 some functionality is available in built-in command CountryData[].

Needs["WorldPlot`"]

This will show a map of Africa.

a = WorldPlot[{Africa,RandomColors},WorldProjection->Sinusoidal]

JavaView[a]

DiscreteMath`Combinatorica`

Showing Graphs

This packages provides the Graph object which consists of a set of vertices and its adjacency matrix. Several commands produce and modify such graphs.
The command ShowGraph[] converts a Graph object in a Graphics object containing points and lines as a set of separate graphics primitives.
The adjacency matrix is stored in full size in the Graph object.
JavaView receives a graph as two separate geometries, a point set and a polygon set. The point set is obsolete if the the vertices of the polygon set are made visible.

<<DiscreteMath`Combinatorica`

sg=ShowGraph[GridGraph[3,3]]

JavaView[sg]

DiscreteMath`ComputationalGeometry`

<<DiscreteMath`ComputationalGeometry`

data2D={{4.4,14},{6.7,15.25},{6.9,12.8},{2.1,11.1},{9.5,14.9},{13.2,11.9},{10.3,12.3},{6.8,9.5},{3.3,7.7},{0.6,5.1},{5.3,2.4},{8.45,4.7},{11.5,9.6},{13.8,7.3},{12.9,3.1},{11,1.1}};

JavaView[d]

Plot of the Voronoi diagram of given points.

v=DiagramPlot[data2D]

JavaView[v]

DiscreteMath`Tree`

<<DiscreteMath`Tree`

Here is a graphical representation of a tree with10 nodes.

tp =TreePlot[MakeTree[Range[10]]]

JavaView[tp]

Working with Graphics3D Packages

Standard

Mathematica provides built-in commands to render function graphs, parametrized surfaces and curves in 3D.

Function Graph

Graph of a scalar function on a rectangular domain.

fg=Plot3D[y/6 Sin[x],{x,-Pi,Pi},{y,0.,6}]

JavaView[fg]

Parametrized Surfaces

Sphere in standard parametrization with meridians and parallels.

gp=ParametricPlot3D[{Cos[u] Cos[v],Sin[u] Cos[v],Sin[v]},{u,0,2Pi},{v,-Pi/2,Pi/2},PlotPoints->{40,10}];

JavaView[gp]

3D Curves

A closed curve in space.

cv=ParametricPlot3D[{Cos[5t],Sin[3t],Sin[t]},{t,0,2π}];

JavaView[cv]

Graphics`ContourPlot3D`

Compute implicit surfaces as zero set of a function or of a scalar values given at vertices of a ZxZxZ grid.

<<Graphics`ContourPlot3D`

Zero level of a function.

gc=ContourPlot3D[Cos[Sqrt[x^2+y^2+z^2]],{x,-2,2},{y,0,2},{z,-2,2}];

JavaView[gc]

Zero level of a regular scalar field in 3D.

data=Table[x^2+2*y^2+3*z^2,{z,-1,1,.25},{y,-1,1,.25},{x,-1,1,.25}];

gl=ListContourPlot3D[data,MeshRange->{{-1,1},{-1,1},{-1,1}},Lighting->False,Contours->{1.5,3.},Axes->True,ContourStyle->{{RGBColor[0,1,0]},{RGBColor[1,0,0]}}]

JavaView[gl]

Graphics`Graphics3D`

Package supplies different representations of 3D data like bar chart and shadow plots.

Bar Charts

Display scalar values on a uv-mesh as vertical columns whose height represent the value.

<<Graphics`Graphics3D`

This gives a bar chart made from a two-by-three array of bars with integer height.

gb=BarChart3D[{{1,2,3},{4,5,6}},BoxRatios->Automatic];

JavaView[gb];

ScatterPlot3D

ScatterPlot3D[] shows a set of 3D points and thereby extends ListPlot to 3D. Optionally, the points may be connected by a line.

<<Graphics`Graphics3D`

Here is a list of points in three dimensions.

lpts=Table[{t Cos[t],t Sin[t],t},{t,0,4Pi,Pi/20}];

Scatter plot of points lying on a conical helix.

sc=ScatterPlot3D[lpts]

JavaView[sc]

Join the points with a thicker line.

scl=ScatterPlot3D[lpts,PlotJoined->True,
PlotStyle->Thickness[0.01]]

JavaView[scl]

ListSurfacePlot3D uses an array of points and generates the faces of a surface.

Take an array of points in three dimensions.

apts=Table[{Cos[t] Cos[u],Sin[t] Cos[u],Sin[u]},{t,0,Pi,Pi/5},{u,0,Pi/2,Pi/10}];

The array of points is used to generate vertices of a polygonal mesh. It creates a piece of a sphere.

lsp=ListSurfacePlot3D[apts]

JavaView[lsp];

Shadow Plot

Draw shadows of a surface at its bounding box. ShadowPlot3D and ListShadowPlot3D work exactly like the built-in Plot3D and ListPlot3D, except shadows are drawn.

<<Graphics`Graphics3D`

Plot a 2D shadow below a 3D surface.

sp=ShadowPlot3D[Sin[x y],{x,0,3},{y,0,3}]

ShadowPosition determines whether shadow is above or below.

JavaView[sp];

st=ShadowPlot3D[Exp[-(x^2+y^2)],{x,-2,2},{y,-2,2},ShadowPosition->1]

JavaView[st];

Plot shadows at the bounding box of a 3D surface.

dbell=ParametricPlot3D[{Sin[t],Sin[2t] Sin[u],Sin[2t] Cos[u]},{t,-Pi/2,Pi/2},{u,0,2Pi},Ticks->None];
sa:=Shadow[dbell,ZShadow->False];

JavaView[sa]

Graphics`ParametricPlot3D`

The command ParametricPlot3D[] in this package expands the built-in command by allowing du and dv increments to be specified.

<<Graphics`ParametricPlot3D`

Determine number of lines through du and dv instead of PlotPoints.

gps=ParametricPlot3D[{Cos[u] Cos[v],Sin[u] Cos[v],Sin[v]},{u,0,2Pi,Pi/20},{v,-Pi/2,Pi/2,Pi/10}];

JavaView[gps]

Only a collection of points is shown when you use PointParametricPlot3D.

gpp=PointParametricPlot3D[{Cos[u] Cos[v],Sin[u] Cos[v],Sin[v]},{u,0,2Pi},{v,-Pi/2,Pi/2}];

JavaView[gpp]

Graphics`PlotField3D`

Creates and renders vector fields in 3D.

<<Graphics`PlotField3D`

A 3D vortex vector field.

gv3=PlotVectorField3D[{y,-x,0}/z,{x,-1,1},{y,-1,1},{z,1,3}]

JavaView[gv3]

The same vector field with VectorHeads.

gv3h=PlotVectorField3D[{y,-x,0}/z,{x,-1,1},{y,-1,1},{z,1,3},VectorHeads->True]

JavaView[gv3h]

Graphics`Polyhedra`

This package contains a collection of Platonic solids and commands for their modification like Stellate[] and Truncate[].

<<Graphics`Polyhedra`

Load package Graphics`Polyhedra and display a dodecahedron in a JavaView display.

dode=Graphics3D[Dodecahedron[]];
Show[dode]

JavaView[dode]

Truncate the dodecahedron.

tg=Truncate[dode];
Show[tg]

JavaView[tg]

Stellate the remainder.

ts=Stellate[tg];
Show[ts]

JavaView[ts]

Graphics`Shapes`

A collection of primitive surfaces including sphere, torus, Möbius band etc. is provided by this package.

<<Graphics`Shapes`

Combine two shapes and position them in a scene.

g1=TranslateShape[Graphics3D[Torus[]],{1.,0.,0.}];
g2=RotateShape[Graphics3D[MoebiusStrip[1.,0.2,30]],
Pi/2.,Pi/2.,0.];
Show[g1,g2];

JavaView accepts a list of geometries.

JavaView[{g1,g2}]

Graphics`SurfaceOfRevolution`

This package simplifies the task to generate a surface of revolution from a planar (or non-planar) curve by rotation around the default z-axis, or about a user specified rotation axis.

The curve Sin[x] is rotated around the z-axis with an offset.

<<Graphics`SurfaceOfRevolution`
gRot=SurfaceOfRevolution[{1.2+Sin[x],x},{x,0, 2Pi}];

JavaView[gRot];

The Pseudosphere is obtained by rotating a tractix around the z-axis.

Rotate the tractrix {f[x],g[x]} around the z-axis.

gPsd=SurfaceOfRevolution[{
Exp[-Abs[x]],
-Sign[x](Sqrt[1-Exp[-2 Abs[x]]]-
Log[(1+Sqrt[1-Exp[-2 Abs[x]]])/Exp[-Abs[x]]])},{x,-2.,2.}]

JavaView[gPsd];