|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76904 - in branches/release/boost/geometry: . algorithms algorithms/detail/overlay algorithms/detail/sections arithmetic core geometries io io/dsv io/wkt iterators multi multi/algorithms policies policies/relate strategies strategies/agnostic strategies/cartesian strategies/transform util views
From: barend.gehrels_at_[hidden]
Date: 2012-02-05 13:47:18
Author: barendgehrels
Date: 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
New Revision: 76904
URL: http://svn.boost.org/trac/boost/changeset/76904
Log:
Merged geometry fixes since 2011-01-15
Added:
branches/release/boost/geometry/arithmetic/cross_product.hpp
- copied unchanged from r76903, /trunk/boost/geometry/arithmetic/cross_product.hpp
branches/release/boost/geometry/arithmetic/determinant.hpp
- copied unchanged from r76903, /trunk/boost/geometry/arithmetic/determinant.hpp
branches/release/boost/geometry/util/calculation_type.hpp
- copied unchanged from r76903, /trunk/boost/geometry/util/calculation_type.hpp
Removed:
branches/release/boost/geometry/policies/relate/intersection_points_determinant.hpp
branches/release/boost/geometry/policies/relate/intersection_points_slope.hpp
Properties modified:
branches/release/boost/geometry/algorithms/ (props changed)
branches/release/boost/geometry/arithmetic/ (props changed)
branches/release/boost/geometry/core/ (props changed)
branches/release/boost/geometry/geometries/ (props changed)
branches/release/boost/geometry/geometry.hpp (props changed)
branches/release/boost/geometry/io/ (props changed)
branches/release/boost/geometry/io/dsv/ (props changed)
branches/release/boost/geometry/iterators/ (props changed)
branches/release/boost/geometry/multi/ (props changed)
branches/release/boost/geometry/policies/ (props changed)
branches/release/boost/geometry/strategies/ (props changed)
branches/release/boost/geometry/util/ (props changed)
branches/release/boost/geometry/views/ (props changed)
Text files modified:
branches/release/boost/geometry/algorithms/append.hpp | 2
branches/release/boost/geometry/algorithms/buffer.hpp | 2
branches/release/boost/geometry/algorithms/centroid.hpp | 6 +-
branches/release/boost/geometry/algorithms/correct.hpp | 39 +++++++---------
branches/release/boost/geometry/algorithms/covered_by.hpp | 50 ++++++++------------
branches/release/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp | 3 +
branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp | 6 +-
branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp | 12 ++--
branches/release/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp | 2
branches/release/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp | 93 ++++++++++++++++++++++++++++++++-------
branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp | 24 ++++++---
branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp | 12 ++--
branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp | 21 ++++----
branches/release/boost/geometry/algorithms/detail/overlay/select_rings.hpp | 8 +-
branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp | 8 ++
branches/release/boost/geometry/algorithms/detail/sections/range_by_section.hpp | 2
branches/release/boost/geometry/algorithms/disjoint.hpp | 21 +++++++-
branches/release/boost/geometry/algorithms/distance.hpp | 2
branches/release/boost/geometry/algorithms/for_each.hpp | 4 +
branches/release/boost/geometry/algorithms/simplify.hpp | 4
branches/release/boost/geometry/algorithms/within.hpp | 47 ++++++++------------
branches/release/boost/geometry/io/wkt/iomanip.hpp | 14 +----
branches/release/boost/geometry/io/wkt/wkt.hpp | 6 ++
branches/release/boost/geometry/multi/algorithms/convert.hpp | 4
branches/release/boost/geometry/multi/algorithms/correct.hpp | 6 +-
branches/release/boost/geometry/multi/algorithms/covered_by.hpp | 6 +
branches/release/boost/geometry/multi/algorithms/intersection.hpp | 2
branches/release/boost/geometry/multi/algorithms/within.hpp | 5 +
branches/release/boost/geometry/multi/multi.hpp | 6 +
branches/release/boost/geometry/policies/relate/de9im.hpp | 8 ---
branches/release/boost/geometry/policies/relate/direction.hpp | 48 ++++++++++++-------
branches/release/boost/geometry/policies/relate/intersection_points.hpp | 31 ++++++-------
branches/release/boost/geometry/policies/relate/tupled.hpp | 9 ---
branches/release/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp | 73 +++++-------------------------
branches/release/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp | 3
branches/release/boost/geometry/strategies/cartesian/area_surveyor.hpp | 11 +++-
branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp | 17 +++++--
branches/release/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp | 5 +
branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp | 22 +++++---
branches/release/boost/geometry/strategies/cartesian/side_by_triangle.hpp | 11 +++-
branches/release/boost/geometry/strategies/strategy_transform.hpp | 2
branches/release/boost/geometry/strategies/transform/matrix_transformers.hpp | 4
branches/release/boost/geometry/util/for_each_coordinate.hpp | 2
43 files changed, 347 insertions(+), 316 deletions(-)
Modified: branches/release/boost/geometry/algorithms/append.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/append.hpp (original)
+++ branches/release/boost/geometry/algorithms/append.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -38,7 +38,7 @@
template <typename Geometry, typename Point>
struct append_no_action
{
- static inline void apply(Geometry& geometry, Point const& point,
+ static inline void apply(Geometry& , Point const& ,
int = 0, int = 0)
{
}
Modified: branches/release/boost/geometry/algorithms/buffer.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/buffer.hpp (original)
+++ branches/release/boost/geometry/algorithms/buffer.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -83,7 +83,7 @@
struct buffer<box_tag, box_tag, BoxIn, T, BoxOut>
{
static inline void apply(BoxIn const& box_in, T const& distance,
- T const& chord_length, BoxIn& box_out)
+ T const& , BoxIn& box_out)
{
detail::buffer::buffer_box(box_in, distance, box_out);
}
Modified: branches/release/boost/geometry/algorithms/centroid.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/centroid.hpp (original)
+++ branches/release/boost/geometry/algorithms/centroid.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -191,7 +191,7 @@
it != end;
++previous, ++it)
{
- Strategy::apply(*previous, *it, state);
+ strategy.apply(*previous, *it, state);
}
}
};
@@ -211,7 +211,7 @@
Closure,
Strategy
>::apply(range, strategy, state);
- Strategy::result(state, centroid);
+ strategy.result(state, centroid);
}
}
};
@@ -262,7 +262,7 @@
Polygon,
Strategy
>::apply(poly, strategy, state);
- Strategy::result(state, centroid);
+ strategy.result(state, centroid);
}
}
};
Modified: branches/release/boost/geometry/algorithms/correct.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/correct.hpp (original)
+++ branches/release/boost/geometry/algorithms/correct.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -80,7 +80,7 @@
template <typename Box, std::size_t DimensionCount>
struct correct_box_loop<Box, DimensionCount, DimensionCount>
{
- static inline void apply(Box& box)
+ static inline void apply(Box& )
{}
};
@@ -147,7 +147,8 @@
}
// Check area
Predicate predicate;
- coordinate_type const zero = 0;
+ typedef typename default_area_result<Ring>::type area_result_type;
+ area_result_type const zero = area_result_type();
if (predicate(ring_area_type::apply(r, strategy_type()), zero))
{
std::reverse(boost::begin(r), boost::end(r));
@@ -161,14 +162,14 @@
struct correct_polygon
{
typedef typename ring_type<Polygon>::type ring_type;
- typedef typename coordinate_type<Polygon>::type coordinate_type;
+ typedef typename default_area_result<Polygon>::type area_result_type;
static inline void apply(Polygon& poly)
{
correct_ring
<
ring_type,
- std::less<coordinate_type>
+ std::less<area_result_type>
>::apply(exterior_ring(poly));
typename interior_return_type<Polygon>::type rings
@@ -178,7 +179,7 @@
correct_ring
<
ring_type,
- std::greater<coordinate_type>
+ std::greater<area_result_type>
>::apply(*it);
}
}
@@ -193,48 +194,42 @@
namespace dispatch
{
-template <typename Tag, typename Geometry>
-struct correct
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry>)
- );
-};
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
+struct correct: not_implemented<Tag>
+{};
template <typename Point>
-struct correct<point_tag, Point>
+struct correct<Point, point_tag>
: detail::correct::correct_nop<Point>
{};
template <typename LineString>
-struct correct<linestring_tag, LineString>
+struct correct<LineString, linestring_tag>
: detail::correct::correct_nop<LineString>
{};
template <typename Segment>
-struct correct<segment_tag, Segment>
+struct correct<Segment, segment_tag>
: detail::correct::correct_nop<Segment>
{};
template <typename Box>
-struct correct<box_tag, Box>
+struct correct<Box, box_tag>
: detail::correct::correct_box<Box>
{};
template <typename Ring>
-struct correct<ring_tag, Ring>
+struct correct<Ring, ring_tag>
: detail::correct::correct_ring
<
Ring,
- std::less<typename coordinate_type<Ring>::type>
+ std::less<typename default_area_result<Ring>::type>
>
{};
template <typename Polygon>
-struct correct<polygon_tag, Polygon>
+struct correct<Polygon, polygon_tag>
: detail::correct::correct_polygon<Polygon>
{};
@@ -260,7 +255,7 @@
{
concept::check<Geometry const>();
- dispatch::correct<typename tag<Geometry>::type, Geometry>::apply(geometry);
+ dispatch::correct<Geometry>::apply(geometry);
}
Modified: branches/release/boost/geometry/algorithms/covered_by.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/covered_by.hpp (original)
+++ branches/release/boost/geometry/algorithms/covered_by.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -17,10 +17,9 @@
#include <cstddef>
-
+#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/algorithms/within.hpp>
-
#include <boost/geometry/strategies/cartesian/point_in_box.hpp>
#include <boost/geometry/strategies/cartesian/box_in_box.hpp>
@@ -33,34 +32,29 @@
template
<
- typename Tag1,
- typename Tag2,
typename Geometry1,
typename Geometry2,
- typename Strategy
+ typename Tag1 = typename tag<Geometry1>::type,
+ typename Tag2 = typename tag<Geometry2>::type
>
-struct covered_by
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry1, Geometry2>)
- );
-};
+struct covered_by: not_implemented<Tag1, Tag2>
+{};
-template <typename Point, typename Box, typename Strategy>
-struct covered_by<point_tag, box_tag, Point, Box, Strategy>
+template <typename Point, typename Box>
+struct covered_by<Point, Box, point_tag, box_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point, Box const& box, Strategy const& strategy)
{
return strategy.apply(point, box);
}
};
-template <typename Box1, typename Box2, typename Strategy>
-struct covered_by<box_tag, box_tag, Box1, Box2, Strategy>
+template <typename Box1, typename Box2>
+struct covered_by<Box1, Box2, box_tag, box_tag>
{
+ template <typename Strategy>
static inline bool apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
{
assert_dimension_equal<Box1, Box2>();
@@ -70,10 +64,11 @@
-template <typename Point, typename Ring, typename Strategy>
-struct covered_by<point_tag, ring_tag, Point, Ring, Strategy>
+template <typename Point, typename Ring>
+struct covered_by<Point, Ring, point_tag, ring_tag>
{
- static inline bool apply(Point const& point, Ring const& ring, Strategy const& strategy)
+ template <typename Strategy>
+ static inline bool apply(Point const& point, Ring const& ring, Strategy const& )
{
return detail::within::point_in_ring
<
@@ -86,9 +81,10 @@
}
};
-template <typename Point, typename Polygon, typename Strategy>
-struct covered_by<point_tag, polygon_tag, Point, Polygon, Strategy>
+template <typename Point, typename Polygon>
+struct covered_by<Point, Polygon, point_tag, polygon_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point, Polygon const& polygon, Strategy const& strategy)
{
return detail::within::point_in_polygon
@@ -151,11 +147,8 @@
return dispatch::covered_by
<
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
Geometry1,
- Geometry2,
- strategy_type
+ Geometry2
>::apply(geometry1, geometry2, strategy_type());
}
@@ -193,11 +186,8 @@
return dispatch::covered_by
<
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
Geometry1,
- Geometry2,
- Strategy
+ Geometry2
>::apply(geometry1, geometry2, strategy);
}
Modified: branches/release/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -30,6 +30,9 @@
*/
struct calculate_distance_policy
{
+ static bool const include_no_turn = false;
+ static bool const include_degenerate = false;
+
template <typename Point1, typename Point2, typename Info>
static inline void apply(Info& info, Point1 const& p1, Point2 const& p2)
{
Modified: branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -294,9 +294,9 @@
>
inline void enrich_assign(Container& operations,
TurnPoints& turn_points,
- operation_type for_operation,
- Geometry1 const& geometry1, Geometry2 const& geometry2,
- Strategy const& strategy)
+ operation_type ,
+ Geometry1 const& , Geometry2 const& ,
+ Strategy const& )
{
typedef typename IndexType::type operations_type;
typedef typename boost::range_iterator<Container const>::type iterator_type;
Modified: branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -33,7 +33,7 @@
{
template <typename Turn, typename Operation>
-static inline bool is_entering(Turn const& turn, Operation const& op)
+static inline bool is_entering(Turn const& /* TODO remove this parameter */, Operation const& op)
{
// (Blocked means: blocked for polygon/polygon intersection, because
// they are reversed. But for polygon/line it is similar to continue)
@@ -126,10 +126,10 @@
typename Operation
>
static inline void enter(LineStringOut& current_piece,
- LineString const& linestring,
+ LineString const& ,
segment_identifier& segment_id,
- int index, Point const& point,
- Operation const& operation, OutputIterator& out)
+ int , Point const& point,
+ Operation const& operation, OutputIterator& )
{
// On enter, append the intersection point and remember starting point
detail::overlay::append_no_duplicates(current_piece, point);
@@ -148,7 +148,7 @@
LineString const& linestring,
segment_identifier& segment_id,
int index, Point const& point,
- Operation const& operation, OutputIterator& out)
+ Operation const& , OutputIterator& out)
{
// On leave, copy all segments from starting point, append the intersection point
// and add the output piece
@@ -273,7 +273,7 @@
template<typename Turns, typename OutputIterator>
static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon,
- detail::overlay::operation_type operation,
+ detail::overlay::operation_type , // TODO: this parameter might be redundant
Turns& turns, OutputIterator out)
{
typedef typename boost::range_iterator<Turns>::type turn_iterator;
Modified: branches/release/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -51,7 +51,7 @@
static inline OutputIterator apply(
Point1 const& pi, Point1 const& pj, Point1 const& pk,
Point2 const& qi, Point2 const& qj, Point2 const& qk,
- TurnInfo const& tp_model,
+ TurnInfo const& ,
OutputIterator out)
{
typedef model::referring_segment<Point1 const> segment_type1;
Modified: branches/release/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -23,6 +23,28 @@
namespace boost { namespace geometry
{
+#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
+class turn_info_exception : public geometry::exception
+{
+ std::string message;
+public:
+
+ // NOTE: "char" will be replaced by enum in future version
+ inline turn_info_exception(char const method)
+ {
+ message = "Boost.Geometry Turn exception: ";
+ message += method;
+ }
+
+ virtual ~turn_info_exception() throw()
+ {}
+
+ virtual char const* what() const throw()
+ {
+ return message.c_str();
+ }
+};
+#endif
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
@@ -89,7 +111,7 @@
typename DirInfo
>
static inline void apply(
- Point1 const& pi, Point1 const& pj, Point1 const& pk,
+ Point1 const& pi, Point1 const& pj, Point1 const& ,
Point2 const& qi, Point2 const& qj, Point2 const& qk,
TurnInfo& ti,
IntersectionInfo const& intersection_info,
@@ -399,10 +421,10 @@
>
static inline void apply(
Point1 const& pi, Point1 const& pj, Point1 const& pk,
- Point2 const& qi, Point2 const& qj, Point2 const& qk,
+ Point2 const& , Point2 const& qj, Point2 const& qk,
TurnInfo& ti,
IntersectionInfo const& intersection_info,
- DirInfo const& dir_info)
+ DirInfo const& )
{
ti.method = method_equal;
// Copy the SECOND intersection point
@@ -656,8 +678,8 @@
typename DirInfo
>
static inline void apply(
- Point1 const& pi, Point1 const& pj, Point1 const& pk,
- Point2 const& qi, Point2 const& qj, Point2 const& qk,
+ Point1 const& , Point1 const& , Point1 const& ,
+ Point2 const& , Point2 const& , Point2 const& ,
TurnInfo& ti,
IntersectionInfo const& intersection_info,
DirInfo const& dir_info)
@@ -677,6 +699,18 @@
}
};
+template<typename TurnInfo>
+struct only_convert
+{
+ template<typename IntersectionInfo>
+ static inline void apply(TurnInfo& ti, IntersectionInfo const& intersection_info)
+ {
+ ti.method = method_collinear;
+ geometry::convert(intersection_info.intersections[0], ti.point);
+ ti.operations[0].operation = operation_continue;
+ ti.operations[1].operation = operation_continue;
+ }
+};
/*!
\brief Policy doing nothing
@@ -686,8 +720,11 @@
*/
struct assign_null_policy
{
+ static bool const include_no_turn = false;
+ static bool const include_degenerate = false;
+
template <typename Point1, typename Point2, typename Info>
- static inline void apply(Info& info, Point1 const& p1, Point2 const& p2)
+ static inline void apply(Info& , Point1 const& , Point2 const& )
{}
};
@@ -703,14 +740,16 @@
\tparam TurnInfo type of class getting intersection and turn info
\tparam AssignPolicy policy to assign extra info,
e.g. to calculate distance from segment's first points
- to intersection points
+ to intersection points.
+ It also defines if a certain class of points
+ (degenerate, non-turns) should be included.
*/
template
<
typename Point1,
typename Point2,
typename TurnInfo,
- typename AssignPolicy = assign_null_policy
+ typename AssignPolicy
>
struct get_turn_info
{
@@ -749,10 +788,20 @@
// Select method and apply
switch(method)
{
- case 'a' :
- case 'f' :
- case 's' :
- case 'd' :
+ case 'a' : // collinear, "at"
+ case 'f' : // collinear, "from"
+ case 's' : // starts from the middle
+ if (AssignPolicy::include_no_turn
+ && result.template get<0>().count > 0)
+ {
+ only_convert<TurnInfo>::apply(tp,
+ result.template get<0>());
+ AssignPolicy::apply(tp, pi, qi);
+ *out++ = tp;
+ }
+ break;
+
+ case 'd' : // disjoint: never do anything
break;
case 'm' :
@@ -873,13 +922,23 @@
}
break;
case '0' :
- // degenerate points
- break;
+ {
+ // degenerate points
+ if (AssignPolicy::include_degenerate)
+ {
+ only_convert<TurnInfo>::apply(tp, result.template get<0>());
+ AssignPolicy::apply(tp, pi, qi);
+ *out++ = tp;
+ }
+ }
+ break;
default :
-#ifdef BOOST_GEOMETRY_DEBUG_GET_TURNS
- std::cout << "get_turns, nyi: " << method << std::endl;
+ {
+#if ! defined(BOOST_GEOMETRY_OVERLAY_NO_THROW)
+ throw turn_info_exception(method);
#endif
- break;
+ }
+ break;
}
return out;
Modified: branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -93,6 +93,7 @@
}
+#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
inline void debug_consider(int order, Indexed const& left,
Indexed const& right, std::string const& header,
bool skip = true,
@@ -101,8 +102,6 @@
{
if (skip) return;
-
-#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
point_type pi, pj, ri, rj, si, sj;
geometry::copy_segment_points<Reverse1, Reverse2>(m_geometry1, m_geometry2,
left.subject.seg_id,
@@ -151,14 +150,21 @@
std::cout << " " << extra << " " << (ret ? "true" : "false");
}
std::cout << std::endl;
-#endif
}
+#else
+ inline void debug_consider(int, Indexed const& ,
+ Indexed const& , std::string const& ,
+ bool = true,
+ std::string const& = "", bool = false
+ ) const
+ {}
+#endif
// ux/ux
inline bool consider_ux_ux(Indexed const& left,
Indexed const& right
- , std::string const& header
+ , std::string const& // header
) const
{
bool ret = left.index < right.index;
@@ -190,7 +196,7 @@
inline bool consider_iu_ux(Indexed const& left,
Indexed const& right,
int order // 1: iu first, -1: ux first
- , std::string const& header
+ , std::string const& // header
) const
{
bool ret = false;
@@ -234,7 +240,7 @@
inline bool consider_iu_ix(Indexed const& left,
Indexed const& right,
int order // 1: iu first, -1: ix first
- , std::string const& header
+ , std::string const& // header
) const
{
//debug_consider(order, left, right, header, false, "iu/ix");
@@ -507,9 +513,9 @@
>
inline void inspect_cluster(Iterator begin_cluster, Iterator end_cluster,
TurnPoints& turn_points,
- operation_type for_operation,
- Geometry1 const& geometry1, Geometry2 const& geometry2,
- Strategy const& strategy)
+ operation_type ,
+ Geometry1 const& , Geometry2 const& ,
+ Strategy const& )
{
int count = 0;
Modified: branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -50,7 +50,7 @@
{
static inline OutputIterator apply(Segment1 const& segment1,
Segment2 const& segment2, OutputIterator out,
- Strategy const& strategy)
+ Strategy const& )
{
typedef typename point_type<PointOut>::type point_type;
@@ -86,7 +86,7 @@
{
static inline OutputIterator apply(Linestring1 const& linestring1,
Linestring2 const& linestring2, OutputIterator out,
- Strategy const& strategy)
+ Strategy const& )
{
typedef typename point_type<PointOut>::type point_type;
@@ -146,7 +146,7 @@
static inline OutputIterator apply(LineString const& linestring, Areal const& areal,
OutputIterator out,
- Strategy const& strategy)
+ Strategy const& )
{
if (boost::size(linestring) == 0)
{
@@ -351,7 +351,7 @@
>
{
static inline OutputIterator apply(Linestring const& linestring,
- Box const& box, OutputIterator out, Strategy const& strategy)
+ Box const& box, OutputIterator out, Strategy const& )
{
typedef typename point_type<GeometryOut>::type point_type;
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
@@ -436,7 +436,7 @@
>
{
static inline OutputIterator apply(Segment const& segment,
- Box const& box, OutputIterator out, Strategy const& strategy)
+ Box const& box, OutputIterator out, Strategy const& )
{
geometry::segment_view<Segment> range(segment);
@@ -469,7 +469,7 @@
>
{
static inline OutputIterator apply(Geometry1 const& geometry1,
- Geometry2 const& geometry2, OutputIterator out, Strategy const& strategy)
+ Geometry2 const& geometry2, OutputIterator out, Strategy const& )
{
typedef detail::overlay::turn_info<PointOut> turn_info;
Modified: branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -145,11 +145,21 @@
OutputIterator out,
Strategy const& )
{
- if (geometry::num_points(geometry1) == 0 && geometry::num_points(geometry2) == 0)
+ if (geometry::num_points(geometry1) == 0
+ && geometry::num_points(geometry2) == 0)
{
return out;
}
+ if (geometry::num_points(geometry1) == 0
+ || geometry::num_points(geometry2) == 0)
+ {
+ return return_if_one_input_is_empty
+ <
+ GeometryOut, Direction, ReverseOut
+ >(geometry1, geometry2, out);
+ }
+
typedef typename geometry::point_type<GeometryOut>::type point_type;
typedef detail::overlay::traversal_turn_info<point_type> turn_info;
typedef std::deque<turn_info> container_type;
@@ -159,15 +169,6 @@
typename geometry::ring_type<GeometryOut>::type
> ring_container_type;
- if (geometry::num_points(geometry1) == 0
- || geometry::num_points(geometry2) == 0)
- {
- return return_if_one_input_is_empty
- <
- GeometryOut, Direction, ReverseOut
- >(geometry1, geometry2, out);
- }
-
container_type turn_points;
#ifdef BOOST_GEOMETRY_TIME_OVERLAY
Modified: branches/release/boost/geometry/algorithms/detail/overlay/select_rings.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/select_rings.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/select_rings.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -40,7 +40,7 @@
struct select_rings<box_tag, Box>
{
template <typename Geometry, typename Map>
- static inline void apply(Box const& box, Geometry const& geometry,
+ static inline void apply(Box const& box, Geometry const& ,
ring_identifier const& id, Map& map, bool midpoint)
{
map[id] = typename Map::mapped_type(box, midpoint);
@@ -58,7 +58,7 @@
struct select_rings<ring_tag, Ring>
{
template <typename Geometry, typename Map>
- static inline void apply(Ring const& ring, Geometry const& geometry,
+ static inline void apply(Ring const& ring, Geometry const& ,
ring_identifier const& id, Map& map, bool midpoint)
{
if (boost::size(ring) > 0)
@@ -129,7 +129,7 @@
struct decide<overlay_union>
{
template <typename Code>
- static bool include(ring_identifier const& id, Code const& code)
+ static bool include(ring_identifier const& , Code const& code)
{
return code.within_code * -1 == 1;
}
@@ -162,7 +162,7 @@
struct decide<overlay_intersection>
{
template <typename Code>
- static bool include(ring_identifier const& id, Code const& code)
+ static bool include(ring_identifier const& , Code const& code)
{
return code.within_code * 1 == 1;
}
Modified: branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -37,10 +37,10 @@
{
template <typename Turn, typename Operation>
+#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE
inline void debug_traverse(Turn const& turn, Operation op,
std::string const& header)
{
-#ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE
std::cout << header
<< " at " << op.seg_id
<< " meth: " << method_char(turn.method)
@@ -55,8 +55,12 @@
{
std::cout << std::endl;
}
-#endif
}
+#else
+inline void debug_traverse(Turn const& , Operation, std::string const& )
+{
+}
+#endif
template <typename Info, typename Turn>
Modified: branches/release/boost/geometry/algorithms/detail/sections/range_by_section.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/sections/range_by_section.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/sections/range_by_section.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -36,7 +36,7 @@
template <typename Range, typename Section>
struct full_section_range
{
- static inline Range const& apply(Range const& range, Section const& section)
+ static inline Range const& apply(Range const& range, Section const& )
{
return range;
}
Modified: branches/release/boost/geometry/algorithms/disjoint.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/disjoint.hpp (original)
+++ branches/release/boost/geometry/algorithms/disjoint.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -44,6 +44,19 @@
namespace detail { namespace disjoint
{
+struct assign_disjoint_policy
+{
+ // We want to include all points:
+ static bool const include_no_turn = true;
+ static bool const include_degenerate = true;
+
+ // We don't assign extra info:
+ template <typename Point1, typename Point2, typename Info>
+ static inline void apply(Info& , Point1 const& , Point2 const& )
+ {}
+};
+
+
template <typename Geometry1, typename Geometry2>
struct disjoint_linear
{
@@ -54,12 +67,14 @@
typedef overlay::turn_info<point_type> turn_info;
std::deque<turn_info> turns;
- // Get (and stop on) any intersection
+ // Specify two policies:
+ // 1) Stop at any intersection
+ // 2) In assignment, include also degenerate points (which are normally skipped)
disjoint_interrupt_policy policy;
geometry::get_turns
<
- false, false,
- overlay::assign_null_policy
+ false, false,
+ assign_disjoint_policy
>(geometry1, geometry2, turns, policy);
if (policy.has_intersections)
{
Modified: branches/release/boost/geometry/algorithms/distance.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/distance.hpp (original)
+++ branches/release/boost/geometry/algorithms/distance.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -64,7 +64,7 @@
struct point_to_segment
{
static inline typename return_type<Strategy>::type apply(Point const& point,
- Segment const& segment, Strategy const& strategy)
+ Segment const& segment, Strategy const& )
{
typename strategy::distance::services::default_strategy
<
Modified: branches/release/boost/geometry/algorithms/for_each.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/for_each.hpp (original)
+++ branches/release/boost/geometry/algorithms/for_each.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -55,8 +55,10 @@
struct fe_point_per_segment
{
static inline Functor apply(
- typename add_const_if_c<IsConst, Point>::type& point, Functor f)
+ typename add_const_if_c<IsConst, Point>::type& , Functor f)
{
+ // TODO: if non-const, we should extract the points from the segment
+ // and call the functor on those two points
return f;
}
};
Modified: branches/release/boost/geometry/algorithms/simplify.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/simplify.hpp (original)
+++ branches/release/boost/geometry/algorithms/simplify.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -67,7 +67,7 @@
{
template <typename Distance>
static inline void apply(Range const& range, Range& out,
- Distance const& max_distance, Strategy const& strategy)
+ Distance const& , Strategy const& )
{
std::copy
(
@@ -179,7 +179,7 @@
{
template <typename Distance>
static inline void apply(Point const& point, Point& out,
- Distance const& max_distance, Strategy const& strategy)
+ Distance const& , Strategy const& )
{
geometry::convert(point, out);
}
Modified: branches/release/boost/geometry/algorithms/within.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/within.hpp (original)
+++ branches/release/boost/geometry/algorithms/within.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -17,11 +17,11 @@
#include <cstddef>
-#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/closure.hpp>
@@ -165,34 +165,29 @@
template
<
- typename Tag1,
- typename Tag2,
typename Geometry1,
typename Geometry2,
- typename Strategy
+ typename Tag1 = typename tag<Geometry1>::type,
+ typename Tag2 = typename tag<Geometry2>::type
>
-struct within
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry1, Geometry2>)
- );
-};
+struct within: not_implemented<Tag1, Tag2>
+{};
-template <typename Point, typename Box, typename Strategy>
-struct within<point_tag, box_tag, Point, Box, Strategy>
+template <typename Point, typename Box>
+struct within<Point, Box, point_tag, box_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point, Box const& box, Strategy const& strategy)
{
return strategy.apply(point, box);
}
};
-template <typename Box1, typename Box2, typename Strategy>
-struct within<box_tag, box_tag, Box1, Box2, Strategy>
+template <typename Box1, typename Box2>
+struct within<Box1, Box2, box_tag, box_tag>
{
+ template <typename Strategy>
static inline bool apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
{
assert_dimension_equal<Box1, Box2>();
@@ -202,9 +197,10 @@
-template <typename Point, typename Ring, typename Strategy>
-struct within<point_tag, ring_tag, Point, Ring, Strategy>
+template <typename Point, typename Ring>
+struct within<Point, Ring, point_tag, ring_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point, Ring const& ring, Strategy const& strategy)
{
return detail::within::point_in_ring
@@ -218,9 +214,10 @@
}
};
-template <typename Point, typename Polygon, typename Strategy>
-struct within<point_tag, polygon_tag, Point, Polygon, Strategy>
+template <typename Point, typename Polygon>
+struct within<Point, Polygon, point_tag, polygon_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point, Polygon const& polygon, Strategy const& strategy)
{
return detail::within::point_in_polygon
@@ -291,11 +288,8 @@
return dispatch::within
<
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
Geometry1,
- Geometry2,
- strategy_type
+ Geometry2
>::apply(geometry1, geometry2, strategy_type());
}
@@ -344,11 +338,8 @@
return dispatch::within
<
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
Geometry1,
- Geometry2,
- Strategy
+ Geometry2
>::apply(geometry1, geometry2, strategy);
}
Modified: branches/release/boost/geometry/io/wkt/iomanip.hpp
==============================================================================
--- branches/release/boost/geometry/io/wkt/iomanip.hpp (original)
+++ branches/release/boost/geometry/io/wkt/iomanip.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -17,23 +17,19 @@
#include <boost/geometry/io/wkt/write.hpp>
// This short file contains only one manipulator, streaming as WKT
-// Don't move contents to as_wkt, developers must be able to choose how to stream
+// Don't include this in any standard-included header file.
// Don't use namespace boost::geometry, to enable the library to stream custom geometries which
-// are living outside the namespace boost { namespace geometry
-
-//namespace boost { namespace geometry
-//{
-
+// are living outside the namespace boost::geometry
/*!
\brief Streams a geometry as Well-Known Text
\ingroup wkt
*/
template<typename Char, typename Traits, typename Geometry>
-inline std::basic_ostream<Char,Traits>& operator<<
+inline std::basic_ostream<Char, Traits>& operator<<
(
- std::basic_ostream<Char,Traits> &os,
+ std::basic_ostream<Char, Traits> &os,
Geometry const& geom
)
{
@@ -41,6 +37,4 @@
return os;
}
-//}} // namespace boost::geometry
-
#endif // BOOST_GEOMETRY_IO_WKT_IOMANIP_HPP
Modified: branches/release/boost/geometry/io/wkt/wkt.hpp
==============================================================================
--- branches/release/boost/geometry/io/wkt/wkt.hpp (original)
+++ branches/release/boost/geometry/io/wkt/wkt.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -16,6 +16,10 @@
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/wkt/write.hpp>
-#include <boost/geometry/io/wkt/iomanip.hpp>
+
+// BSG 2011-02-03
+// We don't include iomanip by default. That tries to stream anything not known
+// by default (such as ttmath) and reports errors.
+// Users can include iomanip themselves (if they want to)
#endif // BOOST_GEOMETRY_IO_WKT_WKT_HPP
Modified: branches/release/boost/geometry/multi/algorithms/convert.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/convert.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/convert.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -30,7 +30,7 @@
{
template <typename Single, typename Multi, typename Policy>
-struct single_to_multi
+struct single_to_multi: private Policy
{
static inline void apply(Single const& single, Multi& multi)
{
@@ -42,7 +42,7 @@
template <typename Multi1, typename Multi2, typename Policy>
-struct multi_to_multi
+struct multi_to_multi: private Policy
{
static inline void apply(Multi1 const& multi1, Multi2& multi2)
{
Modified: branches/release/boost/geometry/multi/algorithms/correct.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/correct.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/correct.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -32,19 +32,19 @@
{
template <typename MultiPoint>
-struct correct<multi_point_tag, MultiPoint>
+struct correct<MultiPoint, multi_point_tag>
: detail::correct::correct_nop<MultiPoint>
{};
template <typename MultiLineString>
-struct correct<multi_linestring_tag, MultiLineString>
+struct correct<MultiLineString, multi_linestring_tag>
: detail::correct::correct_nop<MultiLineString>
{};
template <typename Geometry>
-struct correct<multi_polygon_tag, Geometry>
+struct correct<Geometry, multi_polygon_tag>
: detail::multi_modify
<
Geometry,
Modified: branches/release/boost/geometry/multi/algorithms/covered_by.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/covered_by.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/covered_by.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -15,6 +15,7 @@
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_COVERED_BY_HPP
+#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/multi/core/closure.hpp>
#include <boost/geometry/multi/core/point_order.hpp>
#include <boost/geometry/multi/core/tags.hpp>
@@ -29,9 +30,10 @@
namespace dispatch
{
-template <typename Point, typename MultiPolygon, typename Strategy>
-struct covered_by<point_tag, multi_polygon_tag, Point, MultiPolygon, Strategy>
+template <typename Point, typename MultiPolygon>
+struct covered_by<Point, MultiPolygon, point_tag, multi_polygon_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point,
MultiPolygon const& multi_polygon, Strategy const& strategy)
{
Modified: branches/release/boost/geometry/multi/algorithms/intersection.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/intersection.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/intersection.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -181,7 +181,7 @@
struct clip_multi_linestring
{
static inline OutputIterator apply(MultiLinestring const& multi_linestring,
- Box const& box, OutputIterator out, Strategy const& strategy)
+ Box const& box, OutputIterator out, Strategy const& )
{
typedef typename point_type<LinestringOut>::type point_type;
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
Modified: branches/release/boost/geometry/multi/algorithms/within.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/within.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/within.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -69,9 +69,10 @@
namespace dispatch
{
-template <typename Point, typename MultiPolygon, typename Strategy>
-struct within<point_tag, multi_polygon_tag, Point, MultiPolygon, Strategy>
+template <typename Point, typename MultiPolygon>
+struct within<Point, MultiPolygon, point_tag, multi_polygon_tag>
{
+ template <typename Strategy>
static inline bool apply(Point const& point,
MultiPolygon const& multi_polygon, Strategy const& strategy)
{
Modified: branches/release/boost/geometry/multi/multi.hpp
==============================================================================
--- branches/release/boost/geometry/multi/multi.hpp (original)
+++ branches/release/boost/geometry/multi/multi.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -17,20 +17,21 @@
#include <boost/geometry/multi/core/closure.hpp>
#include <boost/geometry/multi/core/geometry_id.hpp>
-#include <boost/geometry/multi/core/is_areal.hpp>
#include <boost/geometry/multi/core/interior_rings.hpp>
+#include <boost/geometry/multi/core/is_areal.hpp>
#include <boost/geometry/multi/core/point_order.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/multi/core/ring_type.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/topological_dimension.hpp>
-
+#include <boost/geometry/multi/algorithms/append.hpp>
#include <boost/geometry/multi/algorithms/area.hpp>
#include <boost/geometry/multi/algorithms/centroid.hpp>
#include <boost/geometry/multi/algorithms/clear.hpp>
#include <boost/geometry/multi/algorithms/convert.hpp>
#include <boost/geometry/multi/algorithms/correct.hpp>
+#include <boost/geometry/multi/algorithms/covered_by.hpp>
#include <boost/geometry/multi/algorithms/distance.hpp>
#include <boost/geometry/multi/algorithms/envelope.hpp>
#include <boost/geometry/multi/algorithms/equals.hpp>
@@ -58,6 +59,7 @@
#include <boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp>
+#include <boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/multi/geometries/concepts/check.hpp>
Modified: branches/release/boost/geometry/policies/relate/de9im.hpp
==============================================================================
--- branches/release/boost/geometry/policies/relate/de9im.hpp (original)
+++ branches/release/boost/geometry/policies/relate/de9im.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -167,14 +167,6 @@
true);
}
-
- static inline return_type parallel()
- {
- return de9im_segment(0,0,
- -1, -1, 1,
- -1, -1, 0,
- 1, 0, 2, false, false, true);
- }
};
Modified: branches/release/boost/geometry/policies/relate/direction.hpp
==============================================================================
--- branches/release/boost/geometry/policies/relate/direction.hpp (original)
+++ branches/release/boost/geometry/policies/relate/direction.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -15,6 +15,7 @@
#include <boost/concept_check.hpp>
+#include <boost/geometry/arithmetic/determinant.hpp>
#include <boost/geometry/strategies/side_info.hpp>
#include <boost/geometry/util/math.hpp>
@@ -31,6 +32,8 @@
struct direction_type
{
+ // NOTE: "char" will be replaced by enum in future version
+
inline direction_type(side_info const& s, char h,
int ha, int hb,
int da = 0, int db = 0,
@@ -60,6 +63,8 @@
}
+ // TODO: replace this
+ // NOTE: "char" will be replaced by enum in future version
// "How" is the intersection formed?
char how;
@@ -235,20 +240,31 @@
return return_type('d', false);
}
-
- static inline return_type parallel()
- {
- return return_type('p', false);
- }
-
- static inline return_type error(std::string const& msg)
+ static inline return_type error(std::string const&)
{
- // msg
- return return_type('d', false);
+ // Return "E" to denote error
+ // This will throw an error in get_turn_info
+ // TODO: change to enum or similar
+ return return_type('E', false);
}
private :
+ static inline bool is_left
+ (
+ coordinate_type const& ux,
+ coordinate_type const& uy,
+ coordinate_type const& vx,
+ coordinate_type const& vy
+ )
+ {
+ // This is a "side calculation" as in the strategies, but here terms are precalculated
+ // We might merge this with side, offering a pre-calculated term (in fact already done using cross-product)
+ // Waiting for implementing spherical...
+
+ rtype const zero = rtype();
+ return geometry::detail::determinant<rtype>(ux, uy, vx, vy) > zero;
+ }
template <std::size_t I>
static inline return_type calculate_side(side_info const& sides,
@@ -259,11 +275,7 @@
coordinate_type dpx = get<I, 0>(s2) - get<0, 0>(s1);
coordinate_type dpy = get<I, 1>(s2) - get<0, 1>(s1);
- // This is a "side calculation" as in the strategies, but here two terms are precalculated
- // We might merge this with side, offering a pre-calculated term
- // Waiting for implementing spherical...
-
- return dx1 * dpy - dy1 * dpx > 0
+ return is_left(dx1, dy1, dpx, dpy)
? return_type(sides, how, how_a, how_b, -1, 1)
: return_type(sides, how, how_a, how_b, 1, -1);
}
@@ -277,7 +289,7 @@
coordinate_type dpx = get<I, 0>(s2) - get<0, 0>(s1);
coordinate_type dpy = get<I, 1>(s2) - get<0, 1>(s1);
- return dx1 * dpy - dy1 * dpx > 0
+ return is_left(dx1, dy1, dpx, dpy)
? return_type(sides, how, how_a, how_b, 1, 1)
: return_type(sides, how, how_a, how_b, -1, -1);
}
@@ -293,7 +305,7 @@
coordinate_type dpx = get<1, 0>(s2) - get<0, 0>(s1);
coordinate_type dpy = get<1, 1>(s2) - get<0, 1>(s1);
- int dir = dx1 * dpy - dy1 * dpx > 0 ? 1 : -1;
+ int dir = is_left(dx1, dy1, dpx, dpy) ? 1 : -1;
// From other perspective, then reverse
bool const is_a = which == 'A';
@@ -321,7 +333,7 @@
// Ending at the middle, one ARRIVES, the other one is NEUTRAL
// (because it both "arrives" and "departs" there
- return dx * dpy - dy * dpx > 0
+ return is_left(dx, dy, dpx, dpy)
? return_type(sides, 'm', 1, 0, 1, 1)
: return_type(sides, 'm', 1, 0, -1, -1);
}
@@ -334,7 +346,7 @@
coordinate_type dpx = get<1, 0>(s1) - get<0, 0>(s2);
coordinate_type dpy = get<1, 1>(s1) - get<0, 1>(s2);
- return dx * dpy - dy * dpx > 0
+ return is_left(dx, dy, dpx, dpy)
? return_type(sides, 'm', 0, 1, 1, 1)
: return_type(sides, 'm', 0, 1, -1, -1);
}
Modified: branches/release/boost/geometry/policies/relate/intersection_points.hpp
==============================================================================
--- branches/release/boost/geometry/policies/relate/intersection_points.hpp (original)
+++ branches/release/boost/geometry/policies/relate/intersection_points.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -16,6 +16,7 @@
#include <boost/concept_check.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <boost/geometry/arithmetic/determinant.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/strategies/side_info.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
@@ -40,9 +41,6 @@
S1, S2, CalculationType
>::type coordinate_type;
- // Get the same type, but at least a double
- typedef typename select_most_precise<coordinate_type, double>::type rtype;
-
static inline return_type segments_intersect(side_info const&,
coordinate_type const& dx1, coordinate_type const& dy1,
coordinate_type const& dx2, coordinate_type const& dy2,
@@ -54,7 +52,7 @@
typename return_type::point_type
>::type coordinate_type;
- // Get the same type, but at least a double (also used for divisions
+ // Get the same type, but at least a double (also used for divisions)
typedef typename select_most_precise
<
coordinate_type, double
@@ -66,19 +64,21 @@
// Calculate other determinants - Cramers rule
promoted_type const wx = get<0, 0>(s1) - get<0, 0>(s2);
promoted_type const wy = get<0, 1>(s1) - get<0, 1>(s2);
- promoted_type const d = (dy2 * dx1) - (dx2 * dy1);
- promoted_type const da = (promoted_type(dx2) * wy) - (promoted_type(dy2) * wx);
+ promoted_type const d = detail::determinant<promoted_type>(dx1, dy1, dx2, dy2);
+ promoted_type const da = detail::determinant<promoted_type>(dx2, dy2, wx, wy);
// r: ratio 0-1 where intersection divides A/B
promoted_type r = da / d;
+ promoted_type const zero = promoted_type();
+ promoted_type const one = 1;
// Handle robustness issues
- if (r < 0)
+ if (r < zero)
{
- r = 0;
+ r = zero;
}
- else if (r > 1)
+ else if (r > one)
{
- r = 1;
+ r = one;
}
result.count = 1;
@@ -120,7 +120,7 @@
return collinear_inside(s, index1, 1 - index1);
}
- static inline return_type collinear_a_in_b(S1 const& s, bool opposite)
+ static inline return_type collinear_a_in_b(S1 const& s, bool)
{
return collinear_inside(s);
}
@@ -144,7 +144,7 @@
return result;
}
- static inline return_type segment_equal(S1 const& s, bool opposite)
+ static inline return_type segment_equal(S1 const& s, bool)
{
return_type result;
result.count = 2;
@@ -160,7 +160,7 @@
{
return return_type();
}
- static inline return_type error(std::string const& msg)
+ static inline return_type error(std::string const&)
{
return return_type();
}
@@ -169,10 +169,7 @@
{
return return_type();
}
- static inline return_type parallel()
- {
- return return_type();
- }
+
static inline return_type degenerate(S1 const& s, bool)
{
return_type result;
Deleted: branches/release/boost/geometry/policies/relate/intersection_points_determinant.hpp
==============================================================================
--- branches/release/boost/geometry/policies/relate/intersection_points_determinant.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
+++ (empty file)
@@ -1,176 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POINTS_HPP
-#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POINTS_HPP
-
-
-#include <string>
-
-#include <boost/concept_check.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <boost/geometry/core/access.hpp>
-#include <boost/geometry/strategies/side_info.hpp>
-#include <boost/geometry/util/select_calculation_type.hpp>
-#include <boost/geometry/util/select_most_precise.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-namespace policies { namespace relate
-{
-
-
-template <typename S1, typename S2, typename ReturnType, typename CalculationType = void>
-struct segments_intersection_points
-{
- typedef ReturnType return_type;
- typedef S1 segment_type1;
- typedef S2 segment_type2;
- typedef typename select_calculation_type
- <
- S1, S2, CalculationType
- >::type coordinate_type;
-
- // Get the same type, but at least a double
- typedef typename select_most_precise<coordinate_type, double>::type rtype;
-
- static inline return_type segments_intersect(side_info const&,
- coordinate_type const& dx1, coordinate_type const& dy1,
- coordinate_type const& dx2, coordinate_type const& dy2,
- S1 const& s1, S2 const& s2)
- {
- return_type result;
- typedef typename geometry::coordinate_type
- <
- typename return_type::point_type
- >::type coordinate_type;
-
- // Get the same type, but at least a double (also used for divisions
- typedef typename select_most_precise
- <
- coordinate_type, double
- >::type promoted_type;
-
- coordinate_type const s1x = get<0, 0>(s1);
- coordinate_type const s1y = get<0, 1>(s1);
-
- // Calculate other determinants - Cramers rule
- promoted_type const wx = get<0, 0>(s1) - get<0, 0>(s2);
- promoted_type const wy = get<0, 1>(s1) - get<0, 1>(s2);
- promoted_type const d = (dy2 * dx1) - (dx2 * dy1);
- promoted_type const da = (dx2 * wy) - (dy2 * wx);
-
- // r: ratio 0-1 where intersection divides A/B
- promoted_type const r = da / d;
-
- result.count = 1;
- set<0>(result.intersections[0],
- boost::numeric_cast<coordinate_type>(s1x + r * dx1));
- set<1>(result.intersections[0],
- boost::numeric_cast<coordinate_type>(s1y + r * dy1));
-
- return result;
- }
-
- static inline return_type collinear_touch(coordinate_type const& x,
- coordinate_type const& y, bool, char)
- {
- return_type result;
- result.count = 1;
- set<0>(result.intersections[0], x);
- set<1>(result.intersections[0], y);
- return result;
- }
-
- template <typename S>
- static inline return_type collinear_inside(S const& s)
- {
- return_type result;
- result.count = 2;
- set<0>(result.intersections[0], get<0, 0>(s));
- set<1>(result.intersections[0], get<0, 1>(s));
- set<0>(result.intersections[1], get<1, 0>(s));
- set<1>(result.intersections[1], get<1, 1>(s));
- return result;
- }
-
- template <typename S>
- static inline return_type collinear_interior_boundary_intersect(S const& s, bool, bool)
- {
- return collinear_inside(s);
- }
-
- static inline return_type collinear_a_in_b(S1 const& s, bool)
- {
- return collinear_inside(s);
- }
- static inline return_type collinear_b_in_a(S2 const& s, bool)
- {
- return collinear_inside(s);
- }
-
- static inline return_type collinear_overlaps(
- coordinate_type const& x1, coordinate_type const& y1,
- coordinate_type const& x2, coordinate_type const& y2, bool)
- {
- return_type result;
- result.count = 2;
- set<0>(result.intersections[0], x1);
- set<1>(result.intersections[0], y1);
- set<0>(result.intersections[1], x2);
- set<1>(result.intersections[1], y2);
- return result;
- }
-
- static inline return_type segment_equal(S1 const& s, bool)
- {
- return_type result;
- result.count = 2;
- set<0>(result.intersections[0], get<0, 0>(s));
- set<1>(result.intersections[0], get<0, 1>(s));
- set<0>(result.intersections[1], get<1, 0>(s));
- set<1>(result.intersections[1], get<1, 1>(s));
- return result;
- }
-
- static inline return_type disjoint()
- {
- return return_type();
- }
- static inline return_type error(std::string const& msg)
- {
- return return_type();
- }
-
- static inline return_type collinear_disjoint()
- {
- return return_type();
- }
- static inline return_type parallel()
- {
- return return_type();
- }
- static inline return_type degenerate(S1 const& s, bool)
- {
- return_type result;
- result.count = 1;
- set<0>(result.intersections[0], get<0, 0>(s));
- set<1>(result.intersections[0], get<0, 1>(s));
- return result;
- }
-};
-
-
-}} // namespace policies::relate
-
-}} // namespace boost::geometry
-
-#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POINTS_HPP
Deleted: branches/release/boost/geometry/policies/relate/intersection_points_slope.hpp
==============================================================================
--- branches/release/boost/geometry/policies/relate/intersection_points_slope.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
+++ (empty file)
@@ -1,213 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-
-// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
-
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POINTS_HPP
-#define BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POINTS_HPP
-
-
-#include <string>
-
-#include <boost/concept_check.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <boost/geometry/core/access.hpp>
-#include <boost/geometry/strategies/side_info.hpp>
-#include <boost/geometry/util/select_calculation_type.hpp>
-#include <boost/geometry/util/select_most_precise.hpp>
-
-
-namespace boost { namespace geometry
-{
-
-namespace policies { namespace relate
-{
-
-
-template <typename S1, typename S2, typename ReturnType, typename CalculationType = void>
-struct segments_intersection_points
-{
- typedef ReturnType return_type;
- typedef S1 segment_type1;
- typedef S2 segment_type2;
- typedef typename select_calculation_type
- <
- S1, S2, CalculationType
- >::type coordinate_type;
-
- // Get the same type, but at least a double (also used for divisions
- typedef typename select_most_precise
- <
- coordinate_type, double
- >::type promoted_type;
-
- template <int Dimension>
- static inline return_type rico(
- coordinate_type const& dm1, coordinate_type const& dn1,
- coordinate_type const& dm2, coordinate_type const& dn2,
- S1 const& s1, S2 const& s2)
- {
- promoted_type const a1 = dn1 / dm1;
- promoted_type const a2 = dn2 / dm2;
- promoted_type const da = a1 - a2;
-
- if (math::equals(da, 0))
- {
- return rico<1 - Dimension>(dn1, dm1, dn2, dm2, s1, s2);
- }
-
- promoted_type const b1 = get<0, Dimension>(s1) - a1 * get<0, 1 - Dimension>(s1);
- promoted_type const b2 = get<0, Dimension>(s2) - a2 * get<0, 1 - Dimension>(s2);
-
- promoted_type const v = (b2 - b1) / da;
-
- return_type result;
- result.count = 1;
- set<1 - Dimension>(result.intersections[0],
- boost::numeric_cast<coordinate_type>(v));
- set<Dimension>(result.intersections[0],
- boost::numeric_cast<coordinate_type>(a1 * v + b1));
- return result;
- }
-
- static inline return_type cross(S1 const& s1, S2 const& s2)
- {
- // Take one of first segment, and one of second segment
- return_type result;
- result.count = 1;
- set<0>(result.intersections[0], get<0, 0>(s1));
- set<1>(result.intersections[0], get<0, 1>(s2));
- return result;
- }
-
-
- static inline return_type segments_intersect(side_info const& sides,
- coordinate_type const& dx1, coordinate_type const& dy1,
- coordinate_type const& dx2, coordinate_type const& dy2,
- S1 const& s1, S2 const& s2)
- {
- bool vertical1 = math::equals(dx1, 0);
- bool horizontal2 = math::equals(dy2, 0);
- if (vertical1 && horizontal2)
- {
- return cross(s1, s2);
- }
-
- bool vertical2 = math::equals(dx2, 0);
- bool horizontal1 = math::equals(dy1, 0);
- if (horizontal1 && vertical2)
- {
- return cross(s2, s1);
- }
- if (vertical1 || vertical2)
- {
- return rico<0>(dy1, dx1, dy2, dx2, s1, s2);
- }
- else
- {
- // Not crossing, take the most reasonable choice.
- // We want to divide by the largest one.
- //if (
-
- return rico<1>(dx1, dy1, dx2, dy2, s1, s2);
- }
- }
-
- static inline return_type collinear_touch(coordinate_type const& x,
- coordinate_type const& y, bool, char)
- {
- return_type result;
- result.count = 1;
- set<0>(result.intersections[0], x);
- set<1>(result.intersections[0], y);
- return result;
- }
-
- template <typename S>
- static inline return_type collinear_inside(S const& s)
- {
- return_type result;
- result.count = 2;
- set<0>(result.intersections[0], get<0, 0>(s));
- set<1>(result.intersections[0], get<0, 1>(s));
- set<0>(result.intersections[1], get<1, 0>(s));
- set<1>(result.intersections[1], get<1, 1>(s));
- return result;
- }
-
- template <typename S>
- static inline return_type collinear_interior_boundary_intersect(S const& s, bool, bool)
- {
- return collinear_inside(s);
- }
-
- static inline return_type collinear_a_in_b(S1 const& s, bool)
- {
- return collinear_inside(s);
- }
- static inline return_type collinear_b_in_a(S2 const& s, bool)
- {
- return collinear_inside(s);
- }
-
- static inline return_type collinear_overlaps(
- coordinate_type const& x1, coordinate_type const& y1,
- coordinate_type const& x2, coordinate_type const& y2, bool)
- {
- return_type result;
- result.count = 2;
- set<0>(result.intersections[0], x1);
- set<1>(result.intersections[0], y1);
- set<0>(result.intersections[1], x2);
- set<1>(result.intersections[1], y2);
- return result;
- }
-
- static inline return_type segment_equal(S1 const& s, bool)
- {
- return_type result;
- result.count = 2;
- set<0>(result.intersections[0], get<0, 0>(s));
- set<1>(result.intersections[0], get<0, 1>(s));
- set<0>(result.intersections[1], get<1, 0>(s));
- set<1>(result.intersections[1], get<1, 1>(s));
- return result;
- }
-
- static inline return_type disjoint()
- {
- return return_type();
- }
- static inline return_type error(std::string const& msg)
- {
- return return_type();
- }
-
- static inline return_type collinear_disjoint()
- {
- return return_type();
- }
- static inline return_type parallel()
- {
- return return_type();
- }
- static inline return_type degenerate(S1 const& s, bool)
- {
- return_type result;
- result.count = 1;
- set<0>(result.intersections[0], get<0, 0>(s));
- set<1>(result.intersections[0], get<0, 1>(s));
- return result;
- }
-};
-
-
-}} // namespace policies::relate
-
-}} // namespace boost::geometry
-
-#endif // BOOST_GEOMETRY_GEOMETRY_POLICIES_RELATE_INTERSECTION_POINTS_HPP
Modified: branches/release/boost/geometry/policies/relate/tupled.hpp
==============================================================================
--- branches/release/boost/geometry/policies/relate/tupled.hpp (original)
+++ branches/release/boost/geometry/policies/relate/tupled.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -164,15 +164,6 @@
);
}
-
- static inline return_type parallel()
- {
- return boost::make_tuple
- (
- Policy1::parallel(),
- Policy2::parallel()
- );
- }
};
}} // namespace policies::relate
Modified: branches/release/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp (original)
+++ branches/release/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -31,13 +31,6 @@
#include <boost/geometry/views/reversible_view.hpp>
-// Temporary, comparing sorting, this can be removed in the end
-//#define BOOST_GEOMETRY_USE_FLEX_SORT
-//#define BOOST_GEOMETRY_USE_FLEX_SORT2
-#if defined(BOOST_GEOMETRY_USE_FLEX_SORT)
-# include <boost/algorithm/sorting/flex_sort.hpp>
-#endif
-
namespace boost { namespace geometry
{
@@ -103,7 +96,7 @@
}
// Then compare with earlier
- if (first && boost::size(range) > 0)
+ if (first)
{
// First time, assign left/right
left = *left_it;
@@ -178,62 +171,15 @@
}
};
-
template <typename Range>
static inline void sort(Range& range)
{
typedef typename boost::range_value<Range>::type point_type;
typedef geometry::less<point_type> comparator;
-#if defined(GGL_USE_FLEX_SORT)
-
- #if defined(GGL_USE_FLEX_SORT1)
- typedef boost::detail::default_predicate
- <
- boost::sort_filter_cutoff
- <
- 18,
- boost::detail::insert_sort_core,
- boost::sort_filter_ground
- <
- 30,
- boost::detail::heap_sort_core,
- boost::detail::quick_sort_core
- <
- boost::pivot_median_of_three,
- boost::default_partitionner
- >
- >
- >,
- comparator> my_sort;
- my_sort sort;
- #elif defined(GGL_USE_FLEX_SORT2)
-
- // 1, 5, 9, 18, 25: 0.75
- // 50: 0.81
-
- typedef boost::detail::default_predicate<boost::sort_filter_cutoff
- <
- 35,
- boost::detail::insert_sort_core,
- boost::detail::quick_sort_core<boost::pivot_middle, boost::default_partitionner>
- >, comparator
- > barend_sort;
-
- barend_sort sort;
- #else
- #error Define sub-flex-sort
- #endif
-
- sort(boost::begin(range), boost::end(range));
-
-#else
- std::sort
- (boost::begin(range), boost::end(range), comparator());
-#endif
+ std::sort(boost::begin(range), boost::end(range), comparator());
}
-
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
@@ -279,8 +225,15 @@
{
// First pass.
// Get min/max (in most cases left / right) points
- // This makes use of the geometry::less/greater predicates with the optional
- // direction template parameter to indicate x direction
+ // This makes use of the geometry::less/greater predicates
+
+ // For the left boundary it is important that multiple points
+ // are sorted from bottom to top. Therefore the less predicate
+ // does not take the x-only template parameter (this fixes ticket #6019.
+ // For the right boundary it is not necessary (though also not harmful),
+ // because points are sorted from bottom to top in a later stage.
+ // For symmetry and to get often more balanced lower/upper halves
+ // we keep it.
typedef typename geometry::detail::range_type<InputGeometry>::type range_type;
@@ -293,8 +246,8 @@
<
range_type,
range_iterator,
- geometry::less<point_type, 0>,
- geometry::greater<point_type, 0>
+ geometry::less<point_type>,
+ geometry::greater<point_type>
> extremes;
geometry::detail::for_each_range(geometry, extremes);
Modified: branches/release/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp (original)
+++ branches/release/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -60,8 +60,7 @@
{}
// Necessary for proper compilation
- inline douglas_peucker_point<Point> operator=(
- douglas_peucker_point<Point> const& other)
+ inline douglas_peucker_point<Point> operator=(douglas_peucker_point<Point> const& )
{
return douglas_peucker_point<Point>(*this);
}
Modified: branches/release/boost/geometry/strategies/cartesian/area_surveyor.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/area_surveyor.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/area_surveyor.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -16,9 +16,11 @@
#include <boost/mpl/if.hpp>
-#include <boost/type_traits.hpp>
-#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/arithmetic/determinant.hpp>
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/util/select_most_precise.hpp>
namespace boost { namespace geometry
@@ -82,7 +84,8 @@
inline return_type area() const
{
return_type result = sum;
- result /= 2;
+ return_type const two = 2;
+ result /= two;
return result;
}
};
@@ -96,7 +99,7 @@
summation& state)
{
// SUM += x2 * y1 - x1 * y2;
- state.sum += get<0>(p2) * get<1>(p1) - get<0>(p1) * get<1>(p2);
+ state.sum += detail::determinant<return_type>(p2, p1);
}
static inline return_type result(summation const& state)
Modified: branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -16,6 +16,7 @@
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/segment_concept.hpp>
+#include <boost/geometry/arithmetic/determinant.hpp>
#include <boost/geometry/algorithms/detail/assign_values.hpp>
#include <boost/geometry/util/math.hpp>
@@ -120,7 +121,7 @@
coordinate_type const& dx_a, coordinate_type const& dy_a,
coordinate_type const& dx_b, coordinate_type const& dy_b)
{
- // 1) Handle "disjoint", probably common case.
+ // 1) Handle "disjoint", common case.
// per dimension, 2 cases: a_1----------a_2 b_1-------b_2 or B left of A
coordinate_type ax_1, ax_2, bx_1, bx_2;
bool ax_swapped = false, bx_swapped = false;
@@ -136,7 +137,7 @@
bool ay_swapped = false, by_swapped = false;
detail::segment_arrange<segment_type1, 1>::apply(a, ay_1, ay_2, ay_swapped);
detail::segment_arrange<segment_type2, 1>::apply(b, by_1, by_2, by_swapped);
- if (ay_2 < ay_1 || ay_1 > by_2)
+ if (ay_2 < by_1 || ay_1 > by_2)
{
return Policy::disjoint();
}
@@ -199,13 +200,19 @@
coordinate_type, double
>::type promoted_type;
+ // Calculate the determinant/2D cross product
+ // (Note, because we only check on zero,
+ // the order a/b does not care)
+ promoted_type const d = geometry::detail::determinant
+ <
+ promoted_type
+ >(dx_a, dy_a, dx_b, dy_b);
- promoted_type const d = (dy_b * dx_a) - (dx_b * dy_a);
// Determinant d should be nonzero.
// If it is zero, we have an robustness issue here,
// (and besides that we cannot divide by it)
- if(math::equals(d, zero) && ! collinear)
- //if(! collinear && sides.as_collinear())
+ promoted_type const pt_zero = promoted_type();
+ if(math::equals(d, pt_zero) && ! collinear)
{
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
std::cout << "Determinant zero? Type : "
Modified: branches/release/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -19,6 +19,7 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/type_traits.hpp>
+#include <boost/geometry/arithmetic/determinant.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/strategies/centroid.hpp>
@@ -177,7 +178,7 @@
calculation_type const y1 = boost::numeric_cast<calculation_type>(get<1>(p1));
calculation_type const x2 = boost::numeric_cast<calculation_type>(get<0>(p2));
calculation_type const y2 = boost::numeric_cast<calculation_type>(get<1>(p2));
- calculation_type const ai = x1 * y2 - x2 * y1;
+ calculation_type const ai = geometry::detail::determinant<calculation_type>(p1, p2);
state.count++;
state.sum_a2 += ai;
state.sum_x += ai * (x1 + x2);
@@ -187,7 +188,7 @@
static inline bool result(sums const& state, Point& centroid)
{
calculation_type const zero = calculation_type();
- if (state.count > 0 && state.sum_a2 != zero)
+ if (state.count > 0 && ! math::equals(state.sum_a2, zero))
{
calculation_type const v3 = 3;
calculation_type const a3 = v3 * state.sum_a2;
Modified: branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -22,8 +22,7 @@
#include <boost/geometry/strategies/distance.hpp>
-#include <boost/geometry/util/select_calculation_type.hpp>
-#include <boost/geometry/util/promote_floating_point.hpp>
+#include <boost/geometry/util/calculation_type.hpp>
@@ -82,7 +81,8 @@
class pythagoras
{
public :
- typedef typename select_calculation_type
+
+ typedef typename util::calculation_type::geometric::binary
<
Point1,
Point2,
@@ -136,10 +136,14 @@
{
typedef comparable::pythagoras<Point1, Point2, CalculationType> comparable_type;
public :
- typedef typename promote_floating_point
- <
- typename services::return_type<comparable_type>::type
- >::type calculation_type;
+ typedef typename util::calculation_type::geometric::binary
+ <
+ Point1,
+ Point2,
+ CalculationType,
+ double,
+ double // promote integer to double
+ >::type calculation_type;
/*!
\brief applies the distance calculation using pythagoras
@@ -219,7 +223,7 @@
{
typedef comparable::pythagoras<Point1, Point2, CalculationType> comparable_type;
public :
- static inline comparable_type apply(pythagoras<Point1, Point2, CalculationType> const& input)
+ static inline comparable_type apply(pythagoras<Point1, Point2, CalculationType> const& )
{
return comparable_type();
}
@@ -303,7 +307,7 @@
{
typedef comparable::pythagoras<Point1, Point2, CalculationType> comparable_type;
public :
- static inline comparable_type apply(comparable::pythagoras<Point1, Point2, CalculationType> const& input)
+ static inline comparable_type apply(comparable::pythagoras<Point1, Point2, CalculationType> const& )
{
return comparable_type();
}
Modified: branches/release/boost/geometry/strategies/cartesian/side_by_triangle.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/side_by_triangle.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/side_by_triangle.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -17,10 +17,9 @@
#include <boost/mpl/if.hpp>
#include <boost/type_traits.hpp>
+#include <boost/geometry/arithmetic/determinant.hpp>
#include <boost/geometry/core/access.hpp>
-
#include <boost/geometry/util/select_coordinate_type.hpp>
-
#include <boost/geometry/strategies/side.hpp>
@@ -66,7 +65,6 @@
CalculationType
>::type coordinate_type;
-//std::cout << "side: " << typeid(coordinate_type).name() << std::endl;
coordinate_type const x = get<0>(p);
coordinate_type const y = get<1>(p);
@@ -87,7 +85,12 @@
promoted_type const dpx = x - sx1;
promoted_type const dpy = y - sy1;
- promoted_type const s = dx * dpy - dy * dpx;
+ promoted_type const s
+ = geometry::detail::determinant<promoted_type>
+ (
+ dx, dy,
+ dpx, dpy
+ );
promoted_type const zero = promoted_type();
return math::equals(s, zero) ? 0
Modified: branches/release/boost/geometry/strategies/strategy_transform.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/strategy_transform.hpp (original)
+++ branches/release/boost/geometry/strategies/strategy_transform.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -66,7 +66,7 @@
struct transform_coordinates<Src, Dst, N, N, F>
{
template <typename T>
- static inline void transform(Src const& source, Dst& dest, T value)
+ static inline void transform(Src const& , Dst& , T )
{
}
};
Modified: branches/release/boost/geometry/strategies/transform/matrix_transformers.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/transform/matrix_transformers.hpp (original)
+++ branches/release/boost/geometry/strategies/transform/matrix_transformers.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -218,7 +218,7 @@
// constructor takes an optional third argument doing nothing.
inline translate_transformer(coordinate_type const& translate_x,
coordinate_type const& translate_y,
- coordinate_type const& dummy = 0)
+ coordinate_type const& = 0)
: ublas_transformer<P1, P2, 2, 2>(
1, 0, translate_x,
0, 1, translate_y,
@@ -275,7 +275,7 @@
public :
inline scale_transformer(coordinate_type const& scale_x,
coordinate_type const& scale_y,
- coordinate_type const& dummy = 0)
+ coordinate_type const& = 0)
: ublas_transformer<P1, P2, 2, 2>(
scale_x, 0, 0,
0, scale_y, 0,
Modified: branches/release/boost/geometry/util/for_each_coordinate.hpp
==============================================================================
--- branches/release/boost/geometry/util/for_each_coordinate.hpp (original)
+++ branches/release/boost/geometry/util/for_each_coordinate.hpp 2012-02-05 13:47:13 EST (Sun, 05 Feb 2012)
@@ -54,7 +54,7 @@
<
IsConst,
Point
- >::type& point, Op operation)
+ >::type& , Op operation)
{
return operation;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk