Re: How to access Facet Data in a 3D surface

Hi Greg,

> I am working on a project in which we are using VisAd to display a 3
> dimensional image of data points.  We essentially create a 3d surface out
> of these data points, which are made up of triangular facets, made out of
> the data points.  My question is pretty simple, but I am having a really
> interesting time figuring out how exactly VisAd creates all of these
> triangular facets, and how to access those facets.
> Essentially, I want the user to be able to click on the screen somewhere
> and be able to report what facet the user clicked on, and report any data
> associated with that facet. What I can't figure out is how VisAd stores the
> data associated with the facets that it is drawing.
> I have looked into MouseHelperJ3D and I see how to get the location in
> world space of the observer (eye_position) and how to get the location in
> 3D space that the user clicked on (position).  I can create a vector out of
> this and this is my ray in 3D space.  I want to know if that ray,
> emminating from the observer, going out into space, intersects with any of
> the facets in the data set we are displaying.
> I have looked into the following classes and elucidated the following (tell
> me where I am incorrect):
> FlatField is a container for the entire "data model"?
> DataReferenceJ3D setData() is a gateway of some kind in setting the data
> for each of the facets in the 3D surface?

Actually, FlatField is the class for Data objects that are
finite samplings of functions, with certain simple types.

DataReference is the interface for linking Data objects to
Displays of Cells (computations).

Some, but not all, Data depictions are composed of 3-D facets.

> The confusion I encounter is that when I try to go past the
> DataReferenceJ3D, it starts referencing an object called "Thing".  I am
> having difficulty understanding exactly what a "Thing" is.  Is it in any
> way related to how I access where the facets are in 3D space?
> Typically in 3D graphics one uses some kind of data structure to hold all
> of the facets in an object.  I understand this could be different for
> Java3D, but essentially, the data for displaying the facets has to be
> stored somewhere, and there has to be a way to access it.  Im just having
> difficulty finding it.

You might get some idea of how Data depictions are computed in
the draft DataRenderer tutorial. However, you don't need to dig
into all this - it is pretty complex. Rather, you might use
visad/bom/ It will tell you
which vertex (vertex rather than facet) in the surface is closest
to the mouse ray when the right mouse button is clicked. See
the main() method in this class for an example of how it should
be used.

Good luck,