|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73285 - in trunk/boost/geometry: algorithms extensions/io/svg strategies/agnostic strategies/cartesian
From: barend.gehrels_at_[hidden]
Date: 2011-07-21 15:55:58
Author: barendgehrels
Date: 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
New Revision: 73285
URL: http://svn.boost.org/trac/boost/changeset/73285
Log:
Fixed first/second in cart_intersect.hpp
Text files modified:
trunk/boost/geometry/algorithms/covered_by.hpp | 2
trunk/boost/geometry/algorithms/within.hpp | 2
trunk/boost/geometry/extensions/io/svg/svg_mapper.hpp | 7 ++++-
trunk/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp | 2
trunk/boost/geometry/strategies/cartesian/box_in_box.hpp | 2
trunk/boost/geometry/strategies/cartesian/cart_intersect.hpp | 45 ++++++++++++++++++++++++++++++++-------
trunk/boost/geometry/strategies/cartesian/point_in_box.hpp | 6 ++--
7 files changed, 49 insertions(+), 17 deletions(-)
Modified: trunk/boost/geometry/algorithms/covered_by.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/covered_by.hpp (original)
+++ trunk/boost/geometry/algorithms/covered_by.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -180,7 +180,7 @@
inline bool covered_by(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
- concept::within::check
+ concept::within::check
<
typename tag<Geometry1>::type,
typename tag<Geometry2>::type,
Modified: trunk/boost/geometry/algorithms/within.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/within.hpp (original)
+++ trunk/boost/geometry/algorithms/within.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -331,7 +331,7 @@
inline bool within(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
- concept::within::check
+ concept::within::check
<
typename tag<Geometry1>::type,
typename tag<Geometry2>::type,
Modified: trunk/boost/geometry/extensions/io/svg/svg_mapper.hpp
==============================================================================
--- trunk/boost/geometry/extensions/io/svg/svg_mapper.hpp (original)
+++ trunk/boost/geometry/extensions/io/svg/svg_mapper.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -229,6 +229,7 @@
boost::scoped_ptr<transformer_type> m_matrix;
std::ostream& m_stream;
int m_width, m_height;
+ std::string m_width_height; // for <svg> tag only, defaults to 2x 100%
void init_matrix()
{
@@ -243,7 +244,7 @@
<< std::endl
<< "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">"
<< std::endl
- << "<svg width=\"100%\" height=\"100%\" version=\"1.1\""
+ << "<svg " << m_width_height << " version=\"1.1\""
<< std::endl
<< "xmlns=\"http://www.w3.org/2000/svg\">"
<< std::endl;
@@ -251,10 +252,12 @@
}
public :
- svg_mapper(std::ostream& s, int w, int h)
+ svg_mapper(std::ostream& s, int w, int h
+ , std::string const& width_height = "width=\"100%\" height=\"100%\"")
: m_stream(s)
, m_width(w)
, m_height(h)
+ , m_width_height(width_height)
{
assign_inverse(m_bounding_box);
}
Modified: trunk/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp
==============================================================================
--- trunk/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp (original)
+++ trunk/boost/geometry/strategies/agnostic/point_in_box_by_side.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -110,7 +110,7 @@
{
typedef within::point_in_box_by_side
<
- Point, Box, within::decide_within
+ Point, Box, within::decide_within
> type;
};
Modified: trunk/boost/geometry/strategies/cartesian/box_in_box.hpp
==============================================================================
--- trunk/boost/geometry/strategies/cartesian/box_in_box.hpp (original)
+++ trunk/boost/geometry/strategies/cartesian/box_in_box.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -160,7 +160,7 @@
{
typedef within::box_in_box
<
- BoxContained, BoxContaining,
+ BoxContained, BoxContaining,
within::box_covered_by_range
> type;
};
Modified: trunk/boost/geometry/strategies/cartesian/cart_intersect.hpp
==============================================================================
--- trunk/boost/geometry/strategies/cartesian/cart_intersect.hpp (original)
+++ trunk/boost/geometry/strategies/cartesian/cart_intersect.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,8 @@
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/segment_concept.hpp>
+#include <boost/geometry/algorithms/detail/assign_values.hpp>
+
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
@@ -54,6 +56,19 @@
}
};
+template <std::size_t Index, typename Segment>
+inline typename geometry::point_type<Segment>::type get_from_index(
+ Segment const& segment)
+{
+ typedef typename geometry::point_type<Segment>::type point_type;
+ point_type point;
+ geometry::detail::assign::assign_point_from_index
+ <
+ Segment, point_type, Index, 0, dimension<Segment>::type::value
+ >::apply(segment, point);
+ return point;
+}
+
}
#endif
@@ -91,10 +106,10 @@
/// Relate segments a and b
static inline return_type apply(segment_type1 const& a, segment_type2 const& b)
{
- coordinate_type dx_a = get<1, 0>(a) - get<0, 0>(a); // distance in x-dir
- coordinate_type dx_b = get<1, 0>(b) - get<0, 0>(b);
- coordinate_type dy_a = get<1, 1>(a) - get<0, 1>(a); // distance in y-dir
- coordinate_type dy_b = get<1, 1>(b) - get<0, 1>(b);
+ coordinate_type const dx_a = get<1, 0>(a) - get<0, 0>(a); // distance in x-dir
+ coordinate_type const dx_b = get<1, 0>(b) - get<0, 0>(b);
+ coordinate_type const dy_a = get<1, 1>(a) - get<0, 1>(a); // distance in y-dir
+ coordinate_type const dy_b = get<1, 1>(b) - get<0, 1>(b);
return apply(a, b, dx_a, dy_a, dx_b, dy_b);
}
@@ -133,8 +148,15 @@
// Note: Do NOT yet calculate the determinant here, but use the SIDE strategy.
// Determinant calculation is not robust; side (orient) can be made robust
// (and is much robuster even without measures)
- sides.set<1>(side::apply(a.first, a.second, b.first),
- side::apply(a.first, a.second, b.second));
+ sides.set<1>
+ (
+ side::apply(detail::get_from_index<0>(a)
+ , detail::get_from_index<1>(a)
+ , detail::get_from_index<0>(b)),
+ side::apply(detail::get_from_index<0>(a)
+ , detail::get_from_index<1>(a)
+ , detail::get_from_index<1>(b))
+ );
if (sides.same<1>())
{
@@ -143,8 +165,15 @@
}
// 2b) For other segment
- sides.set<0>(side::apply(b.first, b.second, a.first),
- side::apply(b.first, b.second, a.second));
+ sides.set<0>
+ (
+ side::apply(detail::get_from_index<0>(b)
+ , detail::get_from_index<1>(b)
+ , detail::get_from_index<0>(a)),
+ side::apply(detail::get_from_index<0>(b)
+ , detail::get_from_index<1>(b)
+ , detail::get_from_index<1>(a))
+ );
if (sides.same<0>())
{
Modified: trunk/boost/geometry/strategies/cartesian/point_in_box.hpp
==============================================================================
--- trunk/boost/geometry/strategies/cartesian/point_in_box.hpp (original)
+++ trunk/boost/geometry/strategies/cartesian/point_in_box.hpp 2011-07-21 15:55:56 EDT (Thu, 21 Jul 2011)
@@ -61,7 +61,7 @@
static inline bool apply(Point const& point, Box const& box)
{
if (! SubStrategy::apply(get<Dimension>(point),
- get<min_corner, Dimension>(box),
+ get<min_corner, Dimension>(box),
get<max_corner, Dimension>(box))
)
{
@@ -102,7 +102,7 @@
>
struct point_in_box
{
- static inline bool apply(Point const& point, Box const& box)
+ static inline bool apply(Point const& point, Box const& box)
{
return relate_point_box_loop
<
@@ -154,7 +154,7 @@
{
typedef within::point_in_box
<
- Point, Box,
+ Point, Box,
within::covered_by_range
> type;
};
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