// perform very basic sanity-check validation on a heightfield.
bool validateHeightField(osg::HeightField* hf)
{
        if (!hf)
            return false;
        if (hf->getNumRows() < 2 || hf->getNumRows() > 1024)
            return false;
        if (hf->getNumColumns() < 2 || hf->getNumColumns() > 1024)
            return false;
        if (hf->getHeightList().size() != hf->getNumColumns() * hf->getNumRows())
            return false;
        if (hf->getXInterval() < 1e-5 || hf->getYInterval() < 1e-5)
            return false;
       
        return true;
    }

04-27 22:43