[Boost-bugs] [Boost C++ Libraries] #8363: Point-wise coordinate transformation?

Subject: [Boost-bugs] [Boost C++ Libraries] #8363: Point-wise coordinate transformation?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-02 08:04:36


#8363: Point-wise coordinate transformation?
-----------------------------------------------------+----------------------
 Reporter: Volker Schöch <vschoech@…> | Owner: barendgehrels
     Type: Support Requests | Status: new
Milestone: To Be Determined | Component: geometry
  Version: Boost 1.52.0 | Severity: Cosmetic
 Keywords: transform, iterate, foreach |
-----------------------------------------------------+----------------------
 I have asked this question before – about a year ago. Just checking if
 there is any news in this regard: I would like to be able to apply a
 functor to every point in a multi-polygon, e.g., in order to transform an
 int-based polygon into a double-base polygon. This seems to be a canonical
 operation, like boost::adaptors::transform on ranges, and yet as far as I
 know there is no algorithm for this in geometry. This is how I currently
 do it:

 {{{
 reserve( polygon.size() ); // vector of polygons
 for( std::vector< _TPolygon< S >::polygon_type >::const_iterator
 itp=polygon.begin(); itp!=polygon.end(); ++itp ) {
        emplace_back( polygon_type() );
        back().outer().reserve( itp->outer().size() ); // vector of points
 describing polygon outline
        for( _TPolygon< S >::polygon_type::ring_type::const_iterator
 itouter=itp->outer().begin(); itouter!=itp->outer().end(); ++itouter ) {
              back().outer().emplace_back( _TPoint< T >(*itouter) );
        }
        back().inners().reserve( itp->inners().size() ); // vector of holes
        for( _TPolygon< S
>::polygon_type::inner_container_type::const_iterator
 itinners=itp->inners().begin(); itinners!=itp->inners().end(); ++itinners
 ) {
              back().inners().emplace_back( polygon_type::ring_type() );
              back().inners().back().reserve( itinners->size() ); // vector
 of points describing a hole
              for( _TPolygon< S >::polygon_type::ring_type::const_iterator
 itinner=itinners->begin(); itinner!=itinners->end(); ++itinner ) {
                     back().inners().back().emplace_back( _TPoint< T
>(*itinner) );
              }
        }
 }
 }}}

 Is there an algorithm in geometry 1.52.0 that I did not find? Do you plan
 to add an algorithm for this task at some point?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8363>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC