[util] Fix normalize spheroidal for nan coordinates.

Make sure that assertion doesn't fail for nan longitude.
Make sure that a box containing nan longitude is not considered to be a
band.
This commit is contained in:
Adam Wulkiewicz 2022-01-27 17:21:14 +01:00
parent 6099339544
commit 36a4275d39
2 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2015-2017, Oracle and/or its affiliates.
// Copyright (c) 2015-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -37,8 +37,8 @@ private:
static inline bool is_band(CoordinateType const& longitude1,
CoordinateType const& longitude2)
{
return ! math::smaller(math::abs(longitude1 - longitude2),
constants::period());
return math::larger_or_equals(math::abs(longitude1 - longitude2),
constants::period());
}
public:
@ -91,8 +91,7 @@ public:
BOOST_GEOMETRY_ASSERT(! math::larger(longitude1, longitude2));
BOOST_GEOMETRY_ASSERT(! math::smaller(longitude1, constants::min_longitude()));
BOOST_GEOMETRY_ASSERT
(! math::larger(longitude2 - longitude1, constants::period()));
BOOST_GEOMETRY_ASSERT(! math::larger(longitude2 - longitude1, constants::period()));
}
static inline void apply(CoordinateType& longitude1,

View File

@ -2,7 +2,7 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2015-2020, Oracle and/or its affiliates.
// Copyright (c) 2015-2022, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -308,7 +308,7 @@ public:
BOOST_GEOMETRY_ASSERT(! math::larger(latitude, constants::max_latitude()));
#endif // BOOST_GEOMETRY_NORMALIZE_LATITUDE
BOOST_GEOMETRY_ASSERT(math::smaller(constants::min_longitude(), longitude));
BOOST_GEOMETRY_ASSERT(! math::larger_or_equals(constants::min_longitude(), longitude));
BOOST_GEOMETRY_ASSERT(! math::larger(longitude, constants::max_longitude()));
}
};