示例#1
0
        virtual void apply(osg::Vec3dArray& array)
        {
            if (_pointList.size()!=array.size()) return;

            for(unsigned int i=0;i<_pointList.size();++i)
            {
                _pointList[i] = new EdgeCollector::Point;
                _pointList[i]->_index = i;

                _pointList[i]->_vertex = array[i];
            }
        }
示例#2
0
bool
BoundaryUtil::simpleBoundaryTest(const osg::Vec3dArray& boundary)
{
  osg::ref_ptr<osgEarth::Symbology::Polygon> boundsPoly = new osgEarth::Symbology::Polygon();
  for (int i=0; i < (int)boundary.size(); i++)
    boundsPoly->push_back(boundary[i]);

  osgEarth::Bounds boundsBounds = boundsPoly->getBounds();

  osg::ref_ptr<osgEarth::Symbology::Polygon> outterPoly = new osgEarth::Symbology::Polygon();
  outterPoly->push_back(osg::Vec3d(boundsBounds.xMin() - 10.0, boundsBounds.yMin() - 10.0, boundsBounds.zMin()));
  outterPoly->push_back(osg::Vec3d(boundsBounds.xMax() + 10.0, boundsBounds.yMin() - 10.0, boundsBounds.zMin()));
  outterPoly->push_back(osg::Vec3d(boundsBounds.xMax() + 10.0, boundsBounds.yMax() + 10.0, boundsBounds.zMin()));
  outterPoly->push_back(osg::Vec3d(boundsBounds.xMin() - 10.0, boundsBounds.yMax() + 10.0, boundsBounds.zMin()));

  osg::ref_ptr<osgEarth::Symbology::Geometry> outPoly;
  return outterPoly->difference(boundsPoly, outPoly);
}