/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer * * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. * You have to aquire licenses for all used proprietary modules. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #include "region.h" region::region(osg::HeightField& h) { _lat_min = h.getOrigin()[1]; _lat_max = _lat_min + h.getNumRows() * h.getYInterval(); _lon_min = h.getOrigin()[0]; _lon_max = _lon_min + h.getNumColumns() * h.getXInterval(); } bool region::isInside(region& outsider) { if( outsider._lat_min <= _lat_min && _lat_max <= outsider._lat_max && outsider._lon_min <= _lon_min && _lon_max <= outsider._lon_max ) return true; else return false; } bool region::isFullOrPartiallyInside(region& outsider) { if( outsider._lat_min < _lat_max && _lat_min < outsider._lat_max && outsider._lon_min < _lon_max && _lon_min < outsider._lon_max ) return true; else return false; }