Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cstddef>
#include <vector>

#include <boost/core/ignore_unused.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/value_type.hpp>
Expand Down Expand Up @@ -66,6 +67,8 @@ inline void display(MetaTurn const& meta_turn, const char* reason = "")
//<< " -> " << op_index
<< " " << reason
<< std::endl;
#else
boost::ignore_unused(meta_turn, reason);
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ struct result_from_distance

public:
template <typename T>
static inline return_type apply(this_strategy const& strategy,
T const& distance)
static inline return_type apply(this_strategy const& , T const& distance)
{
return static_cast<return_type>(distance);
}
Expand Down
23 changes: 15 additions & 8 deletions include/boost/geometry/strategy/cartesian/side_by_triangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <boost/geometry/strategies/compare.hpp>
#include <boost/geometry/strategies/side.hpp>

#include <boost/geometry/util/promote_integral.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/util/select_most_precise.hpp>

Expand Down Expand Up @@ -205,23 +206,29 @@ public :
template <typename P1, typename P2, typename P>
static inline int apply(P1 const& p1, P2 const& p2, P const& p)
{
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;

// Promote float->double, small int->int
using promoted_t = typename select_most_precise<coor_t, double>::type;

bool const are_all_integral_coordinates =
constexpr bool are_all_integral_coordinates =
std::is_integral<coordinate_type_t<P1>>::value
&& std::is_integral<coordinate_type_t<P2>>::value
&& std::is_integral<coordinate_type_t<P>>::value;

// Promote float to double
// For integer: short -> int -> long
// For larger integers: long, long long, std::int64_t all stay as they are (on a Mac)
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
using promoted_t = std::conditional_t
<
are_all_integral_coordinates,
typename promote_integral<coor_t>::type,
typename select_most_precise<coor_t, double>::type
>;

eps_policy< math::detail::equals_factor_policy<promoted_t> > epsp;
promoted_t s = compute_side_value
promoted_t const s = compute_side_value
<
coor_t, promoted_t, are_all_integral_coordinates
>::apply(p1, p2, p, epsp);

promoted_t const zero = promoted_t();
static promoted_t const zero = promoted_t();
return math::detail::equals_by_policy(s, zero, epsp.policy) ? 0
: s > zero ? 1
: -1;
Expand Down
6 changes: 3 additions & 3 deletions include/boost/geometry/util/promote_integral.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#ifndef BOOST_GEOMETRY_UTIL_PROMOTE_INTEGRAL_HPP
#define BOOST_GEOMETRY_UTIL_PROMOTE_INTEGRAL_HPP

// For now deactivate the use of multiprecision integers
// TODO: activate it later
// Uncommenting this macro will use Boost.Multiprecision's cpp_int<> as a last resort
// TODO (#1380): change this to BOOST_GEOMETRY_PROMOTE_INTEGER_TO_BOOST_MULTI_PRECISION
// to be able to let users actively choose to use Boost.Multiprecision, but not enable it by default
#define BOOST_GEOMETRY_NO_MULTIPRECISION_INTEGER


#include <climits>
#include <cstddef>
#include <type_traits>
Expand Down
Loading