Region.cc | Region.cc | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
// Lesser General Public License for more details. | // Lesser General Public License for more details. | |||
// | // | |||
// You should have received a copy of the GNU Lesser General Public | // You should have received a copy of the GNU Lesser General Public | |||
// License along with this library; if not, write to the Free Software | // License along with this library; if not, write to the Free Software | |||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
// | // | |||
// Email: | // Email: | |||
// mhadji@gmail.com | // mhadji@gmail.com | |||
#include "../../include/SpatialIndex.h" | #include <spatialindex/SpatialIndex.h> | |||
#include <cstring> | #include <cstring> | |||
#include <cmath> | #include <cmath> | |||
#include <limits> | #include <limits> | |||
using namespace SpatialIndex; | using namespace SpatialIndex; | |||
Region::Region() | Region::Region() | |||
: m_dimension(0), m_pLow(0), m_pHigh(0) | : m_dimension(0), m_pLow(0), m_pHigh(0) | |||
{ | { | |||
skipping to change at line 295 | skipping to change at line 295 | |||
bool Region::touchesRegion(const Region& r) const | bool Region::touchesRegion(const Region& r) const | |||
{ | { | |||
if (m_dimension != r.m_dimension) | if (m_dimension != r.m_dimension) | |||
throw Tools::IllegalArgumentException( | throw Tools::IllegalArgumentException( | |||
"Region::touchesRegion: Regions have different numbe r of dimensions." | "Region::touchesRegion: Regions have different numbe r of dimensions." | |||
); | ); | |||
for (uint32_t i = 0; i < m_dimension; ++i) | for (uint32_t i = 0; i < m_dimension; ++i) | |||
{ | { | |||
if ( | if ( | |||
(m_pLow[i] >= r.m_pLow[i] - std::numeric_limits<doub | (m_pLow[i] >= r.m_pLow[i] + std::numeric_limits<doub | |||
le>::epsilon() && | le>::epsilon() && | |||
m_pLow[i] <= r.m_pLow[i] + std::numeric_limits<doubl | m_pLow[i] <= r.m_pLow[i] - std::numeric_limits<doubl | |||
e>::epsilon()) || | e>::epsilon()) || | |||
(m_pHigh[i] >= r.m_pHigh[i] - std::numeric_limits<do | (m_pHigh[i] >= r.m_pHigh[i] + std::numeric_limits<do | |||
uble>::epsilon() && | uble>::epsilon() && | |||
m_pHigh[i] <= r.m_pHigh[i] + std::numeric_limits<dou | m_pHigh[i] <= r.m_pHigh[i] - std::numeric_limits<dou | |||
ble>::epsilon())) | ble>::epsilon())) | |||
return true; | return false; | |||
} | ||||
return false; | ||||
/* | ||||
if (m_dimension != r.m_dimension) | ||||
throw Tools::IllegalArgumentException( | ||||
"Region::touchesRegion: Regions have different numbe | ||||
r of dimensions." | ||||
); | ||||
for (uint32_t i = 0; i < m_dimension; ++i) | ||||
{ | ||||
if ( | ||||
(m_pLow[i] <= r.m_pHigh[i] + std::numeric_limits<dou | ||||
ble>::epsilon() && | ||||
m_pLow[i] >= r.m_pHigh[i] - std::numeric_limits<dou | ||||
ble>::epsilon()) || | ||||
(m_pHigh[i] <= r.m_pLow[i] + std::numeric_limits<dou | ||||
ble>::epsilon() && | ||||
m_pHigh[i] >= r.m_pLow[i] - std::numeric_limits<dou | ||||
ble>::epsilon()) | ||||
) { | ||||
for (uint32_t j = 0; j < m_dimension; ++j) | ||||
if (m_pLow[j] > r.m_pHigh[j] || m_pHigh[j] < | ||||
r.m_pLow[j]) | ||||
return false; | ||||
return true; | ||||
} | ||||
} | } | |||
return false; | return true; | |||
*/ | ||||
} | } | |||
double Region::getMinimumDistance(const Region& r) const | double Region::getMinimumDistance(const Region& r) const | |||
{ | { | |||
if (m_dimension != r.m_dimension) | if (m_dimension != r.m_dimension) | |||
throw Tools::IllegalArgumentException( | throw Tools::IllegalArgumentException( | |||
"Region::getMinimumDistance: Regions have different number of dimensions." | "Region::getMinimumDistance: Regions have different number of dimensions." | |||
); | ); | |||
double ret = 0.0; | double ret = 0.0; | |||
skipping to change at line 519 | skipping to change at line 495 | |||
throw Tools::IllegalArgumentException( | throw Tools::IllegalArgumentException( | |||
"Region::getCombinedRegion: Regions have different n umber of dimensions." | "Region::getCombinedRegion: Regions have different n umber of dimensions." | |||
); | ); | |||
out = *this; | out = *this; | |||
out.combineRegion(in); | out.combineRegion(in); | |||
} | } | |||
double Region::getLow(uint32_t index) const | double Region::getLow(uint32_t index) const | |||
{ | { | |||
if (index < 0 || index >= m_dimension) | if (index >= m_dimension) | |||
throw Tools::IndexOutOfBoundsException(index); | throw Tools::IndexOutOfBoundsException(index); | |||
return m_pLow[index]; | return m_pLow[index]; | |||
} | } | |||
double Region::getHigh(uint32_t index) const | double Region::getHigh(uint32_t index) const | |||
{ | { | |||
if (index < 0 || index >= m_dimension) | if (index >= m_dimension) | |||
throw Tools::IndexOutOfBoundsException(index); | throw Tools::IndexOutOfBoundsException(index); | |||
return m_pHigh[index]; | return m_pHigh[index]; | |||
} | } | |||
void Region::makeInfinite(uint32_t dimension) | void Region::makeInfinite(uint32_t dimension) | |||
{ | { | |||
makeDimension(dimension); | makeDimension(dimension); | |||
for (uint32_t cIndex = 0; cIndex < m_dimension; ++cIndex) | for (uint32_t cIndex = 0; cIndex < m_dimension; ++cIndex) | |||
{ | { | |||
End of changes. 5 change blocks. | ||||
43 lines changed or deleted | 13 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |