|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76730 - in trunk: boost/geometry/extensions/algorithms/buffer libs/geometry/test_extensions/algorithms/buffer
From: barend.gehrels_at_[hidden]
Date: 2012-01-28 05:58:35
Author: barendgehrels
Date: 2012-01-28 05:58:33 EST (Sat, 28 Jan 2012)
New Revision: 76730
URL: http://svn.boost.org/trac/boost/changeset/76730
Log:
Buffer update - this solves indentation-case up to 0.6 and tests it
Text files modified:
trunk/boost/geometry/extensions/algorithms/buffer/buffer_appender.hpp | 31 ++++++++++++++++++++++---------
trunk/libs/geometry/test_extensions/algorithms/buffer/polygon_buffer.cpp | 13 +++++++++----
trunk/libs/geometry/test_extensions/algorithms/buffer/test_buffer.hpp | 23 ++++++++++++++---------
3 files changed, 45 insertions(+), 22 deletions(-)
Modified: trunk/boost/geometry/extensions/algorithms/buffer/buffer_appender.hpp
==============================================================================
--- trunk/boost/geometry/extensions/algorithms/buffer/buffer_appender.hpp (original)
+++ trunk/boost/geometry/extensions/algorithms/buffer/buffer_appender.hpp 2012-01-28 05:58:33 EST (Sat, 28 Jan 2012)
@@ -84,8 +84,10 @@
#endif
}
+ cleanup();
+
int index = do_append(point);
- m_pieces.push_back(piece(index));
+ m_pieces.push_back(piece('J', index));
}
inline void append_end_join(point_type const& point)
@@ -122,11 +124,13 @@
struct piece
{
+ char type; // For DEBUG, this will either go or changed into enum
int begin, end;
- inline piece(int b = -1)
- : begin(b)
- , end(-1)
+ inline piece(char t = '\0', int b = -1, int e = -1)
+ : type(t)
+ , begin(b)
+ , end(e)
{}
};
@@ -145,7 +149,7 @@
inline bool check(point_type const& point)
{
- for (std::deque<piece>::reverse_iterator rit
+ for (std::deque<piece>::const_reverse_iterator rit
= m_pieces.rbegin();
rit != m_pieces.rend();
++rit)
@@ -163,7 +167,7 @@
return false;
}
- inline bool calculate(point_type const& point, piece& the_piece)
+ inline bool calculate(point_type const& point, piece const& the_piece)
{
int const n = boost::size(m_range);
@@ -206,20 +210,29 @@
// Add this IP also as first point on the deque.
// We clear the deque - the indexes might be invalidated anyway
- int index = do_append(is.intersections[0]);
+ int is_index = do_append(is.intersections[0]);
// For many the index of intersection point is OK, but
// for bowls >= 6 (see test-program) we need to intersect with the same segment again:
- index = the_piece.begin;
+ int begin_index = the_piece.begin;
m_pieces.resize(0);
- m_pieces.push_back(piece(index));
+ m_pieces.push_back(piece('F', begin_index, is_index));
+ m_pieces.push_back(piece('I', is_index));
return true;
}
}
return false;
}
+
+ void cleanup()
+ {
+ if (m_pieces.size() > 0 && m_pieces.back().end == -1)
+ {
+ m_pieces.resize(0);
+ }
+ }
};
Modified: trunk/libs/geometry/test_extensions/algorithms/buffer/polygon_buffer.cpp
==============================================================================
--- trunk/libs/geometry/test_extensions/algorithms/buffer/polygon_buffer.cpp (original)
+++ trunk/libs/geometry/test_extensions/algorithms/buffer/polygon_buffer.cpp 2012-01-28 05:58:33 EST (Sat, 28 Jan 2012)
@@ -61,10 +61,15 @@
test_one<polygon_type, buf::join_miter, polygon_type>(true, "concave_simplex", concave_simplex, 'm', 14.47708, 0.5);
test_one<polygon_type, buf::join_round, polygon_type>(true, "concave_simplex", concave_simplex, 'r', 13.10366, 0.5);
- test_one<polygon_type, buf::join_miter, polygon_type>("indentation4", indentation, 'm', 25.7741125496954, 0.4);
- test_one<polygon_type, buf::join_round, polygon_type>("indentation4", indentation, 'r', 25.5641980024698, 0.4);
- test_one<polygon_type, buf::join_miter, polygon_type>("indentation5", indentation, 'm', 25.7741125496954, 0.5);
- test_one<polygon_type, buf::join_round, polygon_type>("indentation5", indentation, 'r', 25.5641980024698, 0.5);
+ test_one<polygon_type, buf::join_miter, polygon_type>(true, "indentation4", indentation, 'm', 25.7741, 0.4);
+ test_one<polygon_type, buf::join_round, polygon_type>(true, "indentation4", indentation, 'r', 24.5695, 0.4);
+ test_one<polygon_type, buf::join_miter, polygon_type>(true, "indentation5", indentation, 'm', 28.2426, 0.5);
+ test_one<polygon_type, buf::join_round, polygon_type>(true, "indentation5", indentation, 'r', 26.7452, 0.5);
+ test_one<polygon_type, buf::join_miter, polygon_type>(true, "indentation6", indentation, 'm', 30.6712, 0.6);
+
+ // SQL Server gives 30.34479159164
+ test_one<polygon_type, buf::join_round, polygon_type>(true, "indentation6", indentation, 'r', 30.3445, 0.6);
+
test_one<polygon_type, buf::join_miter, polygon_type>("indentation8", indentation, 'm', 35.594305909533, 0.8);
test_one<polygon_type, buf::join_round, polygon_type>("indentation8", indentation, 'r', 35.0012686715019, 0.8);
test_one<polygon_type, buf::join_miter, polygon_type>("indentation12", indentation, 'm', 46.3541038841777, 1.2);
Modified: trunk/libs/geometry/test_extensions/algorithms/buffer/test_buffer.hpp
==============================================================================
--- trunk/libs/geometry/test_extensions/algorithms/buffer/test_buffer.hpp (original)
+++ trunk/libs/geometry/test_extensions/algorithms/buffer/test_buffer.hpp 2012-01-28 05:58:33 EST (Sat, 28 Jan 2012)
@@ -10,7 +10,7 @@
#ifndef BOOST_GEOMETRY_TEST_BUFFER_HPP
#define BOOST_GEOMETRY_TEST_BUFFER_HPP
-//#define BOOST_GEOMETRY_DEBUG_WITH_MAPPER
+// #define BOOST_GEOMETRY_DEBUG_WITH_MAPPER
#define TEST_WITH_SVG
#include <fstream>
@@ -180,7 +180,19 @@
);
}
#endif
- buffered.push_back(buffered_step1);
+
+ if (boost::contains(complete.str(), "indentation4")
+ || boost::contains(complete.str(), "indentation5")
+ || boost::contains(complete.str(), "indentation6"))
+ {
+ // Some controlled cases are already dissolved,
+ // such that we can detect regressions there
+ bg::dissolve(buffered_step1, buffered);
+ }
+ else
+ {
+ buffered.push_back(buffered_step1);
+ }
//std::cout << caseid << std::endl;
//std::cout << "INPUT: " << bg::wkt(geometry) << std::endl;
@@ -253,13 +265,6 @@
typedef typename bg::point_type<Geometry>::type point_type;
- //std::cout << caseid << std::endl;
- if (join == 'm')
- {
- //return;
- }
-
-
#ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS
std::cout
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