You are a guest. Restricted access. Read more.
SCaVis manual

3D math exhibits

In addition to the HPlot, HPlot2D, HPlot3D canvaces, SCaVis offers another canvas for for visualizing and experimenting with a variety of mathematical objects or “exhibits.” This class is called jhplot.HPlotMX

The class is based on 3D-XplorMath program of the 3DXM Consortium. ScaVis uses the base code of this program but adds a support for vector graphics i.e. one can export images to EPS, SVG or PDF formats. Thus, all images are fully scalable and are ready to be included to publications. If you need a similar program but with animation support (but without vector graphics export), use the ScaVis IDE (“See the Plot menu).

Here is a simple Jython script which creates a predefined paraboloid:

from jhplot import *
c1=HPlotMX("vmm3d.surface.parametric.Paraboloid")
c1.visible()

Here we simply call the class name that defines “Paraboloid”. The output of this script is shown below:

 Paraboloid

A similar example can be rewritten in BeanShell, Groovy or Java languages. Here is the same example in the Groovy scripting. Make a file “test.groovy”, and run it in ScaVis:

import jhplot.*
c1=new HPlotMX("vmm3d.surface.parametric.Paraboloid")
c1.visible()

In the above example we simply call the class name that defines a paraboloid function, see vmm3d.surface.parametric.Paraboloid class. There are about 60 predefined parametric mathematical functions that can be called to display. They are listed above with the corresponding Java API:

You have a limited access to this code example. One can unlock this code example after becoming a full member.

From the above list, one can pick up any math object and path its name as java.lang.String. Alternatively, one can construct mathematical exhibit by creating the object itself:

from jhplot import *
from vmm3d.surface.parametric import *
c1=HPlotMX()
ks=KuenSurface()  # create Kuen Surface
c1.draw(ks)
c1.visible()

The output is shown below:

Kuen Surface

As usual, use the method “export” to create an image file. For example, we can create EPS, PDF and SVG figures using the vector formats as:

c1.export("KuenSurface.eps")
c1.export("KuenSurface.pdf")
c1.export("KuenSurface.svg")

Showing custom functions

Now we consider how to draw custom parametric or non-parametric functions, instead of showing predefined functions.

First we create a function of torus using pure-Java approach:

Using Java to build custom function

You have a limited access to this code example. One can unlock this code example after becoming a full member.

The defined torus will be shown below:

Using Jython to build custom function

Instead of defining the function as a Java code, one can define it inside the same Jython script that is used to show the canvas with the object. Here is a simple Jython code to do this:

You have a limited access to this code example. One can unlock this code example after becoming a full member.

Run this Jython/Python script and you will see the identical torus. You can change any parameters. For example, inserting “setV(0,2)”, we will generate only a part of the torus as shown bellow:

 part of a torus

You can reduce the number of patches used to draw the torus, making this picture rendering faster.

Using Groovy to build custom function

Here is the same method to create a torus using Groovy scripting:

You have a limited access to this code example. One can unlock this code example after becoming a full member.

man/visual/plots3dmx.txt · Last modified: 2013/12/31 16:22 by admin
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5