On Fri, 2 Mar 2001, J. Lee Dixon wrote:

> My problem is that I was expecting to make a call to Node.getBounds() to
> find the distance between the viewer and the transparent node, but the
> Bounds class has no generic way of getting the center of the bounds.
> I've noticed that the Bounds are (so far) actually BoundingSpheres,
> which I can get the center of.  But I shouldn't have to assume (or hope)
> that the bounds are always BoundingSphere objects.
>
> Am I doing this the same way everybody else has done it??

use:
BoundingSphere bs = new BoundingSphere(Node.getBounds()) ;

but maybe it's more efficient to use:

Bounds b = Node.getBounds() ;
BoundingSphere bs ;
if(b instanceof BoundingSphere)
        bs = (BoundingSphere)b ;
else
        bs = new BoundingSphere(b) ;


The average should be better because if the bounds you get are already a
sphere you avoid memory allocation.


Fabrizio

--
http://digilander.iol.it/fnunnari

   Fabrizio Nunnari <[EMAIL PROTECTED]>
 -Student at Computer Science Department of Turin (Italy)-
Voodoo Chile of DeGeNeRaTiOn  for the Amiga scene --> Coder

===========================================================================
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