diff --git a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp index 142a3592e..ed7c1eb94 100644 --- a/include/boost/geometry/policies/robustness/get_rescale_policy.hpp +++ b/include/boost/geometry/policies/robustness/get_rescale_policy.hpp @@ -58,7 +58,8 @@ static inline void init_rescale_policy(Geometry const& geometry, num_type const diff = boost::numeric_cast(detail::get_max_size(env)); num_type const range = 10000000.0; // Define a large range to get precise integer coordinates num_type const half = 0.5; - factor = boost::numeric_cast( + factor = math::equals(diff, num_type()) ? 1 + : boost::numeric_cast( boost::numeric_cast(half + range / diff)); // Assign input/output minimal points @@ -90,7 +91,8 @@ static inline void init_rescale_policy(Geometry1 const& geometry1, num_type const diff = boost::numeric_cast(detail::get_max_size(env)); num_type const range = 10000000.0; // Define a large range to get precise integer coordinates num_type const half = 0.5; - factor = boost::numeric_cast( + factor = math::equals(diff, num_type()) ? 1 + : boost::numeric_cast( boost::numeric_cast(half + range / diff)); // Assign input/output minimal points