How can I get Daniel Selmans tree object program to allow me to see what
classes are in my VRML file?
Thanks,
Dean
----- Original Message -----
From: SUBSCRIBE JAVA3D-INTEREST Nazrul <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 12, 2000 2:34 PM
Subject: Re: [JAVA3D] getting shape from vrml and finding the points
> Well, if you have the shape DEF'd in the vrml file, it will be easier =)
> Let us say that the DEF'd object's name is CubeShape
>
> do
> Hashtable hash = Scene.getNamedObjects();
> Object rootObj = hash.get("CubeShape");
>
> file://now you must start doing some testing
> file://usually the rootObj will be a branchgroup, test it first
>
> if (rootObj instanceof BranchGroup){
> BranchGroup bgRoot = (BranchGroup)objRoot;
>
> file://next, the next child is usually a transform group, but
again, it could
> also be the shape right file://underneath it
>
> Object childObject = bgRoot.getChild(0);
> if (childObject instanceof TransformGroup)
> {
> TransformGroup tgRoot = (TransformGroup)childObject;
> file://now, again, the next item should be the child
> Object tmpObject = tgRoot.getChild(0);
>
> if (shapeObject instanceof Shape3D)
> {
> Shape3D shapeObject = (Shape3D)tmpObject;
>
> file://now get the geometry
> Geometry geomShape = shapeObject.getGeometry();
> file://yeah, you now have the geometry
> }
> }
> }
>
> now, the problem here is that, you never know if the child to parent
> relationships are going to be like this. You could use Daniel Selman's
tree
> object, load up the vrml object, see how the tree structure looks to get
to your
> vrml shape, and then write the code to get to it. Or, you could do almost
> exactly what he did in code and just build tree traversers, so you get the
main
> object from the hashtable, then start testing to see if it is a shape3D.
If it
> isn't cast it to it's object type, then get all of it's children and go
> recursively through them until you find a shape3d. Once you find the
shape3d you
> can get the geometry.
>
> Hope that helps
> Scott
>
>
> Scott Decker
> Research Scientist
> Pacific Northwest National Labs
> [EMAIL PROTECTED]
> please feed the squirrels
>
>
===========================================================================
> 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".