Okay, here's another question on Bounds that I haven't figured out yet.

I finally figured out that to get the bounds of a Shape3D (or any Node)
in virtual world coordinates, to do the following:

void printBounds( Node n )
{
  Bounds b = new BoundingSphere( n.getBounds() );
  Transform3D xform = new Transform3D();
  n.getLocalToVworld( xform );
  b.transform( xform );

  System.out.println( "NODE " + node + "  nchildren=" +
node.numChildren() );
  System.out.println( "    bounds=" + b );
}

This works to show me the true bounds of my shape.  Now, I have a scene
graph that looks like:

  TG (instance)
   |
  TG (pivot)
   |
   G (group)
   |
  Shape3D

Since I compute the bounds of the shape in vworld coords, it include the
2 TG's above.  Thus, the bounds for each node shown in my scene graph
SHOULD BE EXACTLY THE SAME, but it's not:

NODE javax.media.j3d.TransformGroup@78aa80   nchildren=1
    bounds=Center=(37.001460210540245, 217.4887110348027,
50.68139838796939)  Radius=33.7654125608372 NODE
javax.media.j3d.TransformGroup@1d98a   nchildren=1
    bounds=Center=(8.189181655713963, 179.66457649987368,
37.125225898632465)  Radius=48.28454144558632 NODE
javax.media.j3d.Group@712651   nchildren=1
    bounds=Center=(8.189181655713963, 179.66457649987368,
37.125225898632465)  Radius=48.28454144558632 NODE
javax.media.j3d.Shape3D@aab40
    bounds=Center=(8.189181655713963, 179.66457649987368,
37.125225898632465)  Radius=48.28454144558632

How could a transform group change the bounds if it only has one child??
Again, the bounds computed for each node INCLUDES the transforms above
it using the code I have shown.

J. Lee Dixon
SAIC - Celebration, FL
321-939-7917
[EMAIL PROTECTED]    AOL: LeeOrlando

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to