Re: Transform of ViewPlatform, and Re: range value at cursor

Hi John,
 
> Is it, or will it be possible to get the Transform of the ViewPlatform?
> Is it somehow contained in "root"?  It would sometimes be useful to have
> ViewPlatform-centric navigation, a la "Walk" or "Fly" in VRML browsers.
 
You can control the view point for fly throughs via the
ProjectionControl classes.  Note that examples/Test57.java
and examples/Test58.java illustrate how to do this for
Java3D and Java2D.  Note that Java3D matrices have 16
elements (4 x 4) and Java2D matrices have 6 elements
(3 x 2).
 
VisAD applies the ProjectionControl viewing transforms to the
data "geometry" side of the scene graph rather than the
ViewPlatform side.  This way the use of ProjectionControl
will not change between displays on ordinary workstation
screens and in immersive virtual reality, where there may
be several different views (such as for multiple CAVE walls
or for binocular stereo).
 
However, if applications need to get at the ViewPlatform
stuff, we are certainly open to adding methods to
visad.java3d classes to provide such access.
 
> What would be the most straightforward way to get the range value at a
> cursor location?
 
Say for example the data is a FlatField with MathType ((x, y0 -> range)
and ScalarMaps are map_x: x -> XAxis and map_y: y -> YAxis.  Then:

  double[] scale_offset = new double[2];
  double[] dum_1 = new double[2];
  double[] dum_2 = new double[2];
  float[] cur = display.getDisplayRenderer().getCursor();
  map_x.getScale(scale_offset, dum_1, dum_2);
  double value_x = (cur[0] - scale_offset[1])/scale_offset[0];
  map_y.getScale(scale_offset, dum_1, dum_2);
  double value_y = (cur[1] - scale_offset[1])/scale_offset[0];
  RealTuple tuple
    new RealTuple(new Real[] {new Real(x, value_x),
                              new Real(y, value_y)});
  double range_value = ((Real) flat_field.evaluate(tuple)).getValue();
 
There is also the possibility of using the direct manipulation
renderers to create custom cursors (see visad/rabin/Rain.java
for an example).  These are generally RealTuple data objects with
custom Shapes that the user can drag.  Changes in these RealTuples
then trigger CellImpl computations that extract FlatField values
or whatever.
 
Cheers,
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