<div dir="ltr">Thanks guys .. I did it per Robert's detailed description .. Took like 10mins and it works well ..<div><br></div><div>Thanks again!</div><div><br></div><div>Cheers!</div><div>Nick</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 2, 2016 at 2:57 PM, Glenn Waldron <span dir="ltr"><<a href="mailto:gwaldron@gmail.com" target="_blank">gwaldron@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Also check out osgShadow::ConvexPolyhedron if you want to extract the corner verts or make geometry from it.<span class="HOEnZb"><font color="#888888"><div><br><div><br></div></div></font></span></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_8771642828922516578gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Glenn Waldron</div></div></div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On Wed, Nov 2, 2016 at 9:47 AM, Jeff Biggs <span dir="ltr"><<a href="mailto:osg@simperative.com" target="_blank">osg@simperative.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
try this...<br>
<br>
osg::Polytope GetViewPolytope(<br>
    const osg::Matrix &p,<br>
    const osg::Matrix &v,<br>
    const osg::Matrix &m)<br>
{<br>
    osg::Polytope clipspace;<br>
    clipspace.setToUnitFrustum(tru<wbr>e, true);<br>
<br>
    // composite matrix<br>
    osg::Matrixd mvp = m * v * p;<br>
<br>
    // transform from clip space to local coords<br>
    osg::Polytope local;<br>
    local.setAndTransformProviding<wbr>Inverse(clipspace, mvp);<br>
<br>
    return local;<br>
}<br>
<br>
// --- Sample use case ---<br>
<br>
osg::Camera *cam;<br>
osg::Matrixd entityBodyMatrix;<br>
<br>
osg::Polytope viewPolytope = GetViewPolytope(<br>
    cam->getProjectionMatrix(), cam->getViewMatrix(), entityBodyMatrix);<br>
<br>
const osg::BoundingSphere boundSphere;<br>
<br>
if (viewPolytope.contains(boundSp<wbr>here) {<br>
    // sphere is inside of view<br>
}<br>
<br>
jeff<br>
<br>
<br>
<br>
On 11/2/16 3:43 AM, Robert Osfield wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 1 November 2016 at 21:45, Trajce Nikolov NICK<br>
<<a href="mailto:trajce.nikolov.nick@gmail.com" target="_blank">trajce.nikolov.nick@gmail.com</a><wbr>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Community,<br>
<br>
anyone knowing how to achieve this and with will to share?<br>
<br>
Thanks a bunch as always !!<br>
</blockquote>
Have a look at the API's...<br>
<br>
First one to look at is osg::Polytope, create one of these with a unit<br>
frustum.  This will be in clip space.<br>
<br>
Next step transform this Polytope by the projection matrix using the<br>
transformProvidingInverse() method (to transform a plane you multiple<br>
it by the inverse of that matrix), so in our case the projection<br>
matrix transform from eye space into clip space which is the inverse<br>
of the transform we intend, but thanks to the way that planes are<br>
transformed we can just use the projection matrix directly as long as<br>
we use the transformProvidingInverse().  See the src/osg/CullStack.cpp<br>
to see this in action.<br>
<br>
Then transform into object coordinates using the same method by<br>
providing the view and model matrices.<br>
<br>
Robert.<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph<wbr>.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.or<wbr>g/listinfo.cgi/osg-users-opens<wbr>cenegraph.org</a><br>
<br>
<br><span class="m_8771642828922516578HOEnZb"><font color="#888888">
</font></span></blockquote><span class="m_8771642828922516578HOEnZb"><font color="#888888">
<br>
<br>
-- <br>
Jeff Biggs<br>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph<wbr>.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.or<wbr>g/listinfo.cgi/osg-users-opens<wbr>cenegraph.org</a><br>
</font></span></blockquote></div><br></div></div></div>
<br>______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>
</div>