mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 21:44:04 +00:00
feat: make side strategy configurable
This commit is contained in:
parent
3e1e20b83c
commit
63104f0e27
@ -15,4 +15,18 @@
|
|||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE) \
|
||||||
|
&& defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST)
|
||||||
|
#error "Both BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE" \
|
||||||
|
" and BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST are defined." \
|
||||||
|
" Only one of them should be defined."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Define default side strategy, if not defined by the user.
|
||||||
|
// Until Boost 1.88.0, the default strategy is side_by_triangle.
|
||||||
|
#if ! defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE) \
|
||||||
|
&& ! defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST)
|
||||||
|
#define BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // BOOST_GEOMETRY_CORE_CONFIG_HPP
|
#endif // BOOST_GEOMETRY_CORE_CONFIG_HPP
|
||||||
|
@ -243,7 +243,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
|
#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
|
||||||
|
#if defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_BY_TRIANGLE)
|
||||||
namespace services
|
namespace services
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -253,9 +253,9 @@ struct default_strategy<cartesian_tag, CalculationType>
|
|||||||
using type = side_by_triangle<CalculationType>;
|
using type = side_by_triangle<CalculationType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace services
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
|
||||||
|
|
||||||
}} // namespace strategy::side
|
}} // namespace strategy::side
|
||||||
|
|
||||||
|
@ -178,6 +178,21 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
|
||||||
|
#if defined(BOOST_GEOMETRY_DEFAULT_STRATEGY_SIDE_USE_SIDE_ROBUST)
|
||||||
|
namespace services
|
||||||
|
{
|
||||||
|
|
||||||
|
template <typename CalculationType>
|
||||||
|
struct default_strategy<cartesian_tag, CalculationType>
|
||||||
|
{
|
||||||
|
using type = side_robust<CalculationType>;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace services
|
||||||
|
#endif
|
||||||
|
#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
|
||||||
|
|
||||||
}} // namespace strategy::side
|
}} // namespace strategy::side
|
||||||
|
|
||||||
}} // namespace boost::geometry
|
}} // namespace boost::geometry
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
|
#define GEOMETRY_TEST_GEOMETRY_TEST_COMMON_HPP
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/core/demangle.hpp>
|
||||||
|
|
||||||
// Determine debug/release mode
|
// Determine debug/release mode
|
||||||
// (it would be convenient if Boost.Config or Boost.Test would define this)
|
// (it would be convenient if Boost.Config or Boost.Test would define this)
|
||||||
@ -94,6 +95,7 @@
|
|||||||
#include <boost/geometry/core/closure.hpp>
|
#include <boost/geometry/core/closure.hpp>
|
||||||
#include <boost/geometry/core/point_order.hpp>
|
#include <boost/geometry/core/point_order.hpp>
|
||||||
#include <boost/geometry/core/tag.hpp>
|
#include <boost/geometry/core/tag.hpp>
|
||||||
|
#include <boost/geometry/strategies/strategies.hpp>
|
||||||
namespace bg = boost::geometry;
|
namespace bg = boost::geometry;
|
||||||
|
|
||||||
|
|
||||||
@ -210,6 +212,13 @@ inline void BoostGeometryWriteTestConfiguration()
|
|||||||
std::cout << " - Including failing test cases" << std::endl;
|
std::cout << " - Including failing test cases" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
std::cout << " - Default test type: " << string_from_type<default_test_type>::name() << std::endl;
|
std::cout << " - Default test type: " << string_from_type<default_test_type>::name() << std::endl;
|
||||||
|
|
||||||
|
using side_strategy = typename bg::strategy::side::services::default_strategy
|
||||||
|
<
|
||||||
|
bg::cartesian_tag
|
||||||
|
>::type;
|
||||||
|
std::cout << " - Side strategy: " << boost::core::demangle(typeid(side_strategy).name()) << std::endl;
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user