Hi Robert,
          Thanks for the quick reply. Actually I am trying to cull the 
scene based on some planes as a part of a display wall system I'm building 
over OSG, for this I need the bounding sphere at the current transformed 
position. I can transform the center of the sphere with all the matrices 
upto the root, but transforming the radius is a bit hard. Is there any 
other way to get the transformed sphere to this end.

Pawan

On Fri, 11 Jan 2008, Robert Osfield wrote:

> Hi Pawan,
>
> A node's local bounding sphere encompasses the subgraph below the
> node, and in the coordinate frame of the subgraph below the node, it's
> not at all affected by what happens above it in the scene graph.  The
> basic feature of scene graphs.
>
> Could you explain what you are wanting to do at a higher level, there
> is almost certainly a more nature way to do it.
>
> Robert.
>
> On Jan 11, 2008 9:40 AM, Pawan Harish <[EMAIL PROTECTED]> wrote:
>> Hi,
>>    I am trying to get the bounding sphere at a node but the return value is
>> the same as the initial bounding sphere although I've transformed the Node
>> using a MatrixTransform. Here is the code I'm using, could anyone please
>> tell me how to get the transformed bounding sphere. Thanks in advance.
>>
>> Pawan Harish
>>
>> int main(int argc, char **argv)
>> {
>>          osgViewer::Viewer viewer;
>>          osg::Group *group = new osg::Group;
>>          osg::MatrixTransform *mat1 = new osg::MatrixTransform;
>>          osg::MatrixTransform *mat2 = new osg::MatrixTransform;
>>          
>> mat1->setMatrix(osg::Matrix::translate(-50,0,0)*osg::Matrix::scale(0.2,0.2,0.2));
>>          
>> mat2->setMatrix(osg::Matrix::translate(-25,0,30)*osg::Matrix::scale(0.2,0.2,0.2));
>>          osg::Node* glider = osgDB::readNodeFile("glider.osg");
>>
>>          osg::Node* cow = osgDB::readNodeFile("cow.osg");
>>
>>          osg::Vec3 center_orig = cow->getBound().center();
>>          double radius_orig = cow->getBound().radius();
>>          printf("center_orig: %lf %lf %lf radius_orig: %lf\n",
>>         center_orig[0],center_orig[1],center_orig[2],radius_orig);
>>
>>          osg::Node* cessna = osgDB::readNodeFile("cessna.osg");
>>          glider->setName("Glider");
>>          cessna->setName("Cessna");
>>          cow->setName("Cow");
>>          mat1->setName("Matrix1_Cow");
>>          mat2->setName("Matrix2_Cessna");
>>          group->addChild(glider);
>>          mat1->addChild(cow);
>>          mat2->addChild(cessna);
>>          group->addChild(mat1);
>>          group->addChild(mat2);
>>          group->setName("PawansExpt");
>>          viewer.setSceneData(group);
>>
>>          osg::BoundingSphere bs = cow->getBound();
>>
>>         //These values are same as the ones printed above
>>
>>          osg::Vec3 center_new = bs.center();
>>          double radius_new = bs.radius();
>>          printf("center_new: %lf %lf %lf radius_new: %lf\n",
>>         center_new[0],center_new[1],center_new[2],radius_new);
>>
>>          return viewer.run();
>> }
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to