1. 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 internal representation, and, in some case, performs necessary cleanup 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. |
Remark on this Applet Version
The shown models are precomputed Mathematica graphics stored in *.mgs
files. All models were exported from a Mathematica notebook 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
.
The Mathematica code adjacent to each example below allows to
reproduce the examples in Mathematica and show them in a JavaView
display. First load the JavaView packages. The commands JavaView[g]
shows a Mathematica graphics in an interactive 3D display of JavaView.
Loading JavaView in Mathematica
The above commands are available after loading the JavaView package as follows:
Load the JavaView
package.
|
In[1]:=
<<JavaView`JLink` In[2]:= InstallJavaView[]; |
The models shown in the various applets were previously saved from a Mathematica session with the WriteMgs[] command included in the JavaView package.
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 panel.
-
A graphics may be 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 panel to allow non-uniform scaling (checkbox is 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.
Overview 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 GraphicsArary
|
||||||||||
Commands producing high level graphics objects (beside Graphics and Graphics3D) |
Producing Graphics[ ] Objects
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
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. |