Hi, I've got a pretty large terrain database in the OpenFlight format. I've written an algorithm that samples the elevation at various/lots of points throughout the entire database. To accomplish this I'm wrapping a LineSegmentIntersector inside an IntersectionVisitor.
This first iteration of the algorithm took forever seemingly because each height query would page in one of the OpenFlight tiles, perform the height query, and discard that data. So the next height query would have to page in the same data again. To address this issue I started giving the IntersectionVisitor a reference to my DatabaseCacheReadCallback. This second iteration of my algorithm sped up performance dramatically. However, if I set the maximum number of files to cache to too high a number it will crash OSG. Presumably, because I'm running out of memory before the cache is full. Any suggestions on how to handle this? It would be nice if I could set a memory size on the cache file as opposed to the number of files. It would be nice if I could somehow tell OSG to gracefully handle this error. I'm sure the API address this issue and I'm just missing it, any suggestions? Here is a code sample of what I'm doing... Code: osg::Vec3d lineStart(xyPoint.x(), xyPoint.y(), -1000000); osg::Vec3d lineEnd(xyPoint.x(), xyPoint.y(), 1000000); osg::ref_ptr<osgUtil::LineSegmentIntersector> lineSegmentIntersector = new osgUtil::LineSegmentIntersector(lineStart, lineEnd); osg::ref_ptr<osgUtil::IntersectionVisitor> intersectionVisitor = new osgUtil::IntersectionVisitor(lineSegmentIntersector, mDatabaseCacheReadCallback); mRootNode->accept(*(intersectionVisitor.get())); osgUtil::LineSegmentIntersector::Intersections& intersections = lineSegmentIntersector->getIntersections(); if(intersections.size() > 0) { const osg::Vec3d& intersectionPoint = intersections.begin()->getLocalIntersectPoint(); } Thank you! Cheers, Ed[/code] ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45223#45223 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org