Gernot,

Yes, the mistake does appear to be in the Node class.
If you create a BoundingBox and retrieve its bounds then the correct upper
and lower bounds will be returned (rather than a sphere)...so the
BoundingBox does appear to work correctly.

In your example I also tried to cast the returned Bounds object, but caused
an exception in BoundingSphere...which confirms that the returned Bounds
object is a BoundingSphere.


Regards,

Andy



-----Original Message-----
From:   Veith, Gernot [mailto:[EMAIL PROTECTED]]
Sent:   17 June 1999 15:07
To:     Andrew Phelps; java3d interest
Subject:        Bounds settings (once more) BUG

Hi Andrew,

meanwhile I've made some more tests. If I'm understanding things wright,
each node has an initial BoundingBox (-1,-1,-1, 1,1,1). It will be cloned
and returned with getBounds(). But if you do so, you will get a sphere:
Center (0,0,0), Radius: -1

When you try the following:

Group group = new Group();
/*
        set according capabilities...
*/
group.setBounds(new Boundingbox(new Point3d(-1,-1,-1), new Point3d(1,1,1)));
//next will cause a ClassCastException:
Boundingbox bbox = (Boundingbox)group.getBounds();

This will also happen in the running app.
The clone() method of Bounds is working correctly, so I think it's a bug in
the Node class ?
You're right, the radius of the sphere is the distance from the center to a
vertex of the box.
I have written an application using geometry subdivision (BSP). Then I've
rebuilt the BSP tree using Group nodes. To each node I've assigned the
spatial part of the BSP tree as a BoundingBox.  But things went wrong, as
described above...

Hope some of the J3D "gods" will give us some further information about
that...

Gernot Veith
[EMAIL PROTECTED]
www.janet.de


> -----Urspr�ngliche Nachricht-----
> Von: Andrew Phelps [mailto:[EMAIL PROTECTED]]
> Gesendet am: Donnerstag, 17. Juni 1999 15:27
> An: Veith, Gernot
> Cc: Java Interest
> Betreff: RE: Bounds settings (once more)
>
> Gernot,
>
> I have played around with your example, and found the same
> problem.  The
> bounds of a node are always returned as a sphere.  I think
> that Java3D is
> automatically converting the boundingBox to a sphere as soon as it is
> assigned...I'm not sure if this is intentional or an error.
>
> Note that the radius of the returned sphere is not half that of the
> boundingBox's diameter, but the distance from the computed
> center of the box
> to the furthest most point within the box (i.e. the upper or lower
> ound).  - this is illustrated in the attached diagram.  It would be
> interesting to see if the boundingBox bounds still apply
> (even though a
> sphere's bounds are returned)...or if the sphere is used instead....
>
> Regards,
>
> Andy Phelps

Reply via email to