Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71322 - in trunk/libs/geometry: doc doc/html/img/algorithms doc/reference/algorithms doc/src/examples/algorithms test/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-04-16 09:17:52


Author: barendgehrels
Date: 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
New Revision: 71322
URL: http://svn.boost.org/trac/boost/changeset/71322

Log:
Added/updated doc/examples for assign/convert/convex_hull
Added:
   trunk/libs/geometry/doc/html/img/algorithms/convex_hull.png (contents, props changed)
   trunk/libs/geometry/doc/reference/algorithms/convert.qbk (contents, props changed)
   trunk/libs/geometry/doc/reference/algorithms/convex_hull.qbk (contents, props changed)
   trunk/libs/geometry/doc/reference/algorithms/equals.qbk (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/convert.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp (contents, props changed)
Text files modified:
   trunk/libs/geometry/doc/imports.qbk | 3 +++
   trunk/libs/geometry/doc/quickref.xml | 13 ++++++++++++-
   trunk/libs/geometry/doc/reference.qbk | 1 +
   trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2 | 2 ++
   trunk/libs/geometry/doc/src/examples/algorithms/assign.cpp | 16 ++++++++--------
   trunk/libs/geometry/test/algorithms/assign.cpp | 11 ++++++-----
   6 files changed, 32 insertions(+), 14 deletions(-)

Added: trunk/libs/geometry/doc/html/img/algorithms/convex_hull.png
==============================================================================
Binary file. No diff available.

Modified: trunk/libs/geometry/doc/imports.qbk
==============================================================================
--- trunk/libs/geometry/doc/imports.qbk (original)
+++ trunk/libs/geometry/doc/imports.qbk 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -15,6 +15,7 @@
 [import src/examples/algorithms/area.cpp]
 [import src/examples/algorithms/area_with_strategy.cpp]
 [import src/examples/algorithms/append.cpp]
+[import src/examples/algorithms/assign.cpp]
 [import src/examples/algorithms/assign_2d_point.cpp]
 [import src/examples/algorithms/assign_3d_point.cpp]
 [import src/examples/algorithms/assign_inverse.cpp]
@@ -22,6 +23,8 @@
 [import src/examples/algorithms/clear.cpp]
 [import src/examples/algorithms/centroid.cpp]
 [import src/examples/algorithms/comparable_distance.cpp]
+[import src/examples/algorithms/convert.cpp]
+[import src/examples/algorithms/convex_hull.cpp]
 [import src/examples/algorithms/correct.cpp]
 [import src/examples/algorithms/distance.cpp]
 [import src/examples/algorithms/difference.cpp]

Modified: trunk/libs/geometry/doc/quickref.xml
==============================================================================
--- trunk/libs/geometry/doc/quickref.xml (original)
+++ trunk/libs/geometry/doc/quickref.xml 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -298,9 +298,16 @@
     </simplelist>
     <bridgehead renderas="sect3">Assign</bridgehead>
     <simplelist type="vert" columns="1">
- <member><link linkend="geometry.reference.algorithms.assign">assign</link></member>
+ <member><link linkend="geometry.reference.algorithms.assign.assign">assign</link></member>
      <member><link linkend="geometry.reference.algorithms.assign.assign_inverse">assign_inverse</link></member>
      <member><link linkend="geometry.reference.algorithms.assign.assign_zero">assign_zero</link></member>
+ <member><link linkend="geometry.reference.algorithms.assign.assign_points">assign_points</link></member>
+ <member>assign_values (
+ <link linkend="geometry.reference.algorithms.assign.assign_values_3_2_coordinate_values">2</link>
+ <link linkend="geometry.reference.algorithms.assign.assign_values_4_3_coordinate_values">3</link>
+ <link linkend="geometry.reference.algorithms.assign.assign_values_5_4_coordinate_values">4</link>
+ coordinate values)
+ </member>
     </simplelist>
    </entry>
    <entry valign="top">
@@ -312,6 +319,10 @@
     <simplelist type="vert" columns="1">
      <member><link linkend="geometry.reference.algorithms.clear">clear</link></member>
     </simplelist>
+ <bridgehead renderas="sect3">Convert</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="geometry.reference.algorithms.convert">convert</link></member>
+ </simplelist>
     <bridgehead renderas="sect3">Convex Hull</bridgehead>
     <simplelist type="vert" columns="1">
      <member><link linkend="geometry.reference.algorithms.convex_hull">convex_hull</link></member>

Modified: trunk/libs/geometry/doc/reference.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference.qbk (original)
+++ trunk/libs/geometry/doc/reference.qbk 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -66,6 +66,7 @@
 [endsect]
 
 [include generated/clear.qbk]
+[include generated/convert.qbk]
 [include generated/convex_hull.qbk]
 [include generated/correct.qbk]
 

Added: trunk/libs/geometry/doc/reference/algorithms/convert.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/convert.qbk 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -0,0 +1,27 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ Use, modification and distribution is 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)
+=============================================================================/]
+
+[tip convert is not defined within OGC or ISO]
+[tip convert is modelled as source -> target
+ (where assign is modelled as target := source)]
+
+[heading Complexity]
+Linear
+
+[heading Example]
+[convert]
+[convert_output]
+
+[heading See also]
+* [link geometry.reference.algorithms.assign.assign assign]
+
+

Added: trunk/libs/geometry/doc/reference/algorithms/convex_hull.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/convex_hull.qbk 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -0,0 +1,18 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ Use, modification and distribution is 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)
+=============================================================================/]
+
+[heading Complexity]
+Linear
+
+[heading Example]
+[convex_hull]
+[convex_hull_output]

Added: trunk/libs/geometry/doc/reference/algorithms/equals.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/equals.qbk 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -0,0 +1,21 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
+ Copyright (c) 2009-2011 Bruno Lalande, Paris, France.
+
+ Use, modification and distribution is 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)
+=============================================================================/]
+
+[include generated/equals_status.qbk]
+
+[heading Complexity]
+Linear
+
+[heading Example]
+[equals]
+[equals_output]
+

Modified: trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2 (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -30,6 +30,8 @@
 exe centroid : centroid.cpp ;
 exe clear : clear.cpp ;
 exe comparable_distance : comparable_distance.cpp ;
+exe convert : convert.cpp ;
+exe convex_hull : convex_hull.cpp ;
 exe correct : correct.cpp ;
 
 exe difference : difference.cpp ;

Modified: trunk/libs/geometry/doc/src/examples/algorithms/assign.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/assign.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/assign.cpp 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -8,7 +8,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 //[assign
-//` Shows how to assign a geometry to another
+//` Shows how to assign a geometry from another geometry
 
 #include <iostream>
 
@@ -26,20 +26,19 @@
     boost::geometry::assign_values(p1, 1, 1);
     boost::geometry::assign_values(b, 1, 1, 2, 2);
     
- // Assign a box to a polygon (conversion box->poly)
+ // Assign a box to a polygon (target = source)
     polygon p;
- boost::geometry::assign_rev(p, b);
+ boost::geometry::assign(p, b);
 
     // Assign a point to another point type (conversion of point-type)
     boost::tuple<double, double> p2;
- boost::geometry::assign_rev(p2, p1);
+ boost::geometry::assign(p2, p1);
         
-
     using boost::geometry::dsv;
     std::cout
         << "box: " << dsv(b) << std::endl
         << "polygon: " << dsv(p) << std::endl
- << "point: " << dsv(p) << std::endl
+ << "point: " << dsv(p1) << std::endl
         << "point tuples: " << dsv(p2) << std::endl
         ;
 
@@ -54,8 +53,9 @@
 Output:
 [pre
 box: ((1, 1), (2, 2))
-first: (1, 1)
-second: (2, 2)
+polygon: (((1, 1), (1, 2), (2, 2), (2, 1), (1, 1)))
+point: (1, 1)
+point tuples: (1, 1)
 ]
 */
 //]

Added: trunk/libs/geometry/doc/src/examples/algorithms/convert.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/convert.cpp 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -0,0 +1,59 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is 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)
+
+//[convert
+//` Shows how to convert a geometry into another geometry
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> point;
+ typedef boost::geometry::model::box<point> box;
+ typedef boost::geometry::model::polygon<point> polygon;
+
+ point p1(1, 1);
+ box bx = boost::geometry::make<box>(1, 1, 2, 2);
+
+ // Assign a box to a polygon (conversion box->poly)
+ polygon poly;
+ boost::geometry::convert(bx, poly);
+
+ // Convert a point to another point type (conversion of point-type)
+ boost::tuple<double, double> p2;
+ boost::geometry::convert(p1, p2); // source -> target
+
+ using boost::geometry::dsv;
+ std::cout
+ << "box: " << dsv(bx) << std::endl
+ << "polygon: " << dsv(poly) << std::endl
+ << "point: " << dsv(p1) << std::endl
+ << "point tuples: " << dsv(p2) << std::endl
+ ;
+
+ return 0;
+}
+
+//]
+
+
+//[convert_output
+/*`
+Output:
+[pre
+box: ((1, 1), (2, 2))
+polygon: (((1, 1), (1, 2), (2, 2), (2, 1), (1, 1)))
+point: (1, 1)
+point tuples: (1, 1)
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/convex_hull.cpp 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -0,0 +1,54 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is 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)
+
+//[convex_hull
+//` Shows how to generate the convex_hull of a geometry
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+
+/*<-*/ #include "create_svg_two.hpp" /*->*/
+int main()
+{
+ typedef boost::tuple<double, double> point;
+ typedef boost::geometry::model::polygon<point> polygon;
+
+ polygon poly;
+ boost::geometry::read_wkt("polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
+ ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))", poly);
+
+ polygon hull;
+ boost::geometry::convex_hull(poly, hull);
+
+ using boost::geometry::dsv;
+ std::cout
+ << "polygon: " << dsv(poly) << std::endl
+ << "hull: " << dsv(hull) << std::endl
+ ;
+
+ /*<-*/ create_svg("envelope.svg", poly, hull); /*->*/
+ return 0;
+}
+
+//]
+
+
+//[convex_hull_output
+/*`
+Output:
+[pre
+polygon: (((2, 1.3), (2.4, 1.7), (2.8, 1.8), (3.4, 1.2), (3.7, 1.6), (3.4, 2), (4.1, 3), (5.3, 2.6), (5.4, 1.2), (4.9, 0.8), (2.9, 0.7), (2, 1.3)))
+hull: (((2, 1.3), (2.4, 1.7), (4.1, 3), (5.3, 2.6), (5.4, 1.2), (4.9, 0.8), (2.9, 0.7), (2, 1.3)))
+
+[$img/algorithms/convex_hull.png]
+]
+*/
+//]

Modified: trunk/libs/geometry/test/algorithms/assign.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/assign.cpp (original)
+++ trunk/libs/geometry/test/algorithms/assign.cpp 2011-04-16 09:17:50 EDT (Sat, 16 Apr 2011)
@@ -143,7 +143,7 @@
     bg::assign_values(p, 1, 2);
 
     box_type b;
- bg::assign_rev(b, p);
+ bg::assign(b, p);
 
     BOOST_CHECK_CLOSE((bg::get<0, 0>(b)), 1.0, 0.001);
     BOOST_CHECK_CLOSE((bg::get<0, 1>(b)), 2.0, 0.001);
@@ -157,7 +157,7 @@
     bg::set<bg::max_corner, 1>(b, 4);
         
     ring_type ring;
- bg::assign_rev(ring, b);
+ bg::assign(ring, b);
 
     //std::cout << bg::wkt(b) << std::endl;
     //std::cout << bg::wkt(ring) << std::endl;
@@ -183,11 +183,12 @@
 
     polygon_type polygon;
 
- bg::assign_rev(polygon, ring);
+ bg::assign(polygon, ring);
     BOOST_CHECK_EQUAL(bg::num_points(polygon), 5u);
 
- bg::assign_rev(ring, polygon);
- BOOST_CHECK_EQUAL(bg::num_points(ring), 5u);
+ ring_type ring2;
+ bg::assign(ring2, polygon);
+ BOOST_CHECK_EQUAL(bg::num_points(ring2), 5u);
 }
 
 


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