Demonstration of VisAd's volume rendering capabilities
Source code name: "visad_3D_render.java"
Programming language: Java
Topic: Plots/3D
DMelt Version 1.9. Last modified: 07/02/1971. License: Free
https://datamelt.org/code/cache/visad_3D_render_4086.java
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


/*
A simple demonstration of VisAD's volume rendering capabilities. 
*/

import java.rmi.RemoteException;
import javax.swing.*;
import visad.*;
import visad.java3d.DisplayImplJ3D;

public class visad_3D_render {

  public static void main(String[] args)
    throws VisADException, RemoteException
  {
    // create types
    RealType x = RealType.getRealType("x");
    RealType y = RealType.getRealType("y");
    RealType z = RealType.getRealType("z");
    RealTupleType xyz = new RealTupleType(x, y, z);
    RealType value = RealType.getRealType("value");

    // generate some regular samples
    int size = 32;
    int count = size * size * size;
    Linear3DSet set = new Linear3DSet(xyz,
      0, 1000, size, 0, 1000, size, 0, 1000, size);
    float[][] samples = set.getSamples(false);

    // build field
    FunctionType ftype = new FunctionType(xyz, value);
    FlatField field = new FlatField(ftype, set);
    float[][] values = new float[1][count];
    for (int i=0; i