Hi,

> The question is: When I load the VRML file, how can I get
> the bounding box of the object in the VRML file?
It is possible to query for the BoundingSphere of the VRML scene. Once you
have a BoundingSphere, including a center and a radius, you could
construct a BoundingBox from that, although it is probably not the best
fitting BoundingBox (just like getting minX, minY, minZ, maxX, maxY and
maxZ would not result in the best fitting BoundingBox). The getBounds()
method in BranchGroup should be able to return a BoundingBox by itself,
but in practice this does not work.
The following code fragment constructs a BoundingSphere from a VRML scene.

VrmlScene scene=null;
try
{
  URL loadUrl=new URL(getDocumentBase(), VRML_FILE_LOCATION);
  VrmlLoader loader=new VrmlLoader();
  scene=(VrmlScene)loader.load(loadUrl);
}
catch (Exception e)
{
  System.out.println("Exception loading file:"+e);
}
if (scene!=null)
{
  BranchGroup sceneGroup=scene.getSceneGroup();
  sceneGroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
  BoudingSphere sceneBounds=(BoundingSphere)sceneGroup.getBounds();
}

Eelco van den Berg.

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