<div dir="ltr">hi Robert, Community,<div><br></div><div>I have the following code in a loop against very large quadtree based database. And this code is eating all the memory, progressively and then the system kills it . Any clue?</div><div><br></div><div>Thanks a lot</div><div><br></div><div><div>osg::ref_ptr<osgUtil::LineSegmentIntersector> picker;</div><div>osg::ref_ptr<osgUtil::IntersectionVisitor> iv;</div><div><br></div><div>osg::Vec3d getHOT(const osg::Vec3d& position, osgViewer::CompositeViewer& viewer, osg::Vec3& normal, bool& valid)</div><div>{</div><div> osg::Vec3d result;</div><div><br></div><div><span style="white-space:pre"> </span>osg::EllipsoidModel em;</div><div><span style="white-space:pre"> </span>osg::Vec3d up = em.computeLocalUpVector(position.x(), position.y(), position.z());</div><div><span style="white-space:pre"> </span>up.normalize();</div><div><br></div><div><span style="white-space:pre"> </span>osg::Vec3d s = position + up * 100;</div><div> osg::Vec3d e = osg::Vec3d(0, 0, 0); </div><div><br></div><div> if (viewer.getView(0)->getSceneData())</div><div> {</div><div>#if 1</div><div><span style="white-space:pre"> </span>if (!picker.valid())</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>picker = new osgUtil::LineSegmentIntersector(s,e);</div><div><span style="white-space:pre"> </span>iv = new MyIntersectionVisitor(RANGE);</div><div><span style="white-space:pre"> </span>}</div><div><span style="white-space:pre"> </span>picker->setStart(s);</div><div><span style="white-space:pre"> </span>picker->setEnd(e);</div><div><span style="white-space:pre"> </span>picker->getIntersections().clear();</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>iv->setIntersector(picker);</div><div><span style="white-space:pre"> </span>iv->reset();</div><div><span style="white-space:pre"> </span>iv->setUseKdTreeWhenAvailable(false);</div><div><span style="white-space:pre"> </span>//iv->setLODSelectionMode(osgUtil::IntersectionVisitor::USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION);</div><div><span style="white-space:pre"> </span></div><div><span style="white-space:pre"> </span>viewer.getView(0)->getSceneData()->accept(*iv);</div><div><br></div><div><span style="white-space:pre"> </span>if (picker->containsIntersections())</div><div><span style="white-space:pre"> </span>{</div><div><span style="white-space:pre"> </span>osgUtil::LineSegmentIntersector::Intersections hitList = picker->getIntersections();</div><div><span style="white-space:pre"> </span>osgUtil::LineSegmentIntersector::Intersections::iterator hit = hitList.begin();</div><div><br></div><div><span style="white-space:pre"> </span>result = hit->getWorldIntersectPoint();</div><div><span style="white-space:pre"> </span>normal = hit->getWorldIntersectNormal();</div><div><span style="white-space:pre"> </span>valid = true;</div><div><br></div><div><span style="white-space:pre"> </span>return result;</div><div><span style="white-space:pre"> </span>}</div><div>#endif</div><div> }</div><div><span style="white-space:pre"> </span>valid = false;</div><div><br></div><div> return result;</div><div>}</div><div><br></div>-- <br><div class="gmail_signature">trajce nikolov nick<br></div>
</div></div>