Small changes to enable Boost.Rational (part 1)

[SVN r73602]
This commit is contained in:
Barend Gehrels
2011-08-07 18:30:52 +00:00
parent 4d540b5a1d
commit ad1a3072ff
5 changed files with 23 additions and 13 deletions

View File

@@ -76,7 +76,7 @@ struct ring_info_helper
{}
inline ring_info_helper(ring_identifier i, area_type a)
: id(i), real_area(a), abs_area(abs(a))
: id(i), real_area(a), abs_area(geometry::math::abs(a))
{}
};

View File

@@ -10,7 +10,7 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_CALCULATE_DISTANCE_POLICY_HPP
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
namespace boost { namespace geometry
@@ -34,9 +34,9 @@ struct calculate_distance_policy
static inline void apply(Info& info, Point1 const& p1, Point2 const& p2)
{
info.operations[0].enriched.distance
= geometry::distance(info.point, p1);
= geometry::comparable_distance(info.point, p1);
info.operations[1].enriched.distance
= geometry::distance(info.point, p2);
= geometry::comparable_distance(info.point, p2);
}
};

View File

@@ -10,7 +10,7 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICHMENT_INFO_HPP
#include <boost/geometry/strategies/default_distance_result.hpp>
#include <boost/geometry/strategies/distance.hpp>
namespace boost { namespace geometry
@@ -23,15 +23,25 @@ namespace detail { namespace overlay
/*!
\brief Keeps info to enrich intersection info (per source)
\details Class to keep information necessary for traversal phase (a phase
of the overlay process). The information is gathered during the
enrichment phase
\brief Keeps info to enrich intersection info (per source)
\details Class to keep information necessary for traversal phase (a phase
of the overlay process). The information is gathered during the
enrichment phase
*/
template<typename P>
struct enrichment_info
{
typedef typename default_distance_result<P, P>::type distance_type;
typedef typename strategy::distance::services::return_type
<
typename strategy::distance::services::comparable_type
<
typename strategy::distance::services::default_strategy
<
point_tag,
P
>::type
>::type
>::type distance_type;
inline enrichment_info()
: travels_to_vertex_index(-1)

View File

@@ -82,7 +82,7 @@ private :
inline return_type area() const
{
return_type result = sum;
result *= 0.5;
result /= 2;
return result;
}
};

View File

@@ -376,8 +376,8 @@ private :
// In robustness it can occur that a point of A is inside B AND a point of B is inside A,
// still while has_common_points is true (so one point equals the other).
// If that is the case we select on length.
coordinate_type const length_a = abs(a_1 - a_2);
coordinate_type const length_b = abs(b_1 - b_2);
coordinate_type const length_a = geometry::math::abs(a_1 - a_2);
coordinate_type const length_b = geometry::math::abs(b_1 - b_2);
if (length_a > length_b)
{
a_in_b = false;