Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81007 - in trunk/boost/polygon: . detail
From: sydorchuk.andriy_at_[hidden]
Date: 2012-10-17 18:15:38


Author: asydorchuk
Date: 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
New Revision: 81007
URL: http://svn.boost.org/trac/boost/changeset/81007

Log:
Polygon: getting rid of point 3D data/traits/concept; moving transform from 3D -> 2D.

Removed:
   trunk/boost/polygon/point_3d_concept.hpp
   trunk/boost/polygon/point_3d_data.hpp
   trunk/boost/polygon/point_3d_traits.hpp
Text files modified:
   trunk/boost/polygon/detail/transform_detail.hpp | 132 ----------------------
   trunk/boost/polygon/polygon.hpp | 5
   trunk/boost/polygon/polygon_90_set_data.hpp | 1
   trunk/boost/polygon/polygon_90_set_traits.hpp | 2
   trunk/boost/polygon/transform.hpp | 235 +++++++++++++++++++--------------------
   5 files changed, 112 insertions(+), 263 deletions(-)

Modified: trunk/boost/polygon/detail/transform_detail.hpp
==============================================================================
--- trunk/boost/polygon/detail/transform_detail.hpp (original)
+++ trunk/boost/polygon/detail/transform_detail.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
@@ -411,138 +411,6 @@
     return *this;
   }
 
-
- template <typename coordinate_type>
- inline transformation<coordinate_type>::transformation() : atr_(), p_(0, 0, 0) {;}
-
- template <typename coordinate_type>
- inline transformation<coordinate_type>::transformation(axis_transformation atr) : atr_(atr), p_(0, 0, 0){;}
-
- template <typename coordinate_type>
- inline transformation<coordinate_type>::transformation(axis_transformation::ATR atr) : atr_(atr), p_(0, 0, 0){;}
-
- template <typename coordinate_type>
- template <typename point_type>
- inline transformation<coordinate_type>::transformation(const point_type& p) : atr_(), p_(0, 0, 0) {
- set_translation(p);
- }
-
- template <typename coordinate_type>
- template <typename point_type>
- inline transformation<coordinate_type>::transformation(axis_transformation atr, const point_type& p) :
- atr_(atr), p_(0, 0, 0) {
- set_translation(p);
- }
-
- template <typename coordinate_type>
- template <typename point_type>
- inline transformation<coordinate_type>::transformation(axis_transformation atr, const point_type& referencePt, const point_type& destinationPt) : atr_(), p_(0, 0, 0) {
- transformation<coordinate_type> tmp(referencePt);
- transformation<coordinate_type> rotRef(atr);
- transformation<coordinate_type> tmpInverse = tmp.inverse();
- point_type decon(referencePt);
- deconvolve(decon, destinationPt);
- transformation<coordinate_type> displacement(decon);
- tmp += rotRef;
- tmp += tmpInverse;
- tmp += displacement;
- (*this) = tmp;
- }
-
- template <typename coordinate_type>
- inline transformation<coordinate_type>::transformation(const transformation<coordinate_type>& tr) :
- atr_(tr.atr_), p_(tr.p_) {;}
-
- template <typename coordinate_type>
- inline bool transformation<coordinate_type>::operator==(const transformation<coordinate_type>& tr) const {
- return atr_ == tr.atr_ && p_ == tr.p_;
- }
-
- template <typename coordinate_type>
- inline bool transformation<coordinate_type>::operator!=(const transformation<coordinate_type>& tr) const {
- return !(*this == tr);
- }
-
- template <typename coordinate_type>
- inline bool transformation<coordinate_type>::operator<(const transformation<coordinate_type>& tr) const {
- return atr_ < tr.atr_ || (atr_ == tr.atr_ && p_ < tr.p_);
- }
-
- template <typename coordinate_type>
- inline transformation<coordinate_type> transformation<coordinate_type>::operator+(const transformation<coordinate_type>& tr) const {
- transformation<coordinate_type> retval(*this);
- return retval+=tr;
- }
-
- template <typename coordinate_type>
- inline const transformation<coordinate_type>& transformation<coordinate_type>::operator+=(const transformation<coordinate_type>& tr){
- //apply the inverse transformation of this to the translation point of that
- //and convolve it with this translation point
- coordinate_type x, y, z;
- transformation<coordinate_type> inv = inverse();
- inv.transform(x, y, z);
- p_.set(HORIZONTAL, p_.get(HORIZONTAL) + x);
- p_.set(VERTICAL, p_.get(VERTICAL) + y);
- p_.set(PROXIMAL, p_.get(PROXIMAL) + z);
- //concatenate axis transforms
- atr_ += tr.atr_;
- return *this;
- }
-
- template <typename coordinate_type>
- inline void transformation<coordinate_type>::set_axis_transformation(const axis_transformation& atr) {
- atr_ = atr;
- }
-
- template <typename coordinate_type>
- template <typename point_type>
- inline void transformation<coordinate_type>::get_translation(point_type& p) const {
- assign(p, p_);
- }
-
- template <typename coordinate_type>
- template <typename point_type>
- inline void transformation<coordinate_type>::set_translation(const point_type& p) {
- assign(p_, p);
- }
-
- template <typename coordinate_type>
- inline void transformation<coordinate_type>::transform(coordinate_type& x, coordinate_type& y) const {
- //subtract each component of new origin point
- y -= p_.get(VERTICAL);
- x -= p_.get(HORIZONTAL);
- atr_.transform(x, y);
- }
-
- template <typename coordinate_type>
- inline void transformation<coordinate_type>::transform(coordinate_type& x, coordinate_type& y, coordinate_type& z) const {
- //subtract each component of new origin point
- z -= p_.get(PROXIMAL);
- y -= p_.get(VERTICAL);
- x -= p_.get(HORIZONTAL);
- atr_.transform(x,y,z);
- }
-
- // sets the axis_transform portion to its inverse
- // transforms the tranlastion portion by that inverse axis_transform
- // multiplies the translation portion by -1 to reverse it
- template <typename coordinate_type>
- inline transformation<coordinate_type>& transformation<coordinate_type>::invert() {
- coordinate_type x = p_.get(HORIZONTAL), y = p_.get(VERTICAL), z = p_.get(PROXIMAL);
- atr_.transform(x, y, z);
- x *= -1;
- y *= -1;
- z *= -1;
- p_ = point_3d_data<coordinate_type>(x, y, z);
- atr_.invert();
- return *this;
- }
-
- template <typename coordinate_type>
- inline transformation<coordinate_type> transformation<coordinate_type>::inverse() const {
- transformation<coordinate_type> retval(*this);
- return retval.invert();
- }
 }
 }
 #endif

Deleted: trunk/boost/polygon/point_3d_concept.hpp
==============================================================================
--- trunk/boost/polygon/point_3d_concept.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
+++ (empty file)
@@ -1,283 +0,0 @@
-/*
- Copyright 2008 Intel Corporation
-
- 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 GLT_POINT_3D_CONCEPT_HPP
-#define GLT_POINT_3D_CONCEPT_HPP
-#include "point_concept.hpp"
-#include "point_3d_data.hpp"
-#include "point_3d_traits.hpp"
-namespace boost { namespace polygon{
- struct point_3d_concept {};
-
- template <typename T>
- struct is_point_3d_concept { typedef gtl_no type; };
- template <>
- struct is_point_3d_concept<point_3d_concept> { typedef gtl_yes type; };
- //template <>
- //struct is_point_concept<point_3d_concept> { typedef void type; };
-
- template <typename T>
- struct is_mutable_point_3d_concept { typedef gtl_no type; };
- template <>
- struct is_mutable_point_3d_concept<point_3d_concept> { typedef gtl_yes type; };
-
- template <typename T, typename CT>
- struct point_3d_coordinate_type_by_concept { typedef void type; };
- template <typename T>
- struct point_3d_coordinate_type_by_concept<T, gtl_yes> { typedef typename point_3d_traits<T>::coordinate_type type; };
-
- template <typename T>
- struct point_3d_coordinate_type {
- typedef typename point_3d_coordinate_type_by_concept<T, typename is_point_3d_concept<typename geometry_concept<T>::type>::type>::type type;
- };
-
- template <typename T, typename CT>
- struct point_3d_difference_type_by_concept { typedef void type; };
- template <typename T>
- struct point_3d_difference_type_by_concept<T, gtl_yes> {
- typedef typename coordinate_traits<typename point_3d_coordinate_type<T>::type>::coordinate_difference type; };
-
- template <typename T>
- struct point_3d_difference_type {
- typedef typename point_3d_difference_type_by_concept<
- T, typename is_point_3d_concept<typename geometry_concept<T>::type>::type>::type type;
- };
-
- template <typename T, typename CT>
- struct point_3d_distance_type_by_concept { typedef void type; };
- template <typename T>
- struct point_3d_distance_type_by_concept<T, gtl_yes> {
- typedef typename coordinate_traits<typename point_3d_coordinate_type<T>::type>::coordinate_distance type; };
-
- template <typename T>
- struct point_3d_distance_type {
- typedef typename point_3d_distance_type_by_concept<
- T, typename is_point_3d_concept<typename geometry_concept<T>::type>::type>::type type;
- };
-
- struct y_p3d_get : gtl_yes {};
-
- template <typename T>
- typename enable_if< typename gtl_and<y_p3d_get, typename is_point_3d_concept<typename geometry_concept<T>::type>::type>::type,
- typename point_3d_coordinate_type<T>::type >::type
- get(const T& point, orientation_3d orient) { return point_3d_traits<T>::get(point, orient); }
-
- struct y_p3d_set : gtl_yes {};
-
- template <typename T, typename coordinate_type>
- typename enable_if< typename gtl_and<y_p3d_set, typename is_mutable_point_3d_concept<typename geometry_concept<T>::type>::type>::type, void>::type
- set(T& point, orientation_3d orient, coordinate_type value) { point_3d_mutable_traits<T>::set(point, orient, value); }
-
- struct y_p3d_set2 : gtl_yes {};
-
- template <typename T, typename coordinate_type>
- typename enable_if< typename gtl_and<y_p3d_set2, typename is_mutable_point_3d_concept<typename geometry_concept<T>::type>::type>::type, void>::type
- set(T& point, orientation_2d orient, coordinate_type value) { point_3d_mutable_traits<T>::set(point, orient, value); }
-
- struct y_p3d_construct : gtl_yes {};
-
- template <typename T, typename coordinate_type1, typename coordinate_type2, typename coordinate_type3>
- typename enable_if< typename gtl_and<y_p3d_construct, typename is_mutable_point_3d_concept<typename geometry_concept<T>::type>::type>::type, T>::type
- construct(coordinate_type1 x_value, coordinate_type2 y_value, coordinate_type3 z_value) {
- return point_3d_mutable_traits<T>::construct(x_value, y_value, z_value); }
-
- struct y_p3d_assign : gtl_yes {};
-
- template <typename point_3d_type_1, typename point_3d_type_2>
- typename enable_if<
- typename gtl_and_3<y_p3d_assign, typename is_mutable_point_3d_concept<typename geometry_concept<point_3d_type_1>::type>::type,
- typename is_point_3d_concept<typename geometry_concept<point_3d_type_2>::type>::type>::type,
- point_3d_type_1>::type &
- assign(point_3d_type_1& lvalue, const point_3d_type_2& rvalue) {
- set(lvalue, HORIZONTAL, get(rvalue, HORIZONTAL));
- set(lvalue, VERTICAL, get(rvalue, VERTICAL));
- set(lvalue, PROXIMAL, get(rvalue, PROXIMAL));
- 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>
- typename enable_if< typename gtl_and<y_p3d_z, typename is_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
- typename point_3d_coordinate_type<point_type>::type >::type
- z(const point_type& point) { return get(point, PROXIMAL); }
-
- struct y_p3d_x2 : gtl_yes {};
-
- template <typename point_type, typename coordinate_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_y2 : gtl_yes {};
-
- template <typename point_type, typename coordinate_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 {};
-
- template <typename point_type, typename coordinate_type>
- typename enable_if< typename gtl_and<y_p3d_z2, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type, void>::type
- z(point_type& point, coordinate_type value) { set(point, PROXIMAL, value); }
-
- struct y_p3d_equiv : gtl_yes {};
-
- template <typename T, typename T2>
- typename enable_if<
- typename gtl_and_3<y_p3d_equiv, typename gtl_same_type<point_3d_concept, typename geometry_concept<T>::type>::type,
- typename gtl_same_type<point_3d_concept, typename geometry_concept<T2>::type>::type>::type,
- bool>::type
- equivalence(const T& point1, const T2& point2) {
- return x(point1) == x(point2) && y(point1) == y(point2) && z(point1) == z(point2);
- }
-
- struct y_p3d_dist : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<y_p3d_dist, typename is_point_3d_concept<typename geometry_concept<point_type_1>::type>::type,
- typename is_point_3d_concept<typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_3d_difference_type<point_type_1>::type>::type
- euclidean_distance(const point_type_1& point1, const point_type_2& point2, orientation_3d orient) {
- typedef typename coordinate_traits<typename point_3d_coordinate_type<point_type_1>::type>::coordinate_difference return_type;
- return_type return_value =
- (return_type)get(point1, orient) - (return_type)get(point2, orient);
- return return_value < 0 ? -return_value : return_value;
- }
-
- struct y_p3d_man_dist : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3<y_p3d_man_dist, typename gtl_same_type<point_3d_concept, typename geometry_concept<point_type_1>::type>::type,
- typename gtl_same_type<point_3d_concept, typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_3d_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)
- + euclidean_distance(point1, point2, PROXIMAL);
- }
-
- struct y_p3d_dist2 : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3< y_p3d_dist2,
- typename gtl_same_type<point_3d_concept, typename geometry_concept<point_type_1>::type>::type,
- typename gtl_same_type<point_3d_concept, typename geometry_concept<point_type_2>::type>::type>::type,
- typename point_3d_distance_type<point_type_1>::type>::type
- euclidean_distance(const point_type_1& point1, const point_type_2& point2) {
- typedef typename coordinate_traits<typename point_3d_coordinate_type<point_type_1>::type>::coordinate_distance return_value;
- return_value pdist = (return_value)euclidean_distance(point1, point2, PROXIMAL);
- pdist *= pdist;
- return std::sqrt((double)(distance_squared(point1, point2) + pdist));
- }
-
- struct y_p3d_convolve : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if< typename gtl_and_3< y_p3d_convolve,
- typename is_mutable_point_3d_concept<typename geometry_concept<point_type_1>::type>::type,
- typename gtl_same_type<point_3d_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));
- z(lvalue, z(lvalue) + z(rvalue));
- return lvalue;
- }
-
- struct y_p3d_deconvolve : gtl_yes {};
-
- template <typename point_type_1, typename point_type_2>
- typename enable_if<
- typename gtl_and_3<y_p3d_deconvolve, typename is_mutable_point_3d_concept<typename geometry_concept<point_type_1>::type>::type,
- typename gtl_same_type<point_3d_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));
- z(lvalue, z(lvalue) - z(rvalue));
- return lvalue;
- }
-
- struct y_p3d_scale_up : gtl_yes {};
-
- template <typename point_type>
- typename enable_if< typename gtl_and<y_p3d_scale_up, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- scale_up(point_type& point,
- typename coordinate_traits<typename point_3d_coordinate_type<point_type>::type>::unsigned_area_type factor) {
- x(point, x(point) * (typename point_3d_coordinate_type<point_type>::type)factor);
- y(point, y(point) * (typename point_3d_coordinate_type<point_type>::type)factor);
- z(point, z(point) * (typename point_3d_coordinate_type<point_type>::type)factor);
- return point;
- }
-
- struct y_p3d_scale_down : gtl_yes {};
-
- template <typename point_type>
- typename enable_if< typename gtl_and<y_p3d_scale_down, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- scale_down(point_type& point,
- typename coordinate_traits<typename point_3d_coordinate_type<point_type>::type>::unsigned_area_type factor) {
- typedef typename point_3d_coordinate_type<point_type>::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));
- z(point, scaling_policy<Unit>::round((dt)(z(point)) / (dt)factor));
- return point;
- }
-
- struct y_p3d_scale : gtl_yes {};
-
- template <typename point_type, typename scaling_type>
- typename enable_if< typename gtl_and<y_p3d_scale, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- scale(point_type& point,
- const scaling_type& scaling) {
- typedef typename point_3d_coordinate_type<point_type>::type Unit;
- Unit x_(x(point)), y_(y(point)), z_(z(point));
- scaling.scale(x_, y_, z_);
- x(point, x_);
- y(point, y_);
- z(point, z_);
- return point;
- }
-
- struct y_p3d_transform : gtl_yes {};
-
- template <typename point_type, typename transformation_type>
- typename enable_if< typename gtl_and<y_p3d_transform, typename is_mutable_point_3d_concept<typename geometry_concept<point_type>::type>::type>::type,
- point_type>::type &
- transform(point_type& point, const transformation_type& transformation) {
- typedef typename point_3d_coordinate_type<point_type>::type Unit;
- Unit x_(x(point)), y_(y(point)), z_(z(point));
- transformation.transform(x_, y_, z_);
- x(point, x_);
- y(point, y_);
- z(point, z_);
- return point;
- }
-
- template <typename T>
- struct geometry_concept<point_3d_data<T> > {
- typedef point_3d_concept type;
- };
-}
-}
-#endif

Deleted: trunk/boost/polygon/point_3d_data.hpp
==============================================================================
--- trunk/boost/polygon/point_3d_data.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
+++ (empty file)
@@ -1,49 +0,0 @@
-/*
- Copyright 2008 Intel Corporation
-
- 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_3D_DATA_HPP
-#define BOOST_POLYGON_POINT_3D_DATA_HPP
-namespace boost { namespace polygon{
- template <typename T>
- class point_3d_data {
- public:
- typedef T coordinate_type;
- inline point_3d_data():coords_(){}
- inline point_3d_data(coordinate_type x, coordinate_type y):coords_() {
- coords_[HORIZONTAL] = x; coords_[VERTICAL] = y; coords_[PROXIMAL] = 0; }
- inline point_3d_data(coordinate_type x, coordinate_type y, coordinate_type z)
-#ifndef BOOST_POLYGON_MSVC
- :coords_()
-#endif
- {
- coords_[HORIZONTAL] = x; coords_[VERTICAL] = y; coords_[PROXIMAL] = z; }
- inline point_3d_data(const point_3d_data& that):coords_() { (*this) = that; }
- inline point_3d_data& operator=(const point_3d_data& that) {
- coords_[0] = that.coords_[0]; coords_[1] = that.coords_[1];
- coords_[2] = that.coords_[2]; return *this; }
- template <typename T2>
- inline point_3d_data& operator=(const T2& rvalue);
- inline bool operator==(const point_3d_data& that) const {
- return coords_[0] == that.coords_[0] && coords_[1] == that.coords_[1] && coords_[2] == that.coords_[2];
- }
- inline bool operator!=(const point_3d_data& that) const {
- return !((*this) == that);
- }
- inline coordinate_type get(orientation_2d orient) const {
- return coords_[orient.to_int()]; }
- inline coordinate_type get(orientation_3d orient) const {
- return coords_[orient.to_int()]; }
- inline void set(orientation_2d orient, coordinate_type value) {
- coords_[orient.to_int()] = value; }
- inline void set(orientation_3d orient, coordinate_type value) {
- coords_[orient.to_int()] = value; }
- private:
- coordinate_type coords_[3];
- };
-}
-}
-#endif

Deleted: trunk/boost/polygon/point_3d_traits.hpp
==============================================================================
--- trunk/boost/polygon/point_3d_traits.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
+++ (empty file)
@@ -1,34 +0,0 @@
-/*
- Copyright 2008 Intel Corporation
-
- 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_3D_TRAITS_HPP
-#define BOOST_POLYGON_POINT_3D_TRAITS_HPP
-
-#include "isotropy.hpp"
-
-namespace boost { namespace polygon{
- template <typename T>
- struct point_3d_traits {
- typedef typename T::coordinate_type coordinate_type;
-
- static inline coordinate_type get(const T& point, orientation_3d orient) {
- return point.get(orient); }
- };
-
- template <typename T>
- struct point_3d_mutable_traits {
- static inline void set(T& point, orientation_3d orient, typename point_3d_traits<T>::coordinate_type value) {
- point.set(orient, value); }
-
- static inline T construct(typename point_3d_traits<T>::coordinate_type x_value,
- typename point_3d_traits<T>::coordinate_type y_value,
- typename point_3d_traits<T>::coordinate_type z_value) {
- return T(x_value, y_value, z_value); }
- };
-}
-}
-#endif

Modified: trunk/boost/polygon/polygon.hpp
==============================================================================
--- trunk/boost/polygon/polygon.hpp (original)
+++ trunk/boost/polygon/polygon.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
@@ -16,11 +16,6 @@
 #include "point_traits.hpp"
 #include "point_concept.hpp"
 
-//point 3d
-#include "point_3d_data.hpp"
-#include "point_3d_traits.hpp"
-#include "point_3d_concept.hpp"
-
 #include "transform.hpp"
 #include "detail/transform_detail.hpp"
 

Modified: trunk/boost/polygon/polygon_90_set_data.hpp
==============================================================================
--- trunk/boost/polygon/polygon_90_set_data.hpp (original)
+++ trunk/boost/polygon/polygon_90_set_data.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
@@ -9,7 +9,6 @@
 #define BOOST_POLYGON_POLYGON_90_SET_DATA_HPP
 #include "isotropy.hpp"
 #include "point_concept.hpp"
-#include "point_3d_concept.hpp"
 #include "transform.hpp"
 #include "interval_concept.hpp"
 #include "rectangle_concept.hpp"

Modified: trunk/boost/polygon/polygon_90_set_traits.hpp
==============================================================================
--- trunk/boost/polygon/polygon_90_set_traits.hpp (original)
+++ trunk/boost/polygon/polygon_90_set_traits.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
@@ -20,8 +20,6 @@
   template <typename T>
   struct traits_by_concept<T, point_concept> { typedef point_traits<T> type; };
   template <typename T>
- struct traits_by_concept<T, point_3d_concept> { typedef point_3d_traits<T> type; };
- template <typename T>
   struct traits_by_concept<T, rectangle_concept> { typedef rectangle_traits<T> type; };
   template <typename T>
   struct traits_by_concept<T, segment_concept> { typedef segment_traits<T> type; };

Modified: trunk/boost/polygon/transform.hpp
==============================================================================
--- trunk/boost/polygon/transform.hpp (original)
+++ trunk/boost/polygon/transform.hpp 2012-10-17 18:15:37 EDT (Wed, 17 Oct 2012)
@@ -5,90 +5,39 @@
     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt).
 */
+
 #ifndef BOOST_POLYGON_TRANSFORM_HPP
 #define BOOST_POLYGON_TRANSFORM_HPP
+
 #include "isotropy.hpp"
-#include "point_3d_concept.hpp"
-namespace boost { namespace polygon{
+
+namespace boost {
+namespace polygon{
 // Transformation of Coordinate Systems
 // Enum meaning:
-// Select which direction_3d to change the positive direction of each
+// Select which direction_2d to change the positive direction of each
 // axis in the old coordinate system to map it to the new coordiante system.
-// The first direction_3d listed for each enum is the direction to map the
+// The first direction_2d listed for each enum is the direction to map the
 // positive horizontal direction to.
-// The second direction_3d listed for each enum is the direction to map the
+// The second direction_2d listed for each enum is the direction to map the
 // positive vertical direction to.
-// The third direction_3d listed for each enum is the direction to map the
-// positive proximal direction to.
 // The zero position bit (LSB) indicates whether the horizontal axis flips
 // when transformed.
 // The 1st postion bit indicates whether the vertical axis flips when
 // transformed.
 // The 2nd position bit indicates whether the horizontal and vertical axis
 // swap positions when transformed.
-// Note that the first eight values are the complete set of 2D transforms.
-// The 3rd position bit indicates whether the proximal axis flips when
-// transformed.
-// The 4th position bit indicates whether the proximal and horizontal axis are
-// swapped when transformed. It changes the meaning of the 2nd position bit
-// to mean that the horizontal and vertical axis are swapped in their new
-// positions, naturally.
-// The 5th position bit (MSB) indicates whether the proximal and vertical axis
-// are swapped when transformed. It is mutually exclusive with the 4th postion
-// bit, making the maximum legal value 48 (decimal). It similarly changes the
-// meaning of the 2nd position bit to mean that the horizontal and vertical are
-// swapped in their new positions.
 // Enum Values:
-// 000000 EAST NORTH UP
-// 000001 WEST NORTH UP
-// 000010 EAST SOUTH UP
-// 000011 WEST SOUTH UP
-// 000100 NORTH EAST UP
-// 000101 SOUTH EAST UP
-// 000110 NORTH WEST UP
-// 000111 SOUTH WEST UP
-// 001000 EAST NORTH DOWN
-// 001001 WEST NORTH DOWN
-// 001010 EAST SOUTH DOWN
-// 001011 WEST SOUTH DOWN
-// 001100 NORTH EAST DOWN
-// 001101 SOUTH EAST DOWN
-// 001110 NORTH WEST DOWN
-// 001111 SOUTH WEST DOWN
-// 010000 UP NORTH EAST
-// 010001 DOWN NORTH EAST
-// 010010 UP SOUTH EAST
-// 010011 DOWN SOUTH EAST
-// 010100 NORTH UP EAST
-// 010101 SOUTH UP EAST
-// 010110 NORTH DOWN EAST
-// 010111 SOUTH DOWN EAST
-// 011000 UP NORTH WEST
-// 011001 DOWN NORTH WEST
-// 011010 UP SOUTH WEST
-// 011011 DOWN SOUTH WEST
-// 011100 NORTH UP WEST
-// 011101 SOUTH UP WEST
-// 011110 NORTH DOWN WEST
-// 011111 SOUTH DOWN WEST
-// 100000 EAST UP NORTH
-// 100001 WEST UP NORTH
-// 100010 EAST DOWN NORTH
-// 100011 WEST DOWN NORTH
-// 100100 UP EAST NORTH
-// 100101 DOWN EAST NORTH
-// 100110 UP WEST NORTH
-// 100111 DOWN WEST NORTH
-// 101000 EAST UP SOUTH
-// 101001 WEST UP SOUTH
-// 101010 EAST DOWN SOUTH
-// 101011 WEST DOWN SOUTH
-// 101100 UP EAST SOUTH
-// 101101 DOWN EAST SOUTH
-// 101110 UP WEST SOUTH
-// 101111 DOWN WEST SOUTH
+// 000 EAST NORTH
+// 001 WEST NORTH
+// 010 EAST SOUTH
+// 011 WEST SOUTH
+// 100 NORTH EAST
+// 101 SOUTH EAST
+// 110 NORTH WEST
+// 111 SOUTH WEST
 class axis_transformation {
-public:
+ public:
   // Enum Names and values
   // NULL_TRANSFORM = 0, BEGIN_TRANSFORM = 0,
   // ENU = 0, EAST_NORTH_UP = 0, EN = 0, EAST_NORTH = 0,
@@ -404,97 +353,137 @@
 
 private:
   scale_factor_type scale_[3];
-
- //friend std::ostream& operator<< (std::ostream& o, const Scale& r);
- //friend std::istream& operator>> (std::istream& i, Scale& r);
 };
 
-// Transformation object, stores and provides services for transformations
-
-// Transformation object stores an axistransformation, a scale factor and a translation.
-// The tranlation is the position of the origin of the new system of coordinates in the old system.
-// The scale scales the coordinates before they are transformed.
+// Transformation object, stores and provides services for transformations.
+// Consits of axis transformation, scale factor and translation.
+// The tranlation is the position of the origin of the new coordinate system of
+// in the old system. Coordinates are scaled before they are transformed.
 template <typename coordinate_type>
 class transformation {
-public:
- transformation();
- transformation(axis_transformation atr);
- transformation(axis_transformation::ATR atr);
+ public:
+ transformation() : atr_(), p_(0, 0) {}
+ transformation(axis_transformation atr) : atr_(atr), p_(0, 0) {}
+ transformation(axis_transformation::ATR atr) : atr_(atr), p_(0, 0) {}
+ transformation(const transformation& tr) : atr_(tr.atr_), p_(tr.p_) {}
+
   template <typename point_type>
- transformation(const point_type& p);
+ transformation(const point_type& p) : atr_(), p_(0, 0) {
+ set_translation(p);
+ }
+
   template <typename point_type>
- transformation(axis_transformation atr, const point_type& p);
+ transformation(axis_transformation atr,
+ const point_type& p) : atr_(atr), p_(0, 0) {
+ set_translation(p);
+ }
+
   template <typename point_type>
- transformation(axis_transformation atr, const point_type& referencePt, const point_type& destinationPt);
- transformation(const transformation& tr);
+ transformation(axis_transformation atr,
+ const point_type& referencePt,
+ const point_type& destinationPt) : atr_(), p_(0, 0) {
+ transformation<coordinate_type> tmp(referencePt);
+ transformation<coordinate_type> rotRef(atr);
+ transformation<coordinate_type> tmpInverse = tmp.inverse();
+ point_type decon(referencePt);
+ deconvolve(decon, destinationPt);
+ transformation<coordinate_type> displacement(decon);
+ tmp += rotRef;
+ tmp += tmpInverse;
+ tmp += displacement;
+ (*this) = tmp;
+ }
 
   // equivalence operator
- bool operator==(const transformation& tr) const;
+ bool operator==(const transformation& tr) const {
+ return (atr_ == tr.atr_) && (p_ == tr.p_);
+ }
 
   // inequivalence operator
- bool operator!=(const transformation& tr) const;
+ bool operator!=(const transformation& tr) const {
+ return !(*this == tr);
+ }
 
   // ordering
- bool operator<(const transformation& tr) const;
+ bool operator<(const transformation& tr) const {
+ return (atr_ < tr.atr_) || ((atr_ == tr.atr_) && (p_ < tr.p_));
+ }
 
   // concatenation operator
- transformation operator+(const transformation& tr) const;
+ transformation operator+(const transformation& tr) const {
+ transformation<coordinate_type> retval(*this);
+ return retval+=tr;
+ }
 
   // concatenate this with that
- const transformation& operator+=(const transformation& tr);
+ const transformation& operator+=(const transformation& tr) {
+ coordinate_type x, y;
+ transformation<coordinate_type> inv = inverse();
+ inv.transform(x, y);
+ p_.set(HORIZONTAL, p_.get(HORIZONTAL) + x);
+ p_.set(VERTICAL, p_.get(VERTICAL) + y);
+ //concatenate axis transforms
+ atr_ += tr.atr_;
+ return *this;
+ }
 
   // get the axis_transformation portion of this
- inline axis_transformation get_axis_transformation() const {return atr_;}
+ axis_transformation get_axis_transformation() const {
+ return atr_;
+ }
 
   // set the axis_transformation portion of this
- void set_axis_transformation(const axis_transformation& atr);
+ void set_axis_transformation(const axis_transformation& atr) {
+ atr_ = atr;
+ }
 
   // get the translation portion of this as a point3d
   template <typename point_type>
- void get_translation(point_type& translation) const;
+ void get_translation(point_type& p) const {
+ assign(p, p_);
+ }
 
   // set the translation portion of this with a point3d
   template <typename point_type>
- void set_translation(const point_type& p);
+ void set_translation(const point_type& p) {
+ assign(p_, p);
+ }
 
   // apply the 2D portion of this transformation to the two coordinates given
- void transform(coordinate_type& x, coordinate_type& y) const;
-
- // apply this transformation to the three coordinates given
- void transform(coordinate_type& x, coordinate_type& y, coordinate_type& z) const;
+ void transform(coordinate_type& x, coordinate_type& y) const {
+ y -= p_.get(VERTICAL);
+ x -= p_.get(HORIZONTAL);
+ atr_.transform(x, y);
+ }
 
   // invert this transformation
- transformation& invert();
+ transformation& invert() {
+ coordinate_type x = p_.get(HORIZONTAL), y = p_.get(VERTICAL);
+ atr_.transform(x, y);
+ x *= -1;
+ y *= -1;
+ p_ = point_data<coordinate_type>(x, y);
+ atr_.invert();
+ return *this;
+ }
 
   // get the inverse of this transformation
- transformation inverse() const;
-
- inline void get_directions(direction_2d& horizontal_dir,
- direction_2d& vertical_dir) const {
- return atr_.get_directions(horizontal_dir, vertical_dir); }
+ transformation inverse() const {
+ transformation<coordinate_type> ret_val(*this);
+ return ret_val.invert();
+ }
 
- inline void get_directions(direction_3d& horizontal_dir,
- direction_3d& vertical_dir,
- direction_3d& proximal_dir) const {
- return atr_.get_directions(horizontal_dir, vertical_dir, proximal_dir); }
+ void get_directions(direction_2d& horizontal_dir,
+ direction_2d& vertical_dir) const {
+ return atr_.get_directions(horizontal_dir, vertical_dir);
+ }
 
-private:
+ private:
   axis_transformation atr_;
- point_3d_data<coordinate_type> p_;
-
- template <typename point_type>
- void construct_dispatch(axis_transformation atr, point_type p, point_concept tag);
- template <typename point_type>
- void construct_dispatch(axis_transformation atr, point_type p, point_3d_concept tag);
- template <typename point_type>
- void construct_dispatch(axis_transformation atr, point_type rp, point_type dp, point_concept tag);
- template <typename point_type>
- void construct_dispatch(axis_transformation atr, point_type rp, point_type dp, point_3d_concept tag);
-
- //friend std::ostream& operator<< (std::ostream& o, const transformation& tr);
- //friend std::istream& operator>> (std::istream& i, transformation& tr);
+ point_data<coordinate_type> p_;
 };
-}
-}
+} // polygon
+} // boost
+
 #include "detail/transform_detail.hpp"
 #endif


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