Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80564 - in trunk/libs/polygon: doc test
From: sydorchuk.andriy_at_[hidden]
Date: 2012-09-17 17:12:40


Author: asydorchuk
Date: 2012-09-17 17:12:40 EDT (Mon, 17 Sep 2012)
New Revision: 80564
URL: http://svn.boost.org/trac/boost/changeset/80564

Log:
Polygon: adding straight skeleton functor to compute intersection event parameters.

Added:
   trunk/libs/polygon/test/skeleton_predicates_test.cpp (contents, props changed)
Text files modified:
   trunk/libs/polygon/doc/voronoi_builder.htm | 4 ++--
   trunk/libs/polygon/test/Jamfile.v2 | 5 +++++
   2 files changed, 7 insertions(+), 2 deletions(-)

Modified: trunk/libs/polygon/doc/voronoi_builder.htm
==============================================================================
--- trunk/libs/polygon/doc/voronoi_builder.htm (original)
+++ trunk/libs/polygon/doc/voronoi_builder.htm 2012-09-17 17:12:40 EDT (Mon, 17 Sep 2012)
@@ -314,7 +314,7 @@
 ulp_cmp_type<br>
             </td>
             <td style="vertical-align: top;">Ulp comparison structure
-that checks if two fpt_type values are withing the given ulp range
+that checks if two fpt_type values are within the given ulp range
 (relative error range).<br>
             </td>
           </tr>
@@ -386,4 +386,4 @@
 </table>
 
 
-</body></html>
\ No newline at end of file
+</body></html>

Modified: trunk/libs/polygon/test/Jamfile.v2
==============================================================================
--- trunk/libs/polygon/test/Jamfile.v2 (original)
+++ trunk/libs/polygon/test/Jamfile.v2 2012-09-17 17:12:40 EDT (Mon, 17 Sep 2012)
@@ -22,6 +22,11 @@
         [ run gtl_boost_unit_test.cpp ]
     ;
 
+test-suite skeleton-unit
+ :
+ [ run skeleton_predicates_test.cpp ]
+ ;
+
 test-suite voronoi-unit
     :
         [ run voronoi_builder_test.cpp ]

Added: trunk/libs/polygon/test/skeleton_predicates_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/polygon/test/skeleton_predicates_test.cpp 2012-09-17 17:12:40 EDT (Mon, 17 Sep 2012)
@@ -0,0 +1,61 @@
+// Boost.Polygon library skeleton_predicates_test.cpp file
+
+// Copyright Andrii Sydorchuk 2012.
+// Copyright Lucanus Simonson 2012.
+// Distributed under 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)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#define BOOST_TEST_MODULE skeleton_predicates_test
+
+#include <boost/test/test_case_template.hpp>
+#include <boost/polygon/detail/skeleton_predicates.hpp>
+using boost::polygon::detail::int32;
+using boost::polygon::detail::fpt64;
+using boost::polygon::detail::intersection_event;
+using boost::polygon::detail::skeleton_ctype_traits;
+using boost::polygon::detail::skeleton_predicates;
+
+#include <boost/polygon/point_data.hpp>
+#include <boost/polygon/segment_data.hpp>
+using boost::polygon::point_data;
+using boost::polygon::segment_data;
+
+typedef point_data<int32> point_type;
+typedef segment_data<int32> segment_type;
+typedef skeleton_ctype_traits<int32> ctraits_type;
+typedef intersection_event<fpt64> event_type;
+typename skeleton_predicates<ctraits_type>::event_formation_predicate<
+ segment_data<int32>, intersection_event<fpt64> > create_event;
+
+BOOST_AUTO_TEST_CASE(event_predicate_test1) {
+ point_type point1(0, 0);
+ point_type point2(0, 4);
+ point_type point3(4, 4);
+ point_type point4(4, 0);
+ segment_type segment1(point1, point2);
+ segment_type segment2(point2, point3);
+ segment_type segment3(point3, point4);
+ event_type e;
+ BOOST_CHECK(create_event(segment1, segment2, segment3, &e));
+ BOOST_CHECK_EQUAL(e.x(), 2);
+ BOOST_CHECK_EQUAL(e.y(), 2);
+ BOOST_CHECK_EQUAL(e.r(), 2);
+}
+
+BOOST_AUTO_TEST_CASE(event_predicate_test2) {
+ point_type point1(0, 0);
+ point_type point2(0, 4);
+ point_type point3(4, 4);
+ point_type point4(4, 0);
+ segment_type segment1(point4, point3);
+ segment_type segment2(point3, point2);
+ segment_type segment3(point2, point1);
+ event_type e;
+ BOOST_CHECK(create_event(segment1, segment2, segment3, &e));
+ BOOST_CHECK_EQUAL(e.x(), 2);
+ BOOST_CHECK_EQUAL(e.y(), 2);
+ BOOST_CHECK_EQUAL(e.r(), 2);
+}


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