Re: [osg-users] Camera view frustum to Polytope
Hi guys, I've been trying to setup my Polytope as my cameras' frustum with no such luck. Robert has the setup changed? I'm using osg 2.8.1. Is this correct? What am I doing wrong? osg::Polytope frustum; frustum.setToUnitFrustum(); frustum.transformProvidingInverse( camera-getViewMatrix() ); incorrect results -- frustum.contains( this-getBound() ) --incorrect results Thank you! Cheers, Sean -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=24355#24355 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera view frustum to Polytope
On 18 February 2010 15:13, Sean McVey sean.r.mc...@lmco.com wrote: Hi guys, I've been trying to setup my Polytope as my cameras' frustum with no such luck. Robert has the setup changed? I'm using osg 2.8.1. Is this correct? What am I doing wrong? osg::Polytope frustum; frustum.setToUnitFrustum(); frustum.transformProvidingInverse( camera-getViewMatrix() ); incorrect results -- frustum.contains( this-getBound() ) --incorrect results You could try searching the mailing list archive: http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg27303.html -- http://www.ssTk.co.uk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera view frustum to Polytope
Hi Simon, What you need to do is use the Polytope::setToUnitFrustum(..) method to create the eye space -1,1 unit cube, then transform this is to world coordinates by multiplying it by the inverse of the camera's view matrix. It just so happens that there is a Polytope::transformProvidingInverse() method which you use (planes are transformed by multiplying by their inverse). Polytope frustum; frustum.setToUnitFrusmtum(); frustum.transformProvididingInvser(camera.getViewMatrix()); Robert. On Wed, May 13, 2009 at 9:20 PM, Simon Hammett s.d.hamm...@googlemail.com wrote: Hi Everyone, Is there a quick and easy way to populate a osg::Polytope with a cameras view frustum? I've tried stepping though osg::Viewer::frame(), but there's so much code I've either not stepped into the right function or just missed it and searching the mail achieve just brings up too many false results. tia, Simon. -- http://www.ssTk.co.uk ___ 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] Camera view frustum to Polytope
Thanks Robert :) Put me on the right track. Just for reference if anybody else needs it: osg::Polytope frustum; frustum.setToUnitFrustum(); frustum.transformProvidingInverse( pViewer-getCameraManipulator()-getInverseMatrix() * pViewer-getCamera()-getProjectionMatrix()); 2009/5/14 Robert Osfield robert.osfi...@gmail.com: Hi Simon, What you need to do is use the Polytope::setToUnitFrustum(..) method to create the eye space -1,1 unit cube, then transform this is to world coordinates by multiplying it by the inverse of the camera's view matrix. It just so happens that there is a Polytope::transformProvidingInverse() method which you use (planes are transformed by multiplying by their inverse). Polytope frustum; frustum.setToUnitFrusmtum(); frustum.transformProvididingInvser(camera.getViewMatrix()); Robert. On Wed, May 13, 2009 at 9:20 PM, Simon Hammett s.d.hamm...@googlemail.com wrote: Hi Everyone, Is there a quick and easy way to populate a osg::Polytope with a cameras view frustum? I've tried stepping though osg::Viewer::frame(), but there's so much code I've either not stepped into the right function or just missed it and searching the mail achieve just brings up too many false results. tia, Simon. -- http://www.ssTk.co.uk ___ 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 -- http://www.ssTk.co.uk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org