| 84 | | std::cout<<"Computing LineOfSight"<<std::endl; |
| 85 | | |
| 86 | | los.computeIntersections(scene.get()); |
| 87 | | |
| 88 | | osg::Timer_t endTick = osg::Timer::instance()->tick(); |
| 89 | | |
| 90 | | std::cout<<"Completed in "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl; |
| 91 | | |
| 92 | | #if 1 |
| 93 | | for(unsigned int i=0; i<los.getNumLOS(); i++) |
| 94 | | { |
| 95 | | const osgSim::LineOfSight::Intersections& intersections = los.getIntersections(i); |
| 96 | | for(osgSim::LineOfSight::Intersections::const_iterator itr = intersections.begin(); |
| 97 | | itr != intersections.end(); |
| 98 | | ++itr) |
| 99 | | { |
| 100 | | std::cout<<" point "<<*itr<<std::endl; |
| 101 | | } |
| | 84 | { |
| | 85 | std::cout<<"Computing LineOfSight"<<std::endl; |
| | 86 | |
| | 87 | osg::Timer_t startTick = osg::Timer::instance()->tick(); |
| | 88 | |
| | 89 | los.computeIntersections(scene.get()); |
| | 90 | |
| | 91 | osg::Timer_t endTick = osg::Timer::instance()->tick(); |
| | 92 | |
| | 93 | std::cout<<"Completed in "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl; |
| | 94 | |
| | 95 | for(unsigned int i=0; i<los.getNumLOS(); i++) |
| | 96 | { |
| | 97 | const osgSim::LineOfSight::Intersections& intersections = los.getIntersections(i); |
| | 98 | for(osgSim::LineOfSight::Intersections::const_iterator itr = intersections.begin(); |
| | 99 | itr != intersections.end(); |
| | 100 | ++itr) |
| | 101 | { |
| | 102 | std::cout<<" point "<<*itr<<std::endl; |
| | 103 | } |
| | 104 | } |
| | 105 | } |
| | 106 | |
| | 107 | { |
| | 108 | // now do a second traversal to test performance of cache. |
| | 109 | osg::Timer_t startTick = osg::Timer::instance()->tick(); |
| | 110 | |
| | 111 | std::cout<<"Computing HeightAboveTerrain"<<std::endl; |
| | 112 | |
| | 113 | hat.computeIntersections(scene.get()); |
| | 114 | |
| | 115 | osg::Timer_t endTick = osg::Timer::instance()->tick(); |
| | 116 | |
| | 117 | for(unsigned int i=0; i<hat.getNumPoints(); i++) |
| | 118 | { |
| | 119 | std::cout<<" point = "<<hat.getPoint(i)<<" hat = "<<hat.getHeightAboveTerrain(i)<<std::endl; |
| | 120 | } |
| | 121 | |
| | 122 | |
| | 123 | std::cout<<"Completed in "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl; |
| 105 | | // now do a second traversal to test performance of cache. |
| 106 | | startTick = osg::Timer::instance()->tick(); |
| 107 | | |
| 108 | | std::cout<<"Computing HeightAboveTerrain"<<std::endl; |
| 109 | | |
| 110 | | hat.computeIntersections(scene.get()); |
| 111 | | |
| 112 | | for(unsigned int i=0; i<hat.getNumPoints(); i++) |
| 113 | | { |
| 114 | | std::cout<<" point = "<<hat.getPoint(i)<<" hat = "<<hat.getHeightAboveTerrain(i)<<std::endl; |
| 115 | | } |
| 116 | | |
| 117 | | endTick = osg::Timer::instance()->tick(); |
| 118 | | |
| 119 | | std::cout<<"Completed in "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl; |
| 120 | | |
| | 127 | { |
| | 128 | // now do a second traversal to test performance of cache. |
| | 129 | osg::Timer_t startTick = osg::Timer::instance()->tick(); |
| | 130 | |
| | 131 | std::cout<<"Computing ElevationSlice"<<std::endl; |
| | 132 | osgSim::ElevationSlice es; |
| | 133 | es.setDatabaseCacheReadCallback(los.getDatabaseCacheReadCallback()); |
| | 134 | |
| | 135 | es.setStartPoint(bs.center()+osg::Vec3d(bs.radius(),0.0,0.0) ); |
| | 136 | es.setEndPoint(bs.center()+osg::Vec3d(0.0,bs.radius(),0.0) ); |
| | 137 | |
| | 138 | es.computeIntersections(scene.get()); |
| | 139 | |
| | 140 | osg::Timer_t endTick = osg::Timer::instance()->tick(); |
| | 141 | |
| | 142 | std::cout<<"Completed in "<<osg::Timer::instance()->delta_s(startTick,endTick)<<std::endl; |
| | 143 | } |