determining visible points

I am representing data using a 3D graph similar to the tutorial example I need to be able to look at each data point entered into the graph
and determine whether or not it is currently visible.

For background info I am using visad from a java servlet that is run to generate
dynamic web pages based on a particular data set. For each web page downloaded a
JPEG snapshot is taken of the 3d graph and downloaded and I add an image map
with hot links at each listed data point. The class that I use to enter data
points also maintains a URL for each point that will provide more info. The web
page has controls that allow rotation of the graph to allow the user to see each
point. I would like to be able to detect whether or not a point is visible at a
particular time so I can avoid adding links to the web page for data points that
are covered by part of the graph.

I tried to use the java 3d pick logic to determine whether a point was visible.
I created a pickRay with origin at the center eye position and direction toward
my data point and attempted to pick the closest node and get the bounds. Since
the capability to read bounds was not set I am getting an exception.

As a fallback position I created a pickSegment using the eye position and the
data point as ends of the segment and tried to pick all. I made the assumption
that if the pick only returned one point it was the one I wanted.

Below is a code segment that includes both attempts at finding visible data

     TransformGroup tgroup;
     Transform3D trans;
     Point3d eyePos;
     Point3d dataPoint;
     SceneGraphPath[] pathSet;
     int pathCnt;
     PickSegment picker = new PickSegment();
     BranchGroup rootNode = renderer.getRoot();

     for (i=0; i<xSize; i++) {
          for (j=0; j<ySize; j++) {
               ** The following method returns a data point that lies
               ** within the bounds of
               ** -1.0 <= x <= 1.0
               ** -1.0 <= y <= 1.0
               ** -1.0 <= z <= 1.0
               dataPoint = getNormalizedDataPointAt(i, j);
               tgroup = renderer.getTrans();
               trans = new Transform3D();
               eyePos = new Point3d();
               picker.set(eyePos, dataPoint);

               /* attempt 1 */
               path = rootNode.pickClosest(picker);
               pickedNode = path.getObject();
               pickBounds = pickedNode.getBounds();
               if (pickBounds.intersect(dataPoint)) {
                    visible[i][j] = true;
               /* attempt 2 */
               pathSet = rootNode.pickAllSorted(picker);
               pathCnt = pathSet.length;
               if (pathCnt <=1) {
                    visible[i][j] = true;


Any help would be greatly appreciated.

Raymond J. Zeigler
Systems Programmer
Integrated Support Systems
Clemson, SC

  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: