Hi Enrico,
Enrico wrote:
> Hi all users,
>
> i am stuck in a puzzling problem.
> I want to check if any of my geometries lye within
> a frustum. In order to achieve this, in a reasonably
> fast way, I am building the frustum via six planes,
> and then check it vs the bounding spheres of the geometries.
>
> Here is my code:
>
> // build the 6 planes for the frustum
>
> osg::Plane nearPlane = osg::Plane
> (pntTopLeftNear,pntTopRightNear,pntBottomLeftNear);
>
> osg::Plane farPlane = osg::Plane
> (pntTopLeftFar,pntTopRightFar,pntBottomLeftFar);
>
> osg::Plane leftPlane = osg::Plane (from, pntTopLeftFar,pntBottomLeftFar);
>
> osg::Plane rightPlane = osg::Plane (from, pntTopRightFar,pntBottomRightFar);
>
> osg::Plane topPlane = osg::Plane (from, pntTopLeftFar, pntTopRightFar);
>
> osg::Plane bottomPlane = osg::Plane(from, pntBottomLeftFar,
> pntBottomRightFar);
For a plane constructed from three points p0,p1,p2 the normal points in
direction (p1-p0) x (p2-p0). For your frustum you need all normals to
point into the interior of the frustum, did you check this ?
(I tried to figure this from the intersection code, so I might have
confused something and all normals need to point into the exterior - can
someone who knows this for sure chime in on this, please ?)
Other than this I can not see any problems with your code.
Hope it helps,
Carsten
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users