You are a guest. Restricted access. Read more.
Command disabled: revisions

Plots in 3D

SCaVis contains several powerful engines to draw functions, histograms, data and various primitives in 3D. Graphics is fully interactive thus one can rotate objects, insert text etc. Many of such engines are 100% native to Java.

Several canvaces which can be used to show math objects are shown below:

Canvas Description
HPlot3D is used for plotting data in 3D H2D, P2D, P3D, F2D
HPlotXYZ is used for plotting data and geometrical objects in 3D using OpenGL. Can be used to show H2D, P3D, F2D
HPlot3DP is used for plotting parametric and non-parametric functions such as FPR
HPlotMX as before, for plotting parametric and non-parametric functions for mathematical “exhibits”

We have shown several example how to plot histogram and functions in Sections Histograms in 3D and Functions in 3D and Parametric function in 3D and Data in 3D

Showing data in 3D (X-Y-Z plots)

There are several pads to show data in 3D: HPlot3D (histograms, functions, data points) and HPlot3DP (used for parametric functions). All such canvases are 100% JAVA libraries.

Look at the examples in Sections Histograms in 3D and Functions in 3D and Parametric function in 3D and Data in 3D

SCaVis has many engines to render 3D graphics in fully interactive way. This is rather large topic which is discussed in Section 3D graphics. In this section we just show a few rather basic examples.

3D graphics from OFF files

Here is an example to read OFF files. In this case we read the file “teapot.off”

from jhpro.engine3d import *
view=HEngine3D("teapot.off")
view.setBounds(10, 10, 600, 400)
view.setVisible(1)

Read about the definitions of the OFF file Section OFF file description This engine does not support showing mathematical functions nor displaying axises.

There are several methods to change the color, transparency, and the solid style.

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

Advanced 3D graphics

This is the most powerful engine to render 3D graphics and mixing mathematical objects and graphical primitives.

Geometrical shapes

Here is an example which shows how to draw interactive geometrical shapes in the 3D canvas using Java and Jython. The code shown below is written in Jython/Python and contains only 10 lines.

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

Functions in 3D

One can plot functions in 3D, overlaying any number of functions and applying custom colors. Below a simple Jython example which shows this using 10 lines of code (similarly, one can rewrite this example in Java):

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

 Two functions on top

Now we will make a more complicated function: instead of giving a string defining a function, we will build a complex function using the Python language. Our function will look as this:

if x>0:   z=a*y*x+b*sin(y)
if x<0:   z=c*cos(x*y)+sin(y)

As you can see, it has 3 parameters a,b,c. Now let us create a small code snipped to draw such function. We put comments which explain each step:

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

 Complicated function

Math objects in 3D

One can draw the following mathematical objects: arrays of points with custom sizes and color, histograms and mathematical functions in 3D. All such objects can be overplayed on the same canvas. Below is a small script which plots several datasets in 3D (with blue and red points), functions as surfaces and H2D histograms:

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

 Histogram and function

Histograms can be shown using different style. In the above example we use “rainbow” color style for the histogram. One can also show it using solid color or as a surface:

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

 Histogram 3D styles

Showing 3D math exhibits

Functions (parametric and non-parametric) can be shown using HPlotMX canvas.

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

Please read the section 3D Math Exhibits for more detail.

Navigation

Print/export