Stunning 3D visualization with JavaView

February 21, 2021 - Reading time: 3 minutes

JavaView (http://www.javaview.de/) is a 3D geometry viewer and a mathematical visualization software known since 90x. The program is written in Java, and enables a smooth integration into commercial software like Mathematica and Maple. JavaView can be used for 3D scientific visualization, geometric modeling, variational optimization, vector fields etc.

When originally created, JavaView was integrated in the Web using Java applets. This technology has been deprecated, thus disabling one of the main functionalities of JavaView (see a recent preprint by M.Skrodzki and R.Ithems). Currently, the support of Java applets in recent browsers is very limited, disabling many online examples and tutorials based on JavaView.

With the incredible growth of Python usage, it becomes apparent that integration of the JavaView geometry viewer into Python will bring significant benefits and can extend its usage as a scientific visualization tool. Recently, JavaView was added to DataMelt which allows high-quality 3D visualization of mathematical and geometry objects using the syntax of the Python language (with the help of Jython backend). DataMelt also can be used to run the JavaView library using several scripting languages, such as Groovy, JRuby, BeanShell. An integration of JavaView into scripting languages means that short code snippets can be used to build and configure JavaView classes, instead of using many parameters passed to Java applets as it was done in the past.

Using the Python syntax, it takes only a few lines of the code to make impressive interactive 3D objects. For example, look at this short code that visualizes a snail in 3D using parametric functions:

from jv.geom import PgElementSetfrom jhplot import HJavaViewobj = PgElementSet(3)obj.computeSnail(40, 30, 2.0)c1= HJavaView()c1.draw(obj)c1.visible()

You can run this code inside DataMelt version 2.5. You may notice that one can mix JavaView and DataMelt classes in a single code. The main canvas used to visualize JavaView geometric and mathematical objects is called HJavaView. Note that JavaView library inside DataMelt still requires registration using the online form http://www.javaview.de/, but even without it the software is fully functional (you will see a pop-up window that reminds about the registration).

Here is a gallery of 3D math objects created using Jython code examples:

 

DataMelt with JavaView

 

You can find the code snippets  used to make such images from this repository of DataMelt code examples.

 

June 21, 2020

S.Chekanov

Category:

Mission

Our mission is to promote computing for science and education. We believe any knowledge software should be free and accessible.