Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81006 - in trunk: boost/polygon libs/polygon/doc libs/polygon/test
From: sydorchuk.andriy_at_[hidden]
Date: 2012-10-17 16:39:01


Author: asydorchuk
Date: 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
New Revision: 81006
URL: http://svn.boost.org/trac/boost/changeset/81006

Log:
Polygon: refactoring point data/traits/concept; adding point data/traits/concept unit test; updating documentation.

Added:
   trunk/libs/polygon/test/polygon_point_test.cpp (contents, props changed)
Text files modified:
   trunk/boost/polygon/point_3d_concept.hpp | 23
   trunk/boost/polygon/point_concept.hpp | 761 ++++++++++++++++++++++++---------------
   trunk/boost/polygon/point_data.hpp | 223 ++++++-----
   trunk/boost/polygon/point_traits.hpp | 70 ++-
   trunk/boost/polygon/segment_concept.hpp | 212 ++++-------
   trunk/boost/polygon/segment_data.hpp | 103 ++--
   trunk/boost/polygon/segment_traits.hpp | 78 ++-
   trunk/libs/polygon/doc/gtl_point_concept.htm | 188 ++++-----
   trunk/libs/polygon/test/Jamfile.v2 | 1
   trunk/libs/polygon/test/gtl_boost_unit_test.cpp | 42 --
   trunk/libs/polygon/test/polygon_segment_test.cpp | 94 ++-
   11 files changed, 960 insertions(+), 835 deletions(-)

Modified: trunk/boost/polygon/point_3d_concept.hpp
==============================================================================
--- trunk/boost/polygon/point_3d_concept.hpp (original)
+++ trunk/boost/polygon/point_3d_concept.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -99,6 +99,20 @@
     return lvalue;
   }
 
+ struct y_p3d_x : gtl_yes {};
+
+ template <typename point_type>
+ typename enable_if< typename gtl_and<y_p3d_x, typename is_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
+ typename point_3d_coordinate_type<point_type>::type >::type
+ x(const point_type& point) { return get(point, HORIZONTAL); }
+
+ struct y_p3d_y : gtl_yes {};
+
+ template <typename point_type>
+ typename enable_if< typename gtl_and<y_p3d_y, typename is_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
+ typename point_3d_coordinate_type<point_type>::type >::type
+ y(const point_type& point) { return get(point, VERTICAL); }
+
   struct y_p3d_z : gtl_yes {};
 
   template <typename point_type>
@@ -106,16 +120,16 @@
                        typename point_3d_coordinate_type<point_type>::type >::type
   z(const point_type& point) { return get(point, PROXIMAL); }
 
- struct y_p3d_x : gtl_yes {};
+ struct y_p3d_x2 : gtl_yes {};
 
   template <typename point_type, typename coordinate_type>
- typename enable_if< typename gtl_and<y_p3d_x, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type, void>::type
+ typename enable_if< typename gtl_and<y_p3d_x2, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type, void>::type
   x(point_type& point, coordinate_type value) { set(point, HORIZONTAL, value); }
 
- struct y_p3d_y : gtl_yes {};
+ struct y_p3d_y2 : gtl_yes {};
 
   template <typename point_type, typename coordinate_type>
- typename enable_if< typename gtl_and<y_p3d_y, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type, void>::type
+ typename enable_if< typename gtl_and<y_p3d_y2, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type, void>::type
   y(point_type& point, coordinate_type value) { set(point, VERTICAL, value); }
 
   struct y_p3d_z2 : gtl_yes {};
@@ -267,4 +281,3 @@
 }
 }
 #endif
-

Modified: trunk/boost/polygon/point_concept.hpp
==============================================================================
--- trunk/boost/polygon/point_concept.hpp (original)
+++ trunk/boost/polygon/point_concept.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,316 +1,469 @@
-/*
- Copyright 2008 Intel Corporation
+// Boost.Polygon library point_concept.hpp header file
+
+// Copyright 2008 Intel Corporation.
+// Copyright Simonson Lucanus 2008-2012.
+// Copyright Andrii Sydorchuk 2012-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.
 
- Use, modification and distribution are 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_POLYGON_POINT_CONCEPT_HPP
 #define BOOST_POLYGON_POINT_CONCEPT_HPP
+
 #include "isotropy.hpp"
-#include "point_data.hpp"
 #include "point_traits.hpp"
 
-namespace boost { namespace polygon{
- struct point_concept {};
+namespace boost {
+namespace polygon {
+
+struct point_concept {};
+
+template <typename ConceptType>
+struct is_point_concept {
+ typedef gtl_no type;
+};
+
+template <>
+struct is_point_concept<point_concept> {
+ typedef gtl_yes type;
+};
+
+template <typename ConceptType>
+struct is_mutable_point_concept {
+ typedef gtl_no type;
+};
+
+template <>
+struct is_mutable_point_concept<point_concept> {
+ typedef gtl_yes type;
+};
+
+template <typename GeometryType, typename BoolType>
+struct point_coordinate_type_by_concept {
+ typedef void type;
+};
+
+template <typename GeometryType>
+struct point_coordinate_type_by_concept<GeometryType, gtl_yes> {
+ typedef typename point_traits<GeometryType>::coordinate_type type;
+};
+
+template <typename GeometryType>
+struct point_coordinate_type {
+ typedef typename point_coordinate_type_by_concept<
+ GeometryType,
+ typename is_point_concept<
+ typename geometry_concept<GeometryType>::type
+ >::type
+ >::type type;
+};
+
+template <typename GeometryType, typename BoolType>
+struct point_difference_type_by_concept {
+ typedef void type;
+};
+
+template <typename GeometryType>
+struct point_difference_type_by_concept<GeometryType, gtl_yes> {
+ typedef typename coordinate_traits<
+ typename point_coordinate_type<GeometryType>::type
+ >::coordinate_difference type;
+};
+
+template <typename GeometryType>
+struct point_difference_type {
+ typedef typename point_difference_type_by_concept<
+ GeometryType,
+ typename is_point_concept<
+ typename geometry_concept<GeometryType>::type
+ >::type
+ >::type type;
+};
+
+template <typename GeometryType, typename BoolType>
+struct point_distance_type_by_concept {
+ typedef void type;
+};
+
+template <typename GeometryType>
+struct point_distance_type_by_concept<GeometryType, gtl_yes> {
+ typedef typename coordinate_traits<
+ typename point_coordinate_type<GeometryType>::type
+ >::coordinate_distance type;
+};
+
+template <typename GeometryType>
+struct point_distance_type {
+ typedef typename point_distance_type_by_concept<
+ GeometryType,
+ typename is_point_concept<
+ typename geometry_concept<GeometryType>::type
+ >::type
+ >::type type;
+};
+
+struct y_pt_get : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_get,
+ typename is_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+ typename point_coordinate_type<PointType>::type
+>::type get(const PointType& point, orientation_2d orient) {
+ return point_traits<PointType>::get(point, orient);
+}
+
+struct y_pt_set : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_set,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+ void
+>::type set(PointType& point, orientation_2d orient,
+ typename point_mutable_traits<PointType>::coordinate_type value) {
+ point_mutable_traits<PointType>::set(point, orient, value);
+}
+
+struct y_pt_construct : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_construct,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+PointType>::type construct(
+ typename point_mutable_traits<PointType>::coordinate_type x,
+ typename point_mutable_traits<PointType>::coordinate_type y) {
+ return point_mutable_traits<PointType>::construct(x, y);
+}
+
+struct y_pt_assign : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_assign,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+>::type,
+PointType1>::type& assign(PointType1& lvalue, const PointType2& rvalue) {
+ set(lvalue, HORIZONTAL, get(rvalue, HORIZONTAL));
+ set(lvalue, VERTICAL, get(rvalue, VERTICAL));
+ return lvalue;
+}
+
+struct y_p_x : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_p_x,
+ typename is_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+ typename point_coordinate_type<PointType>::type
+>::type x(const PointType& point) {
+ return get(point, HORIZONTAL);
+}
+
+struct y_p_y : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_p_y,
+ typename is_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+ typename point_coordinate_type<PointType>::type
+>::type y(const PointType& point) {
+ return get(point, VERTICAL);
+}
+
+struct y_p_sx : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_p_sx,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+void>::type x(PointType& point,
+ typename point_mutable_traits<PointType>::coordinate_type value) {
+ set(point, HORIZONTAL, value);
+}
+
+struct y_p_sy : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_p_sy,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+void>::type y(PointType& point,
+ typename point_mutable_traits<PointType>::coordinate_type value) {
+ set(point, VERTICAL, value);
+}
+
+struct y_pt_equiv : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_equiv,
+ typename is_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+bool>::type equivalence(
+ const PointType1& point1, const PointType2& point2) {
+ return (x(point1) == x(point2)) && (y(point1) == y(point2));
+}
 
- template <typename T>
- struct is_point_concept { typedef gtl_no type; };
- template <>
- struct is_point_concept<point_concept> { typedef gtl_yes type; };
-
- struct point_3d_concept;
- template <>
- struct is_point_concept<point_3d_concept> { typedef gtl_yes type; };
-
- template <typename T>
- struct is_mutable_point_concept { typedef gtl_no type; };
- template <>
- struct is_mutable_point_concept<point_concept> { typedef gtl_yes type; };
-
- template <typename T, typename CT>
- struct point_coordinate_type_by_concept { typedef void type; };
- template <typename T>
- struct point_coordinate_type_by_concept<T, gtl_yes> { typedef typename point_traits<T>::coordinate_type type; };
-
- template <typename T>
- struct point_coordinate_type {
- typedef typename point_coordinate_type_by_concept<T, typename is_point_concept<typename geometry_concept<T>::type>::type>::type type;
- };
-
- template <typename T, typename CT>
- struct point_difference_type_by_concept { typedef void type; };
- template <typename T>
- struct point_difference_type_by_concept<T, gtl_yes> {
- typedef typename coordinate_traits<typename point_coordinate_type<T>::type>::coordinate_difference type; };
-
- template <typename T>
- struct point_difference_type {
- typedef typename point_difference_type_by_concept<
- T, typename is_point_concept<typename geometry_concept<T>::type>::type>::type type;
- };
-
- template <typename T, typename CT>
- struct point_distance_type_by_concept { typedef void type; };
- template <typename T>
- struct point_distance_type_by_concept<T, gtl_yes> {
- typedef typename coordinate_traits<typename point_coordinate_type<T>::type>::coordinate_distance type; };
-
- template <typename T>
- struct point_distance_type {
- typedef typename point_distance_type_by_concept<
- T, typename is_point_concept<typename geometry_concept<T>::type>::type>::type type;
- };
-
- struct y_pt_get : gtl_yes {};
-
- template <typename T>
- typename enable_if< typename gtl_and<y_pt_get, typename is_point_concept<typename geometry_concept<T>::type>::type>::type,
- typename point_coordinate_type<T>::type >::type
- get(const T& point, orientation_2d orient) {
- return point_traits<T>::get(point, orient);
- }
-
- struct y_pt_set : gtl_yes {};
-
- template <typename T, typename coordinate_type>
- typename enable_if< typename gtl_and<y_pt_set, typename is_mutable_point_concept<typename geometry_concept<T>::type>::type>::type,
- void>::type
- set(T& point, orientation_2d orient, coordinate_type value) {
- point_mutable_traits<T>::set(point, orient, value);
- }
-
- struct y_pt_construct : gtl_yes {};
-
- template <typename T, typename coordinate_type1, typename coordinate_type2>
- typename enable_if< typename gtl_and<y_pt_construct, typename is_mutable_point_concept<typename geometry_concept<T>::type>::type>::type,
- T>::type
- construct(coordinate_type1 x_value, coordinate_type2 y_value) {
- return point_mutable_traits<T>::construct(x_value, y_value);
- }
-
- struct y_pt_assign : gtl_yes {};
-
- template <typename T1, typename T2>
- typename enable_if<typename gtl_and_3<
- y_pt_assign,
- typename is_mutable_point_concept<typename geometry_concept<T1>::type>::type,
- typename is_point_concept<typename geometry_concept<T2>::type>::type>::type,
- T1>::type &
- assign(T1& lvalue, const T2& rvalue) {
- set(lvalue, HORIZONTAL, get(rvalue, HORIZONTAL));
- set(lvalue, VERTICAL, get(rvalue, VERTICAL));
- return lvalue;
- }
-
- struct y_p_x : gtl_yes {};
-
- template <typename point_type>
- typename enable_if< typename gtl_and<y_p_x, typename is_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- typename point_coordinate_type<point_type>::type >::type
- x(const point_type& point) {
- return get(point, HORIZONTAL);
- }
-
- struct y_p_y : gtl_yes {};
-
- template <typename point_type>
- typename enable_if< typename gtl_and<y_p_y, typename is_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- typename point_coordinate_type<point_type>::type >::type
- y(const point_type& point) {
- return get(point, VERTICAL);
- }
-
- struct y_p_sx : gtl_yes {};
-
- template <typename point_type, typename coordinate_type>
- typename enable_if<typename gtl_and<y_p_sx, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- void>::type
- x(point_type& point, coordinate_type value) {
- set(point, HORIZONTAL, value);
- }
-
- struct y_p_sy : gtl_yes {};
-
- template <typename point_type, typename coordinate_type>
- typename enable_if<typename gtl_and<y_p_sy, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- void>::type
- y(point_type& point, coordinate_type value) {
- set(point, VERTICAL, value);
- }
-
- struct y_pt_equiv : gtl_yes {};
-
- template <typename T, typename T2>
- typename enable_if<typename gtl_and_3<y_pt_equiv,
- typename gtl_same_type<point_concept, typename geometry_concept<T>::type>::type,
- typename is_point_concept<typename geometry_concept<T2>::type>::type>::type,
- bool>::type
- equivalence(const T& point1, const T2& point2) {
- typename point_coordinate_type<T>::type x1 = x(point1);
- typename point_coordinate_type<T2>::type x2 = get(point2, HORIZONTAL);
- typename point_coordinate_type<T>::type y1 = get(point1, VERTICAL);
- typename point_coordinate_type<T2>::type y2 = y(point2);
- return x1 == x2 && y1 == y2;
- }
-
- struct y_pt_man_dist : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<
- y_pt_man_dist,
- typename gtl_same_type<point_concept, typename geometry_concept<point_type_1>::type>::type,
- typename is_point_concept<typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_difference_type<point_type_1>::type>::type
- manhattan_distance(const point_type_1& point1, const point_type_2& point2) {
- return euclidean_distance(point1, point2, HORIZONTAL) + euclidean_distance(point1, point2, VERTICAL);
- }
-
- struct y_pt_ed1 : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<y_pt_ed1, typename is_point_concept<typename geometry_concept<point_type_1>::type>::type,
- typename is_point_concept<typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_difference_type<point_type_1>::type>::type
- euclidean_distance(const point_type_1& point1, const point_type_2& point2, orientation_2d orient) {
- typename coordinate_traits<typename point_coordinate_type<point_type_1>::type>::coordinate_difference return_value =
+struct y_pt_man_dist : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_man_dist,
+ typename is_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+typename point_difference_type<PointType1>::type>::type
+manhattan_distance(const PointType1& point1, const PointType2& point2) {
+ return euclidean_distance(point1, point2, HORIZONTAL) +
+ euclidean_distance(point1, point2, VERTICAL);
+}
+
+struct y_pt_ed1 : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_ed1,
+ typename is_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+typename point_difference_type<PointType1>::type>::type
+euclidean_distance(
+ const PointType1& point1,
+ const PointType2& point2,
+ orientation_2d orient) {
+ typename point_difference_type<PointType1>::type dif =
       get(point1, orient) - get(point2, orient);
- return return_value < 0 ? (typename coordinate_traits<typename point_coordinate_type<point_type_1>::type>::coordinate_difference)-return_value : return_value;
- }
+ return (dif < 0) ? -dif : dif;
+}
 
- struct y_pt_ed2 : gtl_yes {};
+struct y_pt_ed2 : gtl_yes {};
 
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<y_pt_ed2, typename gtl_same_type<point_concept, typename geometry_concept<point_type_1>::type>::type,
- typename gtl_same_type<point_concept, typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_distance_type<point_type_1>::type>::type
- euclidean_distance(const point_type_1& point1, const point_type_2& point2) {
- typedef typename point_coordinate_type<point_type_1>::type Unit;
- return std::sqrt((double)(distance_squared(point1, point2)));
- }
-
- struct y_pt_eds : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<
- y_pt_eds,
- typename is_point_concept<typename geometry_concept<point_type_1>::type>::type,
- typename is_point_concept<typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_difference_type<point_type_1>::type>::type
- distance_squared(const point_type_1& point1, const point_type_2& point2) {
- typedef typename point_coordinate_type<point_type_1>::type Unit;
- typename coordinate_traits<Unit>::coordinate_difference dx = euclidean_distance(point1, point2, HORIZONTAL);
- typename coordinate_traits<Unit>::coordinate_difference dy = euclidean_distance(point1, point2, VERTICAL);
- dx *= dx;
- dy *= dy;
- return dx + dy;
- }
-
- struct y_pt_convolve : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<
- y_pt_convolve,
- typename is_mutable_point_concept<typename geometry_concept<point_type_1>::type>::type,
- typename is_point_concept<typename geometry_concept<point_type_2>::type>::type>::type,
- point_type_1>::type &
- convolve(point_type_1& lvalue, const point_type_2& rvalue) {
- x(lvalue, x(lvalue) + x(rvalue));
- y(lvalue, y(lvalue) + y(rvalue));
- return lvalue;
- }
-
- struct y_pt_deconvolve : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<
- y_pt_deconvolve,
- typename is_mutable_point_concept<typename geometry_concept<point_type_1>::type>::type,
- typename is_point_concept<typename geometry_concept<point_type_2>::type>::type>::type,
- point_type_1>::type &
- deconvolve(point_type_1& lvalue, const point_type_2& rvalue) {
- x(lvalue, x(lvalue) - x(rvalue));
- y(lvalue, y(lvalue) - y(rvalue));
- return lvalue;
- }
-
- struct y_pt_scale_up : gtl_yes {};
-
- template <typename point_type, typename coord_type>
- typename enable_if< typename gtl_and<y_pt_scale_up, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- scale_up(point_type& point, coord_type factor) {
- typedef typename point_coordinate_type<point_type>::type Unit;
- x(point, x(point) * (Unit)factor);
- y(point, y(point) * (Unit)factor);
- return point;
- }
-
- struct y_pt_scale_down : gtl_yes {};
-
- template <typename point_type, typename coord_type>
- typename enable_if< typename gtl_and<y_pt_scale_down, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- scale_down(point_type& point, coord_type factor) {
- typedef typename point_coordinate_type<point_type>::type Unit;
- typedef typename coordinate_traits<Unit>::coordinate_distance dt;
- x(point, scaling_policy<Unit>::round((dt)((dt)(x(point)) / (dt)factor)));
- y(point, scaling_policy<Unit>::round((dt)((dt)(y(point)) / (dt)factor)));
- return point;
- }
-
- struct y_pt_scale : gtl_yes {};
-
- template <typename point_type, typename scaling_type>
- typename enable_if< typename gtl_and<y_pt_scale, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- scale(point_type& point, const scaling_type& scaling) {
- typedef typename point_coordinate_type<point_type>::type Unit;
- Unit x_(x(point)), y_(y(point));
- scaling.scale(x_, y_);
- x(point, x_);
- y(point, y_);
- return point;
- }
-
- struct y_pt_transform : gtl_yes {};
-
- template <typename point_type, typename transformation_type>
- typename enable_if< typename gtl_and<y_pt_transform, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- transform(point_type& point, const transformation_type& transformation) {
- typedef typename point_coordinate_type<point_type>::type Unit;
- Unit x_(x(point)), y_(y(point));
- transformation.transform(x_, y_);
- x(point, x_);
- y(point, y_);
- return point;
- }
-
- struct y_pt_move : gtl_yes {};
-
- template <typename point_type>
- typename enable_if< typename gtl_and<y_pt_move, typename is_mutable_point_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- move(point_type& point, orientation_2d orient,
- typename point_coordinate_type<point_type>::type displacement) {
- typedef typename point_coordinate_type<point_type>::type Unit;
- Unit v(get(point, orient));
- set(point, orient, v + displacement);
- return point;
- }
-
- template <class T>
- template <class T2>
- point_data<T>& point_data<T>::operator=(const T2& rvalue) {
- assign(*this, rvalue);
- return *this;
- }
-
- template <typename T>
- struct geometry_concept<point_data<T> > {
- typedef point_concept type;
- };
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_ed2,
+ typename is_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+typename point_distance_type<PointType1>::type>::type
+euclidean_distance(const PointType1& point1, const PointType2& point2) {
+ return (std::sqrt)(
+ static_cast<double>(distance_squared(point1, point2)));
 }
+
+struct y_pt_eds : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_eds,
+ typename is_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+typename point_difference_type<PointType1>::type>::type
+distance_squared(const PointType1& point1, const PointType2& point2) {
+ typename point_difference_type<PointType1>::type dx =
+ euclidean_distance(point1, point2, HORIZONTAL);
+ typename point_difference_type<PointType1>::type dy =
+ euclidean_distance(point1, point2, VERTICAL);
+ dx *= dx;
+ dy *= dy;
+ return dx + dy;
 }
-#endif
+
+struct y_pt_convolve : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_convolve,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+PointType1>::type& convolve(PointType1& lvalue, const PointType2& rvalue) {
+ x(lvalue, x(lvalue) + x(rvalue));
+ y(lvalue, y(lvalue) + y(rvalue));
+ return lvalue;
+}
+
+struct y_pt_deconvolve : gtl_yes {};
+
+template <typename PointType1, typename PointType2>
+typename enable_if<
+ typename gtl_and_3<
+ y_pt_deconvolve,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType1>::type
+ >::type,
+ typename is_point_concept<
+ typename geometry_concept<PointType2>::type
+ >::type
+ >::type,
+PointType1>::type& deconvolve(PointType1& lvalue, const PointType2& rvalue) {
+ x(lvalue, x(lvalue) - x(rvalue));
+ y(lvalue, y(lvalue) - y(rvalue));
+ return lvalue;
+}
+
+struct y_pt_scale_up : gtl_yes {};
+
+template <typename PointType, typename CType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_scale_up,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+PointType>::type& scale_up(PointType& point, CType factor) {
+ typedef typename point_coordinate_type<PointType>::type Unit;
+ x(point, x(point) * (Unit)factor);
+ y(point, y(point) * (Unit)factor);
+ return point;
+}
+
+struct y_pt_scale_down : gtl_yes {};
+
+template <typename PointType, typename CType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_scale_down,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+PointType>::type& scale_down(PointType& point, CType factor) {
+ typedef typename point_coordinate_type<PointType>::type Unit;
+ typedef typename coordinate_traits<Unit>::coordinate_distance dt;
+ x(point, scaling_policy<Unit>::round((dt)(x(point)) / (dt)factor));
+ y(point, scaling_policy<Unit>::round((dt)(y(point)) / (dt)factor));
+ return point;
+}
+
+struct y_pt_scale : gtl_yes {};
+
+template <typename PointType, typename ScaleType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_scale,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+PointType>::type& scale(PointType& point, const ScaleType& scaling) {
+ typedef typename point_coordinate_type<PointType>::type Unit;
+ Unit x_coord(x(point));
+ Unit y_coord(y(point));
+ scaling.scale(x_coord, y_coord);
+ x(point, x_coord);
+ y(point, y_coord);
+ return point;
+}
+
+struct y_pt_transform : gtl_yes {};
+
+template <typename PointType, typename TransformType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_transform,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+PointType>::type& transform(PointType& point, const TransformType& transform) {
+ typedef typename point_coordinate_type<PointType>::type Unit;
+ Unit x_coord(x(point));
+ Unit y_coord(y(point));
+ transform.transform(x_coord, y_coord);
+ x(point, x_coord);
+ y(point, y_coord);
+ return point;
+}
+
+struct y_pt_move : gtl_yes {};
+
+template <typename PointType>
+typename enable_if<
+ typename gtl_and<
+ y_pt_move,
+ typename is_mutable_point_concept<
+ typename geometry_concept<PointType>::type
+ >::type
+ >::type,
+PointType>::type& move(PointType& point, orientation_2d orient,
+ typename point_coordinate_type<PointType>::type displacement) {
+ typedef typename point_coordinate_type<PointType>::type Unit;
+ Unit coord = get(point, orient);
+ set(point, orient, coord + displacement);
+ return point;
+}
+} // polygon
+} // boost
+
+#endif // BOOST_POLYGON_POINT_CONCEPT_HPP

Modified: trunk/boost/polygon/point_data.hpp
==============================================================================
--- trunk/boost/polygon/point_data.hpp (original)
+++ trunk/boost/polygon/point_data.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,104 +1,129 @@
-/*
- Copyright 2008 Intel Corporation
+// Boost.Polygon library point_data.hpp header file
 
- Use, modification and distribution are 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 GTLPOINT_DATA_HPP
-#define GTLPOINT_DATA_HPP
+// Copyright 2008 Intel Corporation.
+// Copyright Simonson Lucanus 2008-2012.
+// Copyright Andrii Sydorchuk 2012-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.
+
+#ifndef BOOST_POLYGON_POINT_DATA_HPP
+#define BOOST_POLYGON_POINT_DATA_HPP
 
 #include "isotropy.hpp"
+#include "point_concept.hpp"
+
+namespace boost {
+namespace polygon {
+
+template <typename T>
+class point_data {
+ public:
+ typedef T coordinate_type;
+
+ point_data() : coords_() {}
+
+ point_data(coordinate_type x, coordinate_type y) {
+ coords_[HORIZONTAL] = x;
+ coords_[VERTICAL] = y;
+ }
+
+ explicit point_data(const point_data& that) {
+ coords_[0] = that.coords_[0];
+ coords_[1] = that.coords_[1];
+ }
+
+ point_data& operator=(const point_data& that) {
+ coords_[0] = that.coords_[0];
+ coords_[1] = that.coords_[1];
+ return *this;
+ }
+
+ // TODO(asydorchuk): Deprecated.
+ template <typename PointType>
+ explicit point_data(const PointType& that) {
+ *this = that;
+ }
+
+ // TODO(asydorchuk): Deprecated.
+ template <typename PointType>
+ point_data& operator=(const PointType& that) {
+ assign(*this, that);
+ return *this;
+ }
+
+ // TODO(asydorchuk): Deprecated.
+ template <typename CT>
+ point_data(const point_data<CT>& that) {
+ coords_[HORIZONTAL] = (coordinate_type)that.x();
+ coords_[VERTICAL] = (coordinate_type)that.y();
+ }
+
+ bool operator==(const point_data& that) const {
+ return (coords_[0] == that.coords_[0]) &&
+ (coords_[1] == that.coords_[1]);
+ }
+
+ bool operator!=(const point_data& that) const {
+ return !(*this == that);
+ }
+
+ bool operator<(const point_data& that) const {
+ return (coords_[0] < that.coords_[0]) ||
+ ((coords_[0] == that.coords_[0]) &&
+ (coords_[1] < that.coords_[1]));
+ }
+
+ bool operator<=(const point_data& that) const {
+ return !(that < *this);
+ }
+
+ bool operator>(const point_data& that) const {
+ return that < *this;
+ }
+
+ bool operator>=(const point_data& that) const {
+ return !(*this < that);
+ }
+
+ coordinate_type get(orientation_2d orient) const {
+ return coords_[orient.to_int()];
+ }
+
+ void set(orientation_2d orient, coordinate_type value) {
+ coords_[orient.to_int()] = value;
+ }
+
+ coordinate_type x() const {
+ return coords_[HORIZONTAL];
+ }
+
+ coordinate_type y() const {
+ return coords_[VERTICAL];
+ }
+
+ point_data& x(coordinate_type value) {
+ coords_[HORIZONTAL] = value;
+ return *this;
+ }
+
+ point_data& y(coordinate_type value) {
+ coords_[VERTICAL] = value;
+ return *this;
+ }
+
+ private:
+ coordinate_type coords_[2];
+};
+
 
-namespace boost { namespace polygon{
+template <typename CType>
+struct geometry_concept< point_data<CType> > {
+ typedef point_concept type;
+};
+} // polygon
+} // boost
 
- template <typename T>
- class point_data {
- public:
- typedef T coordinate_type;
- inline point_data()
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- {}
- inline point_data(coordinate_type x, coordinate_type y)
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- {
- coords_[HORIZONTAL] = x; coords_[VERTICAL] = y;
- }
- inline point_data(const point_data& that)
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- { (*this) = that; }
- template <typename other>
- point_data(const other& that)
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- { (*this) = that; }
- inline point_data& operator=(const point_data& that) {
- coords_[0] = that.coords_[0]; coords_[1] = that.coords_[1]; return *this;
- }
- template<typename T1, typename T2>
- inline point_data(const T1& x, const T2& y)
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- {
- coords_[HORIZONTAL] = (coordinate_type)x;
- coords_[VERTICAL] = (coordinate_type)y;
- }
- template <typename T2>
- inline point_data(const point_data<T2>& rvalue)
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- {
- coords_[HORIZONTAL] = (coordinate_type)(rvalue.x());
- coords_[VERTICAL] = (coordinate_type)(rvalue.y());
- }
- template <typename T2>
- inline point_data& operator=(const T2& rvalue);
- inline bool operator==(const point_data& that) const {
- return coords_[0] == that.coords_[0] && coords_[1] == that.coords_[1];
- }
- inline bool operator!=(const point_data& that) const {
- return !((*this) == that);
- }
- inline bool operator<(const point_data& that) const {
- return coords_[0] < that.coords_[0] ||
- (coords_[0] == that.coords_[0] && coords_[1] < that.coords_[1]);
- }
- inline bool operator<=(const point_data& that) const { return !(that < *this); }
- inline bool operator>(const point_data& that) const { return that < *this; }
- inline bool operator>=(const point_data& that) const { return !((*this) < that); }
- inline coordinate_type get(orientation_2d orient) const {
- return coords_[orient.to_int()];
- }
- inline void set(orientation_2d orient, coordinate_type value) {
- coords_[orient.to_int()] = value;
- }
- inline coordinate_type x() const {
- return coords_[HORIZONTAL];
- }
- inline coordinate_type y() const {
- return coords_[VERTICAL];
- }
- inline point_data& x(coordinate_type value) {
- coords_[HORIZONTAL] = value;
- return *this;
- }
- inline point_data& y(coordinate_type value) {
- coords_[VERTICAL] = value;
- return *this;
- }
- private:
- coordinate_type coords_[2];
- };
-
-}
-}
-#endif
+#endif // BOOST_POLYGON_POINT_DATA_HPP

Modified: trunk/boost/polygon/point_traits.hpp
==============================================================================
--- trunk/boost/polygon/point_traits.hpp (original)
+++ trunk/boost/polygon/point_traits.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,34 +1,48 @@
-/*
- Copyright 2008 Intel Corporation
+// Boost.Polygon library point_traits.hpp header file
+
+// Copyright 2008 Intel Corporation.
+// Copyright Simonson Lucanus 2008-2012.
+// Copyright Andrii Sydorchuk 2012-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.
 
- Use, modification and distribution are 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_POLYGON_POINT_TRAITS_HPP
 #define BOOST_POLYGON_POINT_TRAITS_HPP
 
 #include "isotropy.hpp"
 
-namespace boost { namespace polygon{
- template <typename T>
- struct point_traits {
- typedef typename T::coordinate_type coordinate_type;
-
- static inline coordinate_type get(const T& point, orientation_2d orient) {
- return point.get(orient);
- }
- };
-
- template <typename T>
- struct point_mutable_traits {
- static inline void set(T& point, orientation_2d orient, typename point_traits<T>::coordinate_type value) {
- point.set(orient, value);
- }
- static inline T construct(typename point_traits<T>::coordinate_type x_value, typename point_traits<T>::coordinate_type y_value) {
- return T(x_value, y_value);
- }
- };
-}
-}
-#endif
+namespace boost {
+namespace polygon {
+
+template <typename PointType>
+struct point_traits {
+ typedef PointType point_type;
+ typedef typename point_type::coordinate_type coordinate_type;
+
+ static coordinate_type get(
+ const point_type& point, orientation_2d orient) {
+ return point.get(orient);
+ }
+};
+
+template <typename PointType>
+struct point_mutable_traits {
+ typedef PointType point_type;
+ typedef typename point_type::coordinate_type coordinate_type;
+
+ static void set(
+ point_type& point, orientation_2d orient, coordinate_type value) {
+ point.set(orient, value);
+ }
+
+ static point_type construct(coordinate_type x, coordinate_type y) {
+ return point_type(x, y);
+ }
+};
+} // polygon
+} // boost
+
+#endif // BOOST_POLYGON_POINT_TRAITS_HPP

Modified: trunk/boost/polygon/segment_concept.hpp
==============================================================================
--- trunk/boost/polygon/segment_concept.hpp (original)
+++ trunk/boost/polygon/segment_concept.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,23 +1,27 @@
-/*
- Copyright 2008 Intel Corporation
+// Boost.Polygon library segment_concept.hpp header file
+
+// Copyright 2008 Intel Corporation.
+// Copyright Simonson Lucanus 2008-2012.
+// Copyright Andrii Sydorchuk 2012-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.
 
- Use, modification and distribution are 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_POLYGON_SEGMENT_CONCEPT_HPP
 #define BOOST_POLYGON_SEGMENT_CONCEPT_HPP
 
 #include "isotropy.hpp"
-#include "segment_data.hpp"
 #include "segment_traits.hpp"
 #include "rectangle_concept.hpp"
 
 namespace boost {
 namespace polygon {
+
 struct segment_concept {};
 
-template <typename Segment>
+template <typename ConceptType>
 struct is_segment_concept {
   typedef gtl_no type;
 };
@@ -27,7 +31,7 @@
   typedef gtl_yes type;
 };
 
-template <typename Segment>
+template <typename ConceptType>
 struct is_mutable_segment_concept {
   typedef gtl_no type;
 };
@@ -37,64 +41,64 @@
   typedef gtl_yes type;
 };
 
-template <typename Segment, typename CT>
+template <typename GeometryType, typename BoolType>
 struct segment_distance_type_by_concept {
   typedef void type;
 };
 
-template <typename Segment>
-struct segment_distance_type_by_concept<Segment, gtl_yes> {
+template <typename GeometryType>
+struct segment_distance_type_by_concept<GeometryType, gtl_yes> {
   typedef typename coordinate_traits<
- typename segment_traits<Segment>::coordinate_type
+ typename segment_traits<GeometryType>::coordinate_type
>::coordinate_distance type;
 };
 
-template <typename Segment>
+template <typename GeometryType>
 struct segment_distance_type {
   typedef typename segment_distance_type_by_concept<
- Segment,
+ GeometryType,
     typename is_segment_concept<
- typename geometry_concept<Segment>::type
+ typename geometry_concept<GeometryType>::type
>::type
>::type type;
 };
 
-template <typename Segment, typename CT>
+template <typename GeometryType, typename BoolType>
 struct segment_point_type_by_concept {
   typedef void type;
 };
 
-template <typename Segment>
-struct segment_point_type_by_concept<Segment, gtl_yes> {
- typedef typename segment_traits<Segment>::point_type type;
+template <typename GeometryType>
+struct segment_point_type_by_concept<GeometryType, gtl_yes> {
+ typedef typename segment_traits<GeometryType>::point_type type;
 };
 
-template <typename Segment>
+template <typename GeometryType>
 struct segment_point_type {
   typedef typename segment_point_type_by_concept<
- Segment,
+ GeometryType,
     typename is_segment_concept<
- typename geometry_concept<Segment>::type
+ typename geometry_concept<GeometryType>::type
>::type
>::type type;
 };
 
-template <typename Segment, typename CT>
+template <typename GeometryType, typename BoolType>
 struct segment_coordinate_type_by_concept {
   typedef void type;
 };
 
-template <typename Segment>
-struct segment_coordinate_type_by_concept<Segment, gtl_yes> {
- typedef typename segment_traits<Segment>::coordinate_type type;
+template <typename GeometryType>
+struct segment_coordinate_type_by_concept<GeometryType, gtl_yes> {
+ typedef typename segment_traits<GeometryType>::coordinate_type type;
 };
 
-template <typename Segment>
+template <typename GeometryType>
 struct segment_coordinate_type {
   typedef typename segment_coordinate_type_by_concept<
- Segment,
+ GeometryType,
     typename is_segment_concept<
- typename geometry_concept<Segment>::type
+ typename geometry_concept<GeometryType>::type
>::type
>::type type;
 };
@@ -109,8 +113,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<Segment>::type
->::type
+typename segment_point_type<Segment>::type>::type
 get(const Segment& segment, direction_1d dir) {
   return segment_traits<Segment>::get(segment, dir);
 }
@@ -128,9 +131,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- void
->::type
-set(Segment& segment, direction_1d dir, const Point& point) {
+void>::type set(Segment& segment, direction_1d dir, const Point& point) {
   segment_mutable_traits<Segment>::set(segment, dir, point);
 }
 
@@ -150,9 +151,7 @@
       typename geometry_concept<Point2>::type
>::type
>::type,
- Segment
->::type
-construct(const Point1& low, const Point2& high) {
+Segment>::type construct(const Point1& low, const Point2& high) {
   return segment_mutable_traits<Segment>::construct(low, high);
 }
 
@@ -169,9 +168,7 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- Segment1
->::type
-copy_construct(const Segment2& segment) {
+Segment1>::type copy_construct(const Segment2& segment) {
   return construct<Segment1>(get(segment, LOW), get(segment, HIGH));
 }
 
@@ -188,9 +185,7 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- Segment1
->::type &
-assign(Segment1& segment1, const Segment2& segment2) {
+Segment1>::type& assign(Segment1& segment1, const Segment2& segment2) {
   return segment1 = copy_construct<Segment1>(segment2);
 }
 
@@ -207,9 +202,7 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- bool
->::type
-equivalence(const Segment1& segment1, const Segment2& segment2) {
+bool>::type equivalence(const Segment1& segment1, const Segment2& segment2) {
   return get(segment1, LOW) == get(segment2, LOW) &&
          get(segment1, HIGH) == get(segment2, HIGH);
 }
@@ -224,9 +217,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<Segment>::type
->::type
-low(const Segment& segment) {
+typename segment_point_type<Segment>::type>::type low(const Segment& segment) {
   return get(segment, LOW);
 }
 
@@ -240,9 +231,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<Segment>::type
->::type
-high(const Segment& segment) {
+typename segment_point_type<Segment>::type>::type high(const Segment& segment) {
   return get(segment, HIGH);
 }
 
@@ -256,8 +245,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_point_type<Segment>::type
->::type
+typename segment_point_type<Segment>::type>::type
 center(const Segment& segment) {
   return construct<typename segment_point_type<Segment>::type>(
       (x(high(segment)) + x(low(segment)))/2,
@@ -277,9 +265,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- void
->::type
-low(Segment& segment, const Point& point) {
+void>::type low(Segment& segment, const Point& point) {
   set(segment, LOW, point);
 }
 
@@ -296,9 +282,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- void
->::type
-high(Segment& segment, const Point& point) {
+void>::type high(Segment& segment, const Point& point) {
   set(segment, HIGH, point);
 }
 
@@ -316,9 +300,7 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- int
->::type
-orientation(const Segment1& segment1, const Segment2& segment2) {
+int>::type orientation(const Segment1& segment1, const Segment2& segment2) {
   typedef typename coordinate_traits<
     typename segment_traits<Segment1>::coordinate_type
>::manhattan_area_type int_x2;
@@ -360,9 +342,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- int
->::type
-orientation(const Segment& segment, const Point& point) {
+int>::type orientation(const Segment& segment, const Point& point) {
   Segment segment2 = construct<Segment>(high(segment), point);
   return orientation(segment, segment2);
 }
@@ -380,11 +360,8 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- bool
->::type
-contains(const Segment& segment,
- const Point& point,
- bool consider_touch = true ) {
+bool>::type contains(const Segment& segment,
+ const Point& point, bool consider_touch = true ) {
   if (orientation(segment, point))
     return false;
   rectangle_data<typename segment_coordinate_type<Segment>::type> rect;
@@ -411,11 +388,8 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- bool
->::type
-contains(const Segment1& segment1,
- const Segment2& segment2,
- bool consider_touch = true) {
+bool>::type contains(const Segment1& segment1,
+ const Segment2& segment2, bool consider_touch = true) {
   return contains(segment1, get(segment2, LOW), consider_touch) &&
          contains(segment1, get(segment2, HIGH), consider_touch);
 }
@@ -430,8 +404,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- typename segment_distance_type<Segment>::type
->::type
+typename segment_distance_type<Segment>::type>::type
 length(const Segment& segment) {
   return euclidean_distance(low(segment), high(segment));
 }
@@ -446,12 +419,10 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- Segment
->::type &
-scale_up(Segment& segment,
- typename coordinate_traits<
- typename segment_coordinate_type<Segment>::type
- >::unsigned_area_type factor) {
+Segment>::type& scale_up(Segment& segment,
+ typename coordinate_traits<
+ typename segment_coordinate_type<Segment>::type
+ >::unsigned_area_type factor) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, scale_up(l, factor));
@@ -469,12 +440,10 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- Segment
->::type &
-scale_down(Segment& segment,
- typename coordinate_traits<
- typename segment_coordinate_type<Segment>::type
- >::unsigned_area_type factor) {
+Segment>::type& scale_down(Segment& segment,
+ typename coordinate_traits<
+ typename segment_coordinate_type<Segment>::type
+ >::unsigned_area_type factor) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, scale_down(l, factor));
@@ -492,9 +461,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- Segment
->::type &
-scale(Segment& segment, const Scale& sc) {
+Segment>::type& scale(Segment& segment, const Scale& sc) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, scale(l, sc));
@@ -512,9 +479,7 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- Segment
->::type &
-transform(Segment& segment, const Transform& tr) {
+Segment>::type& transform(Segment& segment, const Transform& tr) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, transform(l, tr));
@@ -532,10 +497,8 @@
       typename geometry_concept<Segment>::type
>::type
>::type,
- Segment
->::type &
-move(Segment& segment, orientation_2d orient,
- typename segment_coordinate_type<Segment>::type displacement) {
+Segment>::type& move(Segment& segment, orientation_2d orient,
+ typename segment_coordinate_type<Segment>::type displacement) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, move(l, orient, displacement));
@@ -556,9 +519,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- Segment
->::type &
-convolve(Segment& segment, const Point& point) {
+Segment>::type& convolve(Segment& segment, const Point& point) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, convolve(l, point));
@@ -579,9 +540,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- Segment
->::type &
-deconvolve(Segment& segment, const Point& point) {
+Segment>::type& deconvolve(Segment& segment, const Point& point) {
   typename segment_point_type<Segment>::type l = low(segment);
   typename segment_point_type<Segment>::type h = high(segment);
   low(segment, deconvolve(l, point));
@@ -602,9 +561,8 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- bool
->::type
-abuts(const Segment1& segment1, const Segment2& segment2, direction_1d dir) {
+bool>::type abuts(const Segment1& segment1,
+ const Segment2& segment2, direction_1d dir) {
   return dir.to_int() ? equivalence(low(segment2) , high(segment1)) :
                         equivalence(low(segment1) , high(segment2));
 }
@@ -622,9 +580,7 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- bool
->::type
-abuts(const Segment1& segment1, const Segment2& segment2) {
+bool>::type abuts(const Segment1& segment1, const Segment2& segment2) {
   return abuts(segment1, segment2, HIGH) || abuts(segment1, segment2, LOW);
 }
 
@@ -641,10 +597,9 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- bool
->::type
-intersects(const Segment1& segment1, const Segment2& segment2,
- bool consider_touch = true) {
+bool
+>::type intersects(const Segment1& segment1, const Segment2& segment2,
+ bool consider_touch = true) {
   rectangle_data<typename segment_coordinate_type<Segment1>::type> rect1, rect2;
   set_points(rect1, low(segment1), high(segment1));
   set_points(rect2, low(segment2), high(segment2));
@@ -680,8 +635,7 @@
       typename geometry_concept<Point>::type
>::type
>::type,
- typename segment_distance_type<Segment>::type
->::type
+typename segment_distance_type<Segment>::type>::type
 euclidean_distance(const Segment& segment, const Point& point) {
   typedef typename segment_distance_type<Segment>::type Unit;
   Unit x1 = x(low(segment));
@@ -721,8 +675,7 @@
       typename geometry_concept<Segment2>::type
>::type
>::type,
- typename segment_distance_type<Segment1>::type
->::type
+typename segment_distance_type<Segment1>::type>::type
 euclidean_distance(const Segment1& segment1, const Segment2& segment2) {
   if (intersects(segment1, segment2))
     return 0.0;
@@ -737,18 +690,7 @@
     result3 = result4;
   return (result1 < result3) ? result1 : result3;
 }
+} // polygon
+} // boost
 
-template <class T>
-template <class Segment>
-segment_data<T>& segment_data<T>::operator=(const Segment& rvalue) {
- assign(*this, rvalue);
- return *this;
-}
-
-template <typename T>
-struct geometry_concept<segment_data<T> > {
- typedef segment_concept type;
-};
-}
-}
-#endif
+#endif // BOOST_POLYGON_SEGMENT_CONCEPT_HPP

Modified: trunk/boost/polygon/segment_data.hpp
==============================================================================
--- trunk/boost/polygon/segment_data.hpp (original)
+++ trunk/boost/polygon/segment_data.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,108 +1,111 @@
-/*
- Copyright 2008 Intel Corporation
+// Boost.Polygon library segment_data.hpp header file
+
+// Copyright 2008 Intel Corporation.
+// Copyright Simonson Lucanus 2008-2012.
+// Copyright Andrii Sydorchuk 2012-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.
 
- Use, modification and distribution are 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_POLYGON_SEGMENT_DATA_HPP
 #define BOOST_POLYGON_SEGMENT_DATA_HPP
 
 #include "isotropy.hpp"
+#include "segment_concept.hpp"
 
 namespace boost {
 namespace polygon {
+
 template <typename T>
 class segment_data {
  public:
   typedef T coordinate_type;
   typedef point_data<T> point_type;
 
- inline segment_data()
-#ifndef BOOST_POLYGON_MSVC
- :points_()
-#endif
- {}
-
- inline segment_data(const point_type& low, const point_type& high)
-#ifndef BOOST_POLYGON_MSVC
- :points_()
-#endif
- {
+ segment_data() : points_() {}
+
+ segment_data(const point_type& low, const point_type& high) {
     points_[LOW] = low;
     points_[HIGH] = high;
   }
 
- inline segment_data(const segment_data& that)
-#ifndef BOOST_POLYGON_MSVC
- :points_()
-#endif
- {
- (*this) = that;
+ segment_data(const segment_data& that) {
+ points_[0] = that.points_[0];
+ points_[1] = that.points_[1];
   }
 
- inline segment_data& operator=(const segment_data& that) {
+ segment_data& operator=(const segment_data& that) {
     points_[0] = that.points_[0];
     points_[1] = that.points_[1];
     return *this;
   }
 
- template <typename Segment>
- inline segment_data& operator=(const Segment& that);
-
- inline point_type get(direction_1d dir) const {
+ point_type get(direction_1d dir) const {
     return points_[dir.to_int()];
   }
 
- inline void set(direction_1d dir, const point_type& point) {
+ void set(direction_1d dir, const point_type& point) {
     points_[dir.to_int()] = point;
   }
 
- inline point_type low() const { return points_[0]; }
+ point_type low() const {
+ return points_[LOW];
+ }
 
- inline segment_data& low(const point_type& point) {
- points_[0] = point;
+ segment_data& low(const point_type& point) {
+ points_[LOW] = point;
     return *this;
   }
 
- inline point_type high() const {return points_[1]; }
+ point_type high() const {
+ return points_[HIGH];
+ }
 
- inline segment_data& high(const point_type& point) {
- points_[1] = point;
+ segment_data& high(const point_type& point) {
+ points_[HIGH] = point;
     return *this;
   }
 
- inline bool operator==(const segment_data& that) const {
- return low() == that.low() && high() == that.high();
+ bool operator==(const segment_data& that) const {
+ return (points_[0] == that.points_[0]) &&
+ (points_[1] == that.points_[1]);
   }
 
- inline bool operator!=(const segment_data& that) const {
- return low() != that.low() || high() != that.high();
+ bool operator!=(const segment_data& that) const {
+ return (points_[0] != that.points_[0]) ||
+ (points_[1] != that.points_[1]);
   }
 
- inline bool operator<(const segment_data& that) const {
- if (points_[0] < that.points_[0])
- return true;
- if (points_[0] > that.points_[0])
- return false;
+ bool operator<(const segment_data& that) const {
+ if (points_[0] != that.points_[0]) {
+ points_[0] < that.points_[0];
+ }
     return points_[1] < that.points_[1];
   }
 
- inline bool operator<=(const segment_data& that) const {
+ bool operator<=(const segment_data& that) const {
     return !(that < *this);
   }
 
- inline bool operator>(const segment_data& that) const {
+ bool operator>(const segment_data& that) const {
     return that < *this;
   }
 
- inline bool operator>=(const segment_data& that) const {
+ bool operator>=(const segment_data& that) const {
     return !((*this) < that);
   }
 
  private:
   point_type points_[2];
 };
-}
-}
-#endif
+
+template <typename CType>
+struct geometry_concept<segment_data<CType> > {
+ typedef segment_concept type;
+};
+} // polygon
+} // boost
+
+#endif // BOOST_POLYGON_SEGMENT_DATA_HPP

Modified: trunk/boost/polygon/segment_traits.hpp
==============================================================================
--- trunk/boost/polygon/segment_traits.hpp (original)
+++ trunk/boost/polygon/segment_traits.hpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,38 +1,50 @@
-/*
- Copyright 2008 Intel Corporation
+// Boost.Polygon library segment_traits.hpp header file
+
+// Copyright 2008 Intel Corporation.
+// Copyright Simonson Lucanus 2008-2012.
+// Copyright Andrii Sydorchuk 2012-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.
 
- Use, modification and distribution are 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_POLYGON_SEGMENT_TRAITS_HPP
 #define BOOST_POLYGON_SEGMENT_TRAITS_HPP
+
+#include "isotropy.hpp"
+
 namespace boost {
 namespace polygon {
- template <typename Segment>
- struct segment_traits {
- typedef typename Segment::coordinate_type coordinate_type;
- typedef typename Segment::point_type point_type;
-
- static inline point_type get(const Segment& segment, direction_1d dir) {
- return segment.get(dir);
- }
- };
-
- template <typename Segment>
- struct segment_mutable_traits {
- typedef typename segment_traits<Segment>::point_type point_type;
-
- static inline void set(
- Segment& segment, direction_1d dir, const point_type& point) {
- segment.set(dir, point);
- }
-
- static inline Segment construct(
- const point_type& low, const point_type& high) {
- return Segment(low, high);
- }
- };
-}
-}
-#endif
+
+template <typename Segment>
+struct segment_traits {
+ typedef Segment segment_type;
+ typedef typename segment_type::point_type point_type;
+ typedef typename segment_type::coordinate_type coordinate_type;
+
+ static point_type get(
+ const segment_type& segment, direction_1d dir) {
+ return segment.get(dir);
+ }
+};
+
+template <typename Segment>
+struct segment_mutable_traits {
+ typedef Segment segment_type;
+ typedef typename segment_type::point_type point_type;
+ typedef typename segment_type::coordinate_type coordinate_type;
+
+ static void set(
+ segment_type& segment, direction_1d dir, const point_type& point) {
+ segment.set(dir, point);
+ }
+
+ static segment_type construct(const point_type& low, const point_type& high) {
+ return segment_type(low, high);
+ }
+};
+} // polygon
+} // boost
+
+#endif // BOOST_POLYGON_SEGMENT_TRAITS_HPP

Modified: trunk/libs/polygon/doc/gtl_point_concept.htm
==============================================================================
--- trunk/libs/polygon/doc/gtl_point_concept.htm (original)
+++ trunk/libs/polygon/doc/gtl_point_concept.htm 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -1,12 +1,13 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en"><head>
-<!--
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en"><head><!--
     Copyright 2009-2010 Intel Corporation
     license banner
 --><title>Boost Polygon Library: Point Concept</title>
 
 
 
+
+
     <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" /><!-- <link type="text/css" rel="stylesheet" href="adobe_source.css"> --></head><body><table style="margin: 0pt; padding: 0pt; width: 100%;" border="0" cellpadding="0" cellspacing="0"><tbody><tr>
 <td style="background-color: rgb(238, 238, 238);" nowrap="1" valign="top">
     <div style="padding: 5px;" align="center">
@@ -89,22 +90,22 @@
 point&nbsp; concept.</p><p>
 <font face="Courier New">template &lt;&gt;<br />
 struct geometry_concept&lt;CPoint&gt; { typedef point_concept type; };</font></p><p>
-<font face="Times New Roman">The semantic of a point is that it has an x and y
+The semantic of a point is that it has an x and y
 coordinate.&nbsp; A std::pair&lt;int, int&gt;, boost::tuple&lt;int, int&gt; or boost::array&lt;int, 2&gt;
 could all be made models of point by simply providing indirect access to their
 elements through traits, however, these objects cannot be made a model of both
 point and interval in the same compilation unit, for obvious reason that
 duplicate specialization of the geometry_concept struct is illegal, but also
 because it would make overloading generic function by concept ambiguous if a
-type modeled more than one concept.</font></p><p>
-<font face="Times New Roman">Below is shown the default point traits.&nbsp;
+type modeled more than one concept.</p><p>
+Below is shown the default point traits.&nbsp;
 Specialization of these traits is required for types that don't conform to the
-default behavior.</font></p><p>
+default behavior.</p><p>
 template &lt;typename T&gt;<br />
 struct point_traits {<br />
 &nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::coordinate_type coordinate_type;<br />
 <br />
-&nbsp;&nbsp;&nbsp;&nbsp; static inline coordinate_type get(const T&amp; point,
+&nbsp;&nbsp;&nbsp;&nbsp; static coordinate_type get(const T&amp; point,
 orientation_2d orient) {<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return point.get(orient);
 <br />
@@ -113,12 +114,12 @@
 <br />
 template &lt;typename T&gt;<br />
 struct point_mutable_traits {<br />
-&nbsp;&nbsp;&nbsp;&nbsp; static inline void set(T&amp; point, orientation_2d orient,
+&nbsp;&nbsp;&nbsp;&nbsp; static void set(T&amp; point, orientation_2d orient,
 typename point_traits&lt;T&gt;::coordinate_type value) {<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point.set(orient, value);
 <br />
 &nbsp;&nbsp;&nbsp;&nbsp; }<br />
-&nbsp;&nbsp;&nbsp;&nbsp; static inline T construct(typename point_traits&lt;T&gt;::coordinate_type
+&nbsp;&nbsp;&nbsp;&nbsp; static T construct(typename point_traits&lt;T&gt;::coordinate_type
 x_value, typename point_traits&lt;T&gt;::coordinate_type y_value) {<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return T(x_value, y_value);
 <br />
@@ -129,91 +130,91 @@
                 user defined point class to the library point_concept</p><h2>Functions</h2>
 <table id="table1" border="1" width="100%">
         <tbody><tr>
- <td width="586"><font face="Courier New">template &lt;typename T&gt;<br />
- coordinate_type <b>get</b>(const T&amp; point, orientation_2d)</font></td>
- <td><font face="Times New Roman">Expects a model of point.&nbsp; Returns
+ <td width="586"><font face="Courier New">template &lt;typename PointType&gt;<br />
+ coordinate_type <b>get</b>(const PointType&amp; point,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orientation_2d)</font></td>
+ <td>Expects a model of point. Returns
                 the x or y coordinate of the point, depending on the orientation_2d
- value.</font><font face="Courier New"><br />
-&nbsp;</font></td>
+ value.<br />
+
+&nbsp;</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T, typename
- coordinate_type&gt;<br />
- void <b>set</b>(T&amp; point, orientation_2d, coordinate_type)</font></td>
- <td><font face="Times New Roman">Expects a model of point.&nbsp;&nbsp;
- Sets the x or y coordinate of the point to the coordinate, depending on
- the orientation_2d&nbsp; value. </font></td>
+ <td width="586"><font face="Courier New">template &lt;typename PointType&gt;<br />
+ void <b>set</b>(PointType&amp; point, orientation_2d,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_type)</font></td>
+ <td>Expects a model of point. Sets the x or y coordinate of the point to the coordinate, depending on
+ the orientation_2d&nbsp; value. </td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T&gt;<br />
- T <b>construct</b>(coordinate_type x, coordinate_type y)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename PointType&gt;<br />PointType <b>construct</b>(coordinate_type x,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_type y)</font></td>
                 <td>Construct an object that is a model of point given x and y
                 coordinate values.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T1, typename
- T2&gt;<br />
- T1&amp; <b>assign</b>(T1&amp; left, const T2&amp; right)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename PointType1, typename PointType2&gt;<br />
+ PointType1&amp; <b>assign</b>(PointType1&amp; left,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const PointType2&amp; right)</font></td>
                 <td>Copies data from right object that models point into left object
                 that models point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T, typename
- T2&gt;<br />
- bool <b>equivalence</b>(const T&amp; point1, const T2&amp; point2)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename PointType1, typename PointType2&gt;<br />
+ bool <b>equivalence</b>(const </font><font face="Courier New">PointType1</font><font face="Courier New">&amp; point1,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">PointType2</font><font face="Courier New">&amp; point2)</font></td>
                 <td>Given two objects that model point, compares and returns true if
                 their x and y values are respectively equal to each other.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- coordinate_type <b>x</b>(const point_type&amp; point)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename PointType&gt;<br />
+ coordinate_type <b>x</b>(const </font><font face="Courier New">PointType</font><font face="Courier New">&amp; point)</font></td>
                 <td>Returns the x coordinate of an object that models point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- coordinate_type <b>y</b>(const point_type&amp; point)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">&gt;<br />
+ coordinate_type <b>y</b>(const </font><font face="Courier New">PointType</font><font face="Courier New">&amp; point)</font></td>
                 <td>Returns the y coordinate of an object that models point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- void <b>x</b>(point_type&amp; point, coordinate_type )</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">&gt;<br />
+ void <b>x</b>(p</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point, coordinate_type )</font></td>
                 <td>Sets the x coordinate of the object that models point to the
                 coordinate value.&nbsp; </td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- void <b>y</b>(point_type&amp; point, coordinate_type )</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">&gt;<br />
+ void <b>y</b>(</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point, coordinate_type )</font></td>
                 <td>Sets the y coordinate of the object that models point to the
                 coordinate value.&nbsp; </td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- point_type&amp; <b>scale_up</b>(point_type&amp; point, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">&gt;<br />
+ point_type&amp; <b>scale_up</b>(</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 unsigned_area_type factor)</font></td>
                 <td>Multiplies x and y coordinate of an object that models point by
                 unsigned factor.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- point_type&amp; <b>scale_down</b>(point_type&amp; point, <br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">&gt;<br />
+ point_type&amp; <b>scale_down</b>(</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 unsigned_area_type factor)</font></td>
                 <td>Divides x and y coordinate of an object that models point by
                 unsigned factor.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type,
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">,
                 typename scaling_type&gt;<br />
- point_type&amp; <b>scale</b>(point_type&amp; point,<br />
+ point_type&amp; <b>scale</b>(</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point,<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 const scaling_type&amp; factor) </font></td>
                 <td>Calls the scale member function of scaling type on the x and y value
                 of an object that models point and sets the point to the scaled values.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type,
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">,
                 typename transform_type&gt;<br />
- point_type&amp; <b>transform</b>(point_type&amp; point,<br />
+ point_type&amp; <b>transform</b>(</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point,<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 const transform_type&amp; transform) </font></td>
                 <td>Calls the transform member function of transform type on the x and y
@@ -221,59 +222,52 @@
                 transformed values.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename point_type&gt;<br />
- point_type&amp; <b>move</b>(point_type&amp; point, orientation_2d<br />
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">&gt;<br />
+ point_type&amp; <b>move</b>(</font><font face="Courier New">PointType</font><font face="Courier New">&amp; point, orientation_2d,<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 coordinate_difference displacement)</font></td>
                 <td>Adds displacement value to the coordinate of an object that models
                 point indicated by the orientation_2d.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T1, typename
- T2&gt;<br />
- T1&amp; <b>convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">1, typename PointType2&gt;<br />
+ </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp; <b>convolve</b>(</font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp; a,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">PointType2</font><font face="Courier New">&amp; b)</font></td>
                 <td>Adds x coordinate of b to x coordinate of a and adds y coordinate of
                 b to y coordinate of a.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T1, typename
- T2&gt;<br />
- T1&amp; <b>deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">, typename </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
+ </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">,</font><font face="Courier New">&amp; <b>deconvolve</b>(</font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp; a,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+const </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&gt;</font><font face="Courier New">&amp; b)</font></td>
                 <td>Subtracts x coordinate of b from x coordinate of a and subtracts y
                 coordinate of b from y coordinate of a. </td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T1, typename
- T2&gt;<br />
- coordinate_distance <b>euclidean_distance</b>(const T1&amp;,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-const T2&amp;)</font></td>
+ <td width="586"><font face="Courier New">template &lt;typename </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">, typename </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />distance_type <b>euclidean_distance</b>(<br />
+&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp;, const </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&amp;)</font></td>
                 <td>Returns the distance from an object that models point to a second
                 object that models point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T&gt;<br />
- coordinate_difference <b>euclidean_distance</b>(const T&amp;,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orientation_2d,
- coordinate_type)</font></td>
+ <td width="586"><font face="Courier New">template &lt;</font><font face="Courier New">typename </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">, typename </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
+ coordinate_difference <b>euclidean_distance</b>(<br />
+&nbsp;&nbsp;&nbsp; const </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp;, </font><font face="Courier New">const PointType</font><span style="font-family: Courier New;">2&amp;,</span><font face="Courier New"> orientation_2d)</font></td>
                 <td>Returns the distance from an object that models point to a
                 coordinate in the given orientation_2d.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T1, typename
- T2&gt;<br />
- coordinate_difference <b>manhattan_distance</b>(const T1&amp;,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-const T2&amp;)</font></td>
+ <td width="586"><font face="Courier New">template &lt;</font><font face="Courier New">typename </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">, typename </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
+ coordinate_difference <b>manhattan_distance</b>(<br />
+&nbsp;&nbsp;&nbsp; </font><font face="Courier New">const </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp;, </font><font face="Courier New">const PointType</font><span style="font-family: Courier New;">2&amp;</span><font face="Courier New">)</font></td>
                 <td>Returns the distance in x plus the distance in y from an object that
                 models point to a second object that models point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T1, typename
- T2&gt;<br />
- coordinate_difference <b>distance_squared</b>(const T1&amp;,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-const T2&amp;)</font></td>
+ <td width="586"><font face="Courier New">template &lt;</font><font face="Courier New">typename </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">, typename </font><font face="Courier New">PointType</font><span style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
+ coordinate_difference <b>distance_squared</b>(<br />
+&nbsp;&nbsp;&nbsp; </font><font face="Courier New">const </font><font face="Courier New">PointType</font><font face="Courier New">1</font><font face="Courier New">&amp;, </font><font face="Courier New">const PointType</font><span style="font-family: Courier New;">2&amp;</span><font face="Courier New">)</font></td>
                 <td>Returns the square of the distance in x plus the square of the
                 distance in y from an object that models point to a second object that
                 models point.</td>
@@ -293,28 +287,25 @@
                 library provided point data type and functions</p>
 <h2>Members</h2>
 <table id="table2" border="1" width="100%">
- <tbody><tr>
- <td width="586"><b><font face="Courier New">geometry_type</font></b></td>
- <td><font face="Times New Roman">point_concept</font></td>
- </tr>
+ <tbody>
         <tr>
                 <td width="586"><b><font face="Courier New">coordinate_type</font></b></td>
- <td><font face="Times New Roman">T</font></td>
+ <td>T</td>
         </tr>
         <tr>
                 <td width="586"><font face="Courier New"><b>point_data</b>()</font></td>
- <td><font face="Times New Roman">Default constructs the two coordinate
- values of the </font>point<font face="Times New Roman">.</font></td>
+ <td>Default constructs the two coordinate
+ values of the point.</td>
         </tr>
         <tr>
                 <td width="586"><font face="Courier New"><b>point_data</b>(T x, T y)</font></td>
- <td><font face="Times New Roman">Constructs an interval with two
- coordinates.</font></td>
+ <td>Constructs an interval with two
+ coordinates.</td>
         </tr>
         <tr>
                 <td width="586"><font face="Courier New"><b>point_data</b>(const point_data*
                 that)</font></td>
- <td><font face="Times New Roman">Copy construct</font></td>
+ <td>Copy construct</td>
         </tr>
         <tr>
                 <td width="586"><font face="Courier New">point_data&amp; <b>operator=</b>(const
@@ -322,44 +313,37 @@
                 <td>Assignment operator.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>&nbsp;
- <br /> </b>point_data&amp; <b>operator=</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New"><b></b>point_data&amp; <b>operator=</b>(const T&amp; that) const</font></td>
                 <td>Assign from an object that is a model of point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>
- <br /> </b>bool<b>
- operator==</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New">bool<b>
+ operator==</b>(const T&amp; that) const</font></td>
                 <td>Compare equality to an object that is a model of point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>
- <br /> </b>bool<b>
- operator!=</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New">bool<b>
+ operator!=</b>(const T&amp; that) const</font></td>
                 <td>Compare inequality to an object that is a model of point.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>
- <br /> </b>bool<b>
- operator&lt;</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New"><b> </b>bool<b>
+ operator&lt;</b>(const T&amp; that) const</font></td>
                 <td>Compares y coordinates then x coordinates to break ties.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>
- <br /> </b>bool<b>
- operator&lt;=</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New"><b> </b>bool<b>
+ operator&lt;=</b>(const T&amp; that) const</font></td>
                 <td>Compares y coordinates then x coordinates to break ties.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>
- <br /> </b>bool<b>
- operator&gt;</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New"><b> </b>bool<b>
+ operator&gt;</b>(const T&amp; that) const</font></td>
                 <td>Compares low coordinates then high coordinates to break ties.</td>
         </tr>
         <tr>
- <td width="586"><font face="Courier New">template &lt;typename T2&gt;<b>
- <br /> </b>bool<b>
- operator&gt;=</b>(const T2&amp; that) const</font></td>
+ <td width="586"><font face="Courier New">bool<b>
+ operator&gt;=</b>(const T&amp; that) const</font></td>
                 <td>Compares low coordinates then high coordinates to break ties.</td>
         </tr>
         <tr>

Modified: trunk/libs/polygon/test/Jamfile.v2
==============================================================================
--- trunk/libs/polygon/test/Jamfile.v2 (original)
+++ trunk/libs/polygon/test/Jamfile.v2 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -18,6 +18,7 @@
 
 test-suite polygon-unit
     :
+ [ run polygon_point_test.cpp ]
         [ run polygon_segment_test.cpp ]
         [ run gtl_boost_unit_test.cpp ]
     ;

Modified: trunk/libs/polygon/test/gtl_boost_unit_test.cpp
==============================================================================
--- trunk/libs/polygon/test/gtl_boost_unit_test.cpp (original)
+++ trunk/libs/polygon/test/gtl_boost_unit_test.cpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -3113,37 +3113,6 @@
     std::cout << equivalence(pwhs, polys) << std::endl;
   }
   {
- typedef point_3d_data<int> Point3D;
- Point3D p3d1(0, 1, 3), p3d2(0, 1, 2);
- if(equivalence(p3d1, p3d2)) return 1;
- if(euclidean_distance(p3d1, p3d2) != 1) return 1;
- if(euclidean_distance(p3d1, p3d2, PROXIMAL) != 1) return 1;
- if(manhattan_distance(p3d1, p3d2) != 1) return 1;
- assign(p3d1, p3d2);
- if(!equivalence(p3d1, p3d2)) return 1;
- p3d1 = construct<Point3D>(x(p3d1), y(p3d1), z(p3d1));
- if(!equivalence(p3d1, p3d2)) return 1;
- convolve(p3d1, p3d2);
- if(equivalence(p3d1, p3d2)) return 1;
- deconvolve(p3d1, p3d2);
- if(!equivalence(p3d1, p3d2)) return 1;
- if(get(p3d1, PROXIMAL) != 2) return 1;
- scale(p3d1, anisotropic_scale_factor<double>(2, 2, 2));
- if(equivalence(p3d1, p3d2)) return 1;
- scale_down(p3d1, 2);
- if(!equivalence(p3d1, p3d2)) return 1;
- scale_up(p3d1, 2);
- if(equivalence(p3d1, p3d2)) return 1;
- scale_down(p3d1, 2);
- set(p3d1, PROXIMAL, 3);
- if(equivalence(p3d1, p3d2)) return 1;
- axis_transformation atr = axis_transformation::END;
- transform(p3d1, atr);
- if(z(p3d1) != -3) return 1;
- z(p3d1, 2);
- if(!equivalence(p3d1, p3d2)) return 1;
- }
- {
     polygon_90_set_data<int> ps1(HORIZONTAL), ps2(VERTICAL);
     ps1 += rectangle_data<int>(0, 0, 10, 120);
     assign(ps1, ps2);
@@ -3238,16 +3207,6 @@
     snap_to_45(pwh);
   }
   {
- point_data<int> pt(1,2);
- point_3d_data<int> pt3d(1,2,3);
- equivalence(pt, pt3d);
- deconvolve(pt, pt3d);
- manhattan_distance(pt, pt3d);
- move(pt, HORIZONTAL, 1);
- scale(pt, anisotropic_scale_factor<double>(2, 2, 2));
- pt = pt3d;
- }
- {
     polygon_90_set_data<int> ps90_1, ps90_2;
     ps90_1.insert(rectangle_data<int>(0, 0, 10, 10));
     keep(ps90_1, 0, 1000, 0, 1000, 0, 1000);
@@ -3710,7 +3669,6 @@
     segment_data<int> sarray[2];
     sarray[0] = segment_data<int>(point_data<int>(0,0), point_data<int>(10,10));
     sarray[1] = segment_data<int>(point_data<int>(10,0), point_data<int>(0,10));
- std::iterator_traits<segment_data<int>*>::value_type s = sarray[0];
     intersect_segments(segs, sarray, sarray+2);
     std::cout << segs.size() << std::endl;
     assert_s(segs.size() == 4, "intersection3");

Added: trunk/libs/polygon/test/polygon_point_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/polygon/test/polygon_point_test.cpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -0,0 +1,190 @@
+// Boost.Polygon library polygon_point_test.cpp file
+
+// Copyright Andrii Sydorchuk 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 POLYGON_POINT_TEST
+#include <boost/mpl/list.hpp>
+#include <boost/test/test_case_template.hpp>
+
+#include "boost/polygon/polygon.hpp"
+using namespace boost::polygon;
+
+typedef boost::mpl::list<int> test_types;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(point_data_test, T, test_types) {
+ typedef point_data<T> point_type;
+
+ point_type point1(1, 2);
+ point_type point2;
+ point2 = point1;
+ BOOST_CHECK_EQUAL(point1.x(), 1);
+ BOOST_CHECK_EQUAL(point1.y(), 2);
+ BOOST_CHECK_EQUAL(point2.x(), 1);
+ BOOST_CHECK_EQUAL(point2.y(), 2);
+ BOOST_CHECK(point1 == point2);
+ BOOST_CHECK(!(point1 != point2));
+ BOOST_CHECK(!(point1 < point2));
+ BOOST_CHECK(!(point1 > point2));
+ BOOST_CHECK(point1 <= point2);
+ BOOST_CHECK(point1 >= point2);
+
+ point2.x(2);
+ point2.y(1);
+ BOOST_CHECK_EQUAL(point2.x(), 2);
+ BOOST_CHECK_EQUAL(point2.y(), 1);
+ BOOST_CHECK(!(point1 == point2));
+ BOOST_CHECK(point1 != point2);
+ BOOST_CHECK(point1 < point2);
+ BOOST_CHECK(!(point1 > point2));
+ BOOST_CHECK(point1 <= point2);
+ BOOST_CHECK(!(point1 >= point2));
+
+ point2.set(HORIZONTAL, 1);
+ point2.set(VERTICAL, 2);
+ BOOST_CHECK(point1 == point2);
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(point_traits_test, T, test_types) {
+ typedef point_data<T> point_type;
+
+ point_type point = point_mutable_traits<point_type>::construct(1, 2);
+ BOOST_CHECK_EQUAL(point_traits<point_type>::get(point, HORIZONTAL), 1);
+ BOOST_CHECK_EQUAL(point_traits<point_type>::get(point, VERTICAL), 2);
+
+ point_mutable_traits<point_type>::set(point, HORIZONTAL, 3);
+ point_mutable_traits<point_type>::set(point, VERTICAL, 4);
+ BOOST_CHECK_EQUAL(point_traits<point_type>::get(point, HORIZONTAL), 3);
+ BOOST_CHECK_EQUAL(point_traits<point_type>::get(point, VERTICAL), 4);
+}
+
+template <typename T>
+struct Point {
+ T x;
+ T y;
+};
+
+namespace boost {
+namespace polygon {
+ template <typename T>
+ struct geometry_concept< Point<T> > {
+ typedef point_concept type;
+ };
+
+ template <typename T>
+ struct point_traits< Point<T> > {
+ typedef T coordinate_type;
+
+ static coordinate_type get(const Point<T>& point, orientation_2d orient) {
+ return (orient == HORIZONTAL) ? point.x : point.y;
+ }
+ };
+
+ template <typename T>
+ struct point_mutable_traits< Point<T> > {
+ typedef T coordinate_type;
+
+ static void set(Point<T>& point, orientation_2d orient, T value) {
+ (orient == HORIZONTAL) ? point.x = value : point.y = value;
+ }
+
+ static Point<T> construct(coordinate_type x, coordinate_type y) {
+ Point<T> point;
+ point.x = x;
+ point.y = y;
+ return point;
+ }
+ };
+} // polygon
+} // boost
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(point_concept_test1, T, test_types) {
+ typedef Point<T> point_type;
+
+ point_type point1 = construct<point_type>(1, 2);
+ BOOST_CHECK_EQUAL(point1.x, 1);
+ BOOST_CHECK_EQUAL(point1.y, 2);
+
+ set(point1, HORIZONTAL, 3);
+ set(point1, VERTICAL, 4);
+ BOOST_CHECK_EQUAL(get(point1, HORIZONTAL), 3);
+ BOOST_CHECK_EQUAL(get(point1, VERTICAL), 4);
+
+ point_type point2;
+ assign(point2, point1);
+ BOOST_CHECK(equivalence(point1, point2));
+
+ x(point2, 1);
+ y(point2, 2);
+ BOOST_CHECK_EQUAL(x(point2), 1);
+ BOOST_CHECK_EQUAL(y(point2), 2);
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(point_concept_test2, T, test_types) {
+ typedef Point<T> point_type;
+
+ point_type point1 = construct<point_type>(1, 2);
+ point_type point2 = construct<point_type>(5, 5);
+ BOOST_CHECK_EQUAL(euclidean_distance(point1, point2, HORIZONTAL), 4);
+ BOOST_CHECK_EQUAL(euclidean_distance(point1, point2, VERTICAL), 3);
+ BOOST_CHECK_EQUAL(manhattan_distance(point1, point2), 7);
+ BOOST_CHECK_EQUAL(euclidean_distance(point1, point2), 5.0);
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(point_concept_test3, T, test_types) {
+ typedef Point<T> point_type;
+
+ point_type point = construct<point_type>(1, 2);
+ point_type shift = construct<point_type>(4, 3);
+ convolve(point, shift);
+ BOOST_CHECK_EQUAL(x(point), 5);
+ BOOST_CHECK_EQUAL(y(point), 5);
+
+ deconvolve(point, shift);
+ BOOST_CHECK_EQUAL(x(point), 1);
+ BOOST_CHECK_EQUAL(y(point), 2);
+
+ scale_up(point, 5);
+ BOOST_CHECK_EQUAL(x(point), 5);
+ BOOST_CHECK_EQUAL(y(point), 10);
+
+ scale_down(point, 5);
+ BOOST_CHECK_EQUAL(x(point), 1);
+ BOOST_CHECK_EQUAL(y(point), 2);
+
+ move(point, HORIZONTAL, 2);
+ move(point, VERTICAL, 3);
+ BOOST_CHECK_EQUAL(x(point), 3);
+ BOOST_CHECK_EQUAL(y(point), 5);
+}
+
+template<typename T>
+struct Transformer {
+ void scale(T& x, T& y) const {
+ x *= 2;
+ y *= 2;
+ }
+
+ void transform(T& x, T& y) const {
+ T tmp = x;
+ x = y;
+ y = tmp;
+ }
+};
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(point_concept_test4, T, test_types) {
+ typedef Point<T> point_type;
+
+ point_type point = construct<point_type>(1, 2);
+ scale(point, Transformer<T>());
+ BOOST_CHECK_EQUAL(x(point), 2);
+ BOOST_CHECK_EQUAL(y(point), 4);
+
+ transform(point, Transformer<T>());
+ BOOST_CHECK_EQUAL(x(point), 4);
+ BOOST_CHECK_EQUAL(y(point), 2);
+}

Modified: trunk/libs/polygon/test/polygon_segment_test.cpp
==============================================================================
--- trunk/libs/polygon/test/polygon_segment_test.cpp (original)
+++ trunk/libs/polygon/test/polygon_segment_test.cpp 2012-10-17 16:39:00 EDT (Wed, 17 Oct 2012)
@@ -7,9 +7,6 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-#include <algorithm>
-#include <list>
-
 #define BOOST_TEST_MODULE POLYGON_SEGMENT_TEST
 #include <boost/mpl/list.hpp>
 #include <boost/test/test_case_template.hpp>
@@ -25,7 +22,8 @@
   point_type point1(1, 2);
   point_type point2(3, 4);
   segment_type segment1(point1, point2);
- segment_type segment2 = segment1;
+ segment_type segment2;
+ segment2 = segment1;
 
   BOOST_CHECK(segment1.low() == point1);
   BOOST_CHECK(segment1.high() == point2);
@@ -56,14 +54,14 @@
 
   point_type point1(1, 2);
   point_type point2(3, 4);
- segment_type segment = segment_mutable_traits<segment_type>::construct(point1, point2);
+ segment_type segment =
+ segment_mutable_traits<segment_type>::construct(point1, point2);
 
   BOOST_CHECK(segment_traits<segment_type>::get(segment, LOW) == point1);
   BOOST_CHECK(segment_traits<segment_type>::get(segment, HIGH) == point2);
 
   segment_mutable_traits<segment_type>::set(segment, LOW, point2);
   segment_mutable_traits<segment_type>::set(segment, HIGH, point1);
-
   BOOST_CHECK(segment_traits<segment_type>::get(segment, LOW) == point2);
   BOOST_CHECK(segment_traits<segment_type>::get(segment, HIGH) == point1);
 }
@@ -95,15 +93,13 @@
   struct segment_mutable_traits< Segment<T> > {
     typedef point_data<T> point_type;
 
- static inline void set(Segment<T>& segment, direction_1d dir, const point_type& point) {
- if (dir.to_int()) {
- segment.p1 = point;
- } else {
- segment.p0 = point;
- }
+ static void set(
+ Segment<T>& segment, direction_1d dir, const point_type& point) {
+ dir.to_int() ? segment.p1 = point : segment.p0 = point;;
     }
 
- static inline Segment<T> construct(const point_type& point1, const point_type& point2) {
+ static Segment<T> construct(
+ const point_type& point1, const point_type& point2) {
       Segment<T> segment;
       segment.p0 = point1;
       segment.p1 = point2;
@@ -190,11 +186,16 @@
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
- segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(1, 2));
- segment_type segment2 = construct<segment_type>(point_type(0, 0), point_type(2, 4));
- segment_type segment3 = construct<segment_type>(point_type(0, 0), point_type(2, 3));
- segment_type segment4 = construct<segment_type>(point_type(0, 0), point_type(2, 5));
- segment_type segment5 = construct<segment_type>(point_type(0, 2), point_type(2, 0));
+ segment_type segment1 = construct<segment_type>(
+ point_type(0, 0), point_type(1, 2));
+ segment_type segment2 = construct<segment_type>(
+ point_type(0, 0), point_type(2, 4));
+ segment_type segment3 = construct<segment_type>(
+ point_type(0, 0), point_type(2, 3));
+ segment_type segment4 = construct<segment_type>(
+ point_type(0, 0), point_type(2, 5));
+ segment_type segment5 = construct<segment_type>(
+ point_type(0, 2), point_type(2, 0));
 
   BOOST_CHECK(orientation(segment1, segment2) == 0);
   BOOST_CHECK(orientation(segment1, segment3) == -1);
@@ -325,10 +326,14 @@
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
- segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(1, 2));
- segment_type segment2 = construct<segment_type>(point_type(1, 2), point_type(2, 4));
- segment_type segment3 = construct<segment_type>(point_type(2, 4), point_type(0, 4));
- segment_type segment4 = construct<segment_type>(point_type(0, 4), point_type(0, 0));
+ segment_type segment1 = construct<segment_type>(
+ point_type(0, 0), point_type(1, 2));
+ segment_type segment2 = construct<segment_type>(
+ point_type(1, 2), point_type(2, 4));
+ segment_type segment3 = construct<segment_type>(
+ point_type(2, 4), point_type(0, 4));
+ segment_type segment4 = construct<segment_type>(
+ point_type(0, 4), point_type(0, 0));
 
   BOOST_CHECK(abuts(segment1, segment2, HIGH));
   BOOST_CHECK(abuts(segment2, segment3, HIGH));
@@ -353,11 +358,16 @@
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
- segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(2, 2));
- segment_type segment2 = construct<segment_type>(point_type(1, 1), point_type(3, 3));
- segment_type segment3 = construct<segment_type>(point_type(2, 2), point_type(-1, -1));
- segment_type segment4 = construct<segment_type>(point_type(1, 3), point_type(3, 1));
- segment_type segment5 = construct<segment_type>(point_type(2, 2), point_type(1, 3));
+ segment_type segment1 = construct<segment_type>(
+ point_type(0, 0), point_type(2, 2));
+ segment_type segment2 = construct<segment_type>(
+ point_type(1, 1), point_type(3, 3));
+ segment_type segment3 = construct<segment_type>(
+ point_type(2, 2), point_type(-1, -1));
+ segment_type segment4 = construct<segment_type>(
+ point_type(1, 3), point_type(3, 1));
+ segment_type segment5 = construct<segment_type>(
+ point_type(2, 2), point_type(1, 3));
 
   BOOST_CHECK(intersects(segment1, segment2, false));
   BOOST_CHECK(intersects(segment1, segment2, true));
@@ -377,12 +387,18 @@
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
- segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(0, 2));
- segment_type segment2 = construct<segment_type>(point_type(0, 1), point_type(0, 3));
- segment_type segment3 = construct<segment_type>(point_type(0, 1), point_type(0, 2));
- segment_type segment4 = construct<segment_type>(point_type(0, 2), point_type(0, 3));
- segment_type segment5 = construct<segment_type>(point_type(0, 2), point_type(2, 2));
- segment_type segment6 = construct<segment_type>(point_type(0, 1), point_type(1, 1));
+ segment_type segment1 = construct<segment_type>(
+ point_type(0, 0), point_type(0, 2));
+ segment_type segment2 = construct<segment_type>(
+ point_type(0, 1), point_type(0, 3));
+ segment_type segment3 = construct<segment_type>(
+ point_type(0, 1), point_type(0, 2));
+ segment_type segment4 = construct<segment_type>(
+ point_type(0, 2), point_type(0, 3));
+ segment_type segment5 = construct<segment_type>(
+ point_type(0, 2), point_type(2, 2));
+ segment_type segment6 = construct<segment_type>(
+ point_type(0, 1), point_type(1, 1));
 
   BOOST_CHECK(intersects(segment1, segment1, false));
   BOOST_CHECK(intersects(segment1, segment1, true));
@@ -420,10 +436,14 @@
   typedef point_data<T> point_type;
   typedef Segment<T> segment_type;
 
- segment_type segment1 = construct<segment_type>(point_type(0, 0), point_type(3, 4));
- segment_type segment2 = construct<segment_type>(point_type(2, 0), point_type(0, 2));
- segment_type segment3 = construct<segment_type>(point_type(1, -7), point_type(10, 5));
- segment_type segment4 = construct<segment_type>(point_type(7, 7), point_type(10, 11));
+ segment_type segment1 = construct<segment_type>(
+ point_type(0, 0), point_type(3, 4));
+ segment_type segment2 = construct<segment_type>(
+ point_type(2, 0), point_type(0, 2));
+ segment_type segment3 = construct<segment_type>(
+ point_type(1, -7), point_type(10, 5));
+ segment_type segment4 = construct<segment_type>(
+ point_type(7, 7), point_type(10, 11));
 
   BOOST_CHECK(euclidean_distance(segment1, segment2) == 0.0);
   BOOST_CHECK(euclidean_distance(segment1, segment3) == 5.0);


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