I am playing with Node.getBounds() (for doing run-time transparency
ordering), and was expecting a different behavior out of the getBounds()
call.  For example, if I make a 2x2x2 cube, I expect a bounding box to
be (-1,-1,-1) to (1,1,1).  But then if I put a TransformGroup above the
shape with a translation transform of (50, 75, 0), I would expect the TG
to have the same size bounds, except translated.  This is not what I
get.

Looking at the below output and code, can someone (at Sun?) help me with
this?  It looks like it's the bounds of the child, not the node itself.
I understand the change from bounding box to bounding sphere, but not
why the TG bounds are located at 0,0,0.

BTW, how would (could) culling operations work successfully with this?
I don't think this is right at all... ;)

The output
---------------------------------------------------------
COLOR CUBE:  bounds=Bounding box: Lower=-1.0 -1.0 -1.0 Upper=1.0 1.0 1.0
COLOR CUBE XFORM:  bounds=Center=(0.0, 0.0, 0.0)
Radius=1.7320508075688772
GROUP:  bounds=Center=(50.0, 75.0, 0.0)  Radius=1.7320508075688772

The code
----------------------------------------------------------
// The color cube (2x2x2) centered at 0,0,0
Shape3D s = new com.sun.j3d.utils.geometry.ColorCube();
System.out.println("COLOR CUBE:  bounds=" + s.getBounds() );

// A transform to move the cube to 50,75
Transform3D sxform = new Transform3D();
sxform.setTranslation(new Vector3f(50f, 75f, 0f));
TransformGroup sgrp = new TransformGroup( sxform );
sgrp.addChild( s );
System.out.println("COLOR CUBE XFORM:  bounds=" + sgrp.getBounds() );

// Put the TG in a group (shouldn't have to do this)
Group g2 = new Group();
g2.addChild( sgrp );
System.out.println("GROUP:  bounds=" + g2.getBounds() );


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