Re: Contouring

Hi Gunnar,

> I want to write an IsoSurface module for my application. It will take a
> field as input and generate iso surface in much the same way as the iso
> contour display map, except that it is separated from the display.
> 
> I was hoping to rely on current implementations to acheive this. If
> somebody could point me in the right direction I would appreciate it.

If you don't want your isosurface to appear in a display,
you can just write a method to extract values and domain
Set from a FlatField and compute an isosurface. Note
different algorithms are used for the Gridded and Irregular
cases of domain Set, and in fact for efficiency LinearSet
uses a special case algorithm.

However, if you want to take advantage of the VisAD metadata
mechanisms (units, coordinate systems, spatial and color
ScalarMaps, etc) then you can insert a call to your code
into the VisAD display logic by extending:

  visad.java3d.ShadowFunctionOrSetTypeJ3D

to override visad.ShadowType.makeContour(). To do this you
will also need to extend:

  visad.java3d.DefaultRendererJ3D

to override makeShadowFunctionType() to construct an
instance of you extension of ShadowFunctionOrSetTypeJ3D.
See visad/bom/BarbRendererJ3D.java which is a nice example
of this. 

Your override of makeContour() can mostly just copy the
code in the visad.ShadowType implementation. But replace
the calls to spatial_set.makeIsoSurface() and
((Linear3DSet) spatial_set).makeLinearIsoSurface()
with calls to your own isosurface method (which will not
be an instance method of Set classes, but instead extract
needed information from the Sets (which should be arguments
to your isosuface method.

Since you don't want your isosurface in a display, your
isosurface methods can just pass their results to some other
class (and probably get away with returning a null
VisADGeometryArray[] array.

An alternate approach is to define an extension of Gridded3DSet
and override its implementation of makeIsoSurface(), as well
as the implementation of makeSpatial() in visad.GriddedSet.

Good luck,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html