00001 #include <esg/explorer/POGExplorer.h> 00002 #include <esg/geometry/Geometry.h> 00003 00004 using namespace esg; 00005 00006 bool POGExplorer::_process_leaf(SceneGraphObject& obj) 00007 { 00008 const Geometry* pGeom = obj.geometry(); 00009 if (!pGeom) return false; 00010 00011 if (_trStack.empty()) _pog.add(pGeom->centroid()); 00012 else { 00013 Vector3 pog(pGeom->centroid()); 00014 _trStack.top()->transform(pog); 00015 _pog.add(pog); 00016 } 00017 _num++; 00018 00019 return true; 00020 } 00021 00022 00023 Vector3 POGExplorer::result() 00024 { 00025 if (_num) _pog.scale(1.0/_num); 00026 _num = 0; 00027 return _pog; 00028 }