33 #define UNUSED(expr) (void)(expr)
35 #define M_PI 3.14159265358979323846
45 template<
typename Container,
typename Value>
48 return container.find(value) != container.end();
55 template<
typename Container,
typename Generator>
58 std::shuffle(container.begin(), container.end(), generator);
61 typedef std::tuple<int, int, int, int>
BBoxInt;
62 typedef std::tuple<double, double, double, double>
BBoxFloat;
63 typedef std::tuple<bool, bool, bool, bool>
BBoxBool;
66 template<
typename Number>
96 template<
int... Indices>
115 using Bare =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
117 template<
typename Tuple>
124 template<
typename Tuple,
int... Indices>
126 typename std::tuple_element<0, Bare<Tuple>>::type,
127 std::tuple_size<Bare<Tuple>>::value>
131 return {{get<Indices>(std::forward<Tuple>(tuple))...}};
134 template<
typename Tuple>
136 -> decltype(
to_array(std::declval<Tuple>(), make_indices<Tuple>()))
138 return to_array(std::forward<Tuple>(tuple), make_indices<Tuple>());
155 return "Invalid direction";
172 template<
typename RasterIndex,
typename RasterType>
175 std::vector<std::vector<RasterIndex>> cells;
178 for (RasterIndex row = 0; row < raster.rows(); ++row) {
179 for (RasterIndex col = 0; col < raster.cols(); ++col) {
180 if (raster(row, col) > 0) {
181 cells.push_back({row, col});
188 #endif // POPS_UTILS_HPP