Hi, >The simplest thing you can do - btw. I'm doing that in my own program - is >to get the bounding sphere from your scene and then encapsulate your scene >in a TransformGroup where the Transform only translate the scene with the >negated value of the scene center.
Thanks Florin, this works great. However, some of my data is vastly bigger in one axis than another. What I would really like is a BoundingBox of the whole scene, but it would appear that this cannot be auto computed [1]. Fabrizio Nunnari seems to have written some code to do this in Mar 2001 [2], but the code is not attached to his messages and a virus is (should this really be allowed in the archives? I have contacted [EMAIL PROTECTED]) Has anyone else done this, is there a better way, or do they still have Fabrizio Nunnari's code around? Also, though I am sure I am missing something easy, is how do you set and get the field of view. In open GL you would set it with the gluPerspective or glFrustum. I need this to calculate the view position from the size of the BoundingSphere. At present center.z = 0 - (2 * radius) gives an approximate position. Thanks for any help, Hugh [1] Comment on getting the Bounds of a scene http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind9904&L=java3d-interest&P=R27900& m=6965 [2] Fabrizio Nunnari says he has written code to do it, but it does not seem to be there, just a virus WARNING - THIS PAGE HAS A VIRUS ATTACHED (it is ok to view, just do not download the attached file) http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind0103&L=java3d-interest&D=0&m=221 13&P=76485 Some more links, just in case anyone is that interested - An opinion about getting a bounding box - http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind9908&L=java3d-interest&P=R23979& m=12287 Unanswered call for clarification http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind9904&L=java3d-interest&P=R27045& m=6965 >Delivered-To: [EMAIL PROTECTED] >MIME-Version: 1.0 >Content-Transfer-Encoding: quoted-printable >Subject: [JAVA3D] AW: [JAVA3D] Displaying entire scene [ Was Re: VRML] >To: [EMAIL PROTECTED] >X-Razor-id: 513e2cf4c8fc71aa1d427b02897e240e7ff3a72b > >The simplest thing you can do - btw. I'm doing that in my own program - is >to get the bounding sphere from your scene and then encapsulate your scene >in a TransformGroup where the Transform only translate the scene with the >negated value of the scene center. > >Other option will be to set the transform of the ViewingPlatform so that >your Viewer will look at the center of the scene. > >Here some code to play with... Hope it works... > > BranchGroup objRoot = new BranchGroup(); > BranchGroup objects = ... here you get the branch group >representing your objects ... > > BoundingSphere bs = (BoundingSphere)objects.getBounds(); > Point3d center = new Point3d(); > bs.getCenter(center); > > Transform3D t3d = new Transform3D(); > Point3d displ = (Point3d)center.clone(); > displ.negate(); > t3d.set(1.0f, new Vector3f(displ)); > TransformGroup centeredObjects = new TransformGroup(t3d); > objRoot.addChild(centeredObjects); > >Cheers, > >Florin > > > >-----Ursprüngliche Nachricht----- >Von: David Bourgais [mailto:[EMAIL PROTECTED]] >Gesendet: Donnerstag, 4. Juli 2002 15:24 >An: [EMAIL PROTECTED] >Betreff: Re: [JAVA3D] Displaying entire scene [ Was Re: VRML] > > >Hello > >Thanks a lot for your tips. >I tried many methods to center my VRML scenes. Unfortunately, it doesn't >works ! >Are you much luckier than me for this problem ? >If it's the case, could you send me a part of your code which could help >me ? >Thank you very much. > >Have a nice day. > >David Bourgais > >=========================================================================== >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". > >==========================================================================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". ==========================================================================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".