[osg-users] ComputeBoundsVisitor problem

2009-02-11 Thread Engvall Åsa
Hi osg-users!

I want to use a ComputeBoundsVisitor for finding the bounds of an object. The 
object belongs to the class GroundObject, which is derived from osg::Node.
Please have a look at this short function. The visitor is probably not 
executed, and the resulting bounding box is not valid.

void GroundObject::calculateDistanceToGround(void)
{
// Calculate distance from local origin to ground.
osg::ComputeBoundsVisitor cbv;
accept(cbv);
osg::BoundingBox box = cbv.getBoundingBox(); 
if (!box.valid()) ssPrintf(Bounding box is not valid!\n);
_distanceToGround = osg::absolute(box.zMin());
}

What is wrong here? 
Thanks in advance, 

Åsa Engvall
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ComputeBoundsVisitor problem

2009-02-11 Thread Simon Hammett
ComputeBoundsVisitor only computes bounds for drawables. ie geometry.

2009/2/11 Engvall Åsa asa.engv...@saabgroup.com:
 Hi osg-users!

 I want to use a ComputeBoundsVisitor for finding the bounds of an object.
 The object belongs to the class GroundObject, which is derived from
 osg::Node.

 Please have a look at this short function. The visitor is probably not
 executed, and the resulting bounding box is not valid.

 void GroundObject::calculateDistanceToGround(void)
 {
 // Calculate distance from local origin to ground.
 osg::ComputeBoundsVisitor cbv;
 accept(cbv);
 osg::BoundingBox box = cbv.getBoundingBox();
 if (!box.valid()) ssPrintf(Bounding box is not valid!\n);
 _distanceToGround = osg::absolute(box.zMin());
 }

 What is wrong here?
 Thanks in advance,

 Åsa Engvall

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





-- 
The truth is out there. Usually in header files.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ComputeBoundsVisitor problem

2009-02-11 Thread Engvall Åsa
Yes, but I was expecting that the visitor should traverse the graph an find the 
geometry that is below the GroundObject. If I do the same thing on an 
osg::Node, it works. Both the Node and the GroundObject are created using 
readNodeFile. 

Åsa

-Ursprungligt meddelande-
Från: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] För Simon Hammett
Skickat: den 11 februari 2009 12:51
Till: OpenSceneGraph Users
Ämne: Re: [osg-users] ComputeBoundsVisitor problem

ComputeBoundsVisitor only computes bounds for drawables. ie geometry.

2009/2/11 Engvall Åsa asa.engv...@saabgroup.com:
 Hi osg-users!

 I want to use a ComputeBoundsVisitor for finding the bounds of an object.
 The object belongs to the class GroundObject, which is derived from 
 osg::Node.

 Please have a look at this short function. The visitor is probably not 
 executed, and the resulting bounding box is not valid.

 void GroundObject::calculateDistanceToGround(void)
 {
 // Calculate distance from local origin to ground.
 osg::ComputeBoundsVisitor cbv;
 accept(cbv);
 osg::BoundingBox box = cbv.getBoundingBox();
 if (!box.valid()) ssPrintf(Bounding box is not valid!\n);
 _distanceToGround = osg::absolute(box.zMin()); }

 What is wrong here?
 Thanks in advance,

 Åsa Engvall

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
 org





--
The truth is out there. Usually in header files.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ComputeBoundsVisitor problem

2009-02-11 Thread Simon Hammett
I take it GroundObject is your own class that acts as a container.
Have you implemented the traverse method?

2009/2/11 Engvall Åsa asa.engv...@saabgroup.com:
 Yes, but I was expecting that the visitor should traverse the graph an find 
 the geometry that is below the GroundObject. If I do the same thing on an 
 osg::Node, it works. Both the Node and the GroundObject are created using 
 readNodeFile.

 Åsa

 -Ursprungligt meddelande-
 Från: osg-users-boun...@lists.openscenegraph.org 
 [mailto:osg-users-boun...@lists.openscenegraph.org] För Simon Hammett
 Skickat: den 11 februari 2009 12:51
 Till: OpenSceneGraph Users
 Ämne: Re: [osg-users] ComputeBoundsVisitor problem

 ComputeBoundsVisitor only computes bounds for drawables. ie geometry.

 2009/2/11 Engvall Åsa asa.engv...@saabgroup.com:
 Hi osg-users!

 I want to use a ComputeBoundsVisitor for finding the bounds of an object.
 The object belongs to the class GroundObject, which is derived from
 osg::Node.

 Please have a look at this short function. The visitor is probably not
 executed, and the resulting bounding box is not valid.

 void GroundObject::calculateDistanceToGround(void)
 {
 // Calculate distance from local origin to ground.
 osg::ComputeBoundsVisitor cbv;
 accept(cbv);
 osg::BoundingBox box = cbv.getBoundingBox();
 if (!box.valid()) ssPrintf(Bounding box is not valid!\n);
 _distanceToGround = osg::absolute(box.zMin()); }

 What is wrong here?
 Thanks in advance,

 Åsa Engvall

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
 org





 --
 The truth is out there. Usually in header files.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
The truth is out there. Usually in header files.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org