|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70711 - in trunk/libs/geometry/doc: . doxy generated html/img/algorithms reference/algorithms src/examples/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-03-29 17:22:01
Author: barendgehrels
Date: 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
New Revision: 70711
URL: http://svn.boost.org/trac/boost/changeset/70711
Log:
Documented area,centroid,within
Renamed combine to expand
Added:
trunk/libs/geometry/doc/generated/within_status.qbk (contents, props changed)
trunk/libs/geometry/doc/html/img/algorithms/centroid.png (contents, props changed)
trunk/libs/geometry/doc/html/img/algorithms/envelope.png (contents, props changed)
trunk/libs/geometry/doc/html/img/algorithms/make_envelope.png (contents, props changed)
trunk/libs/geometry/doc/html/img/algorithms/within.png (contents, props changed)
trunk/libs/geometry/doc/reference/algorithms/centroid_strategies.qbk (contents, props changed)
trunk/libs/geometry/doc/reference/algorithms/within.qbk (contents, props changed)
trunk/libs/geometry/doc/src/examples/algorithms/centroid.cpp (contents, props changed)
trunk/libs/geometry/doc/src/examples/algorithms/distance.cpp (contents, props changed)
trunk/libs/geometry/doc/src/examples/algorithms/within.cpp (contents, props changed)
Text files modified:
trunk/libs/geometry/doc/doxy/Doxyfile | 1 -
trunk/libs/geometry/doc/generated/area_status.qbk | 18 +++++++++---------
trunk/libs/geometry/doc/imports.qbk | 3 +++
trunk/libs/geometry/doc/make_qbk.py | 4 ++--
trunk/libs/geometry/doc/quickref.xml | 8 ++++----
trunk/libs/geometry/doc/reference.qbk | 8 ++++----
trunk/libs/geometry/doc/reference/algorithms/centroid.qbk | 20 ++++++++++++++++++--
trunk/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp | 9 ++++++++-
8 files changed, 48 insertions(+), 23 deletions(-)
Modified: trunk/libs/geometry/doc/doxy/Doxyfile
==============================================================================
--- trunk/libs/geometry/doc/doxy/Doxyfile (original)
+++ trunk/libs/geometry/doc/doxy/Doxyfile 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -178,7 +178,6 @@
../../../../boost/geometry/algorithms/detail/sections \
../../../../boost/geometry/arithmetic \
../../../../boost/geometry/geometries/concepts \
- ../../../../boost/geometry/geometries/concepts/detail \
../../../../boost/geometry/geometries \
../../../../boost/geometry/geometries/adapted \
../../../../boost/geometry/geometries/register \
Modified: trunk/libs/geometry/doc/generated/area_status.qbk
==============================================================================
--- trunk/libs/geometry/doc/generated/area_status.qbk (original)
+++ trunk/libs/geometry/doc/generated/area_status.qbk 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -1,13 +1,13 @@
[heading Supported geometries]
[table
[[Geometry][Status]]
-[[Point][ [$img/ok.png ] ]]
-[[Segment][ [$img/ok.png ] ]]
-[[Box][ [$img/ok.png ] ]]
-[[Linestring][ [$img/ok.png ] ]]
-[[Ring][ [$img/ok.png ] ]]
-[[Polygon][ [$img/ok.png ] ]]
-[[MultiPoint][ [$img/ok.png ] ]]
-[[MultiLinestring][ [$img/ok.png ] ]]
-[[MultiPolygon][ [$img/ok.png ] ]]
+[[Point][[$img/ok.png]]]
+[[Segment][[$img/ok.png]]]
+[[Box][[$img/ok.png]]]
+[[Linestring][[$img/ok.png]]]
+[[Ring][[$img/ok.png]]]
+[[Polygon][[$img/ok.png]]]
+[[MultiPoint][[$img/ok.png]]]
+[[MultiLinestring][[$img/ok.png]]]
+[[MultiPolygon][[$img/ok.png]]]
]
Added: trunk/libs/geometry/doc/generated/within_status.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/generated/within_status.qbk 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -0,0 +1,5 @@
+[heading Supported geometries]
+[table
+[[ ][Box][Ring][Polygon][MultiPolygon]]
+[[Point][[$img/ok.png]][[$img/ok.png]][[$img/ok.png]][[$img/ok.png]]]
+]
Added: trunk/libs/geometry/doc/html/img/algorithms/centroid.png
==============================================================================
Binary file. No diff available.
Added: trunk/libs/geometry/doc/html/img/algorithms/envelope.png
==============================================================================
Binary file. No diff available.
Added: trunk/libs/geometry/doc/html/img/algorithms/make_envelope.png
==============================================================================
Binary file. No diff available.
Added: trunk/libs/geometry/doc/html/img/algorithms/within.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-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -21,6 +21,8 @@
[import src/examples/algorithms/assign_with_range.cpp]
[import src/examples/algorithms/assign_point_to_index.cpp]
[import src/examples/algorithms/assign_point_from_index.cpp]
+[import src/examples/algorithms/centroid.cpp]
+[import src/examples/algorithms/distance.cpp]
[import src/examples/algorithms/difference.cpp]
[import src/examples/algorithms/difference_inserter.cpp]
[import src/examples/algorithms/envelope.cpp]
@@ -45,6 +47,7 @@
[import src/examples/algorithms/simplify_inserter.cpp]
[import src/examples/algorithms/sym_difference.cpp]
[import src/examples/algorithms/union.cpp]
+[import src/examples/algorithms/within.cpp]
[import src/examples/core/get_point.cpp]
[import src/examples/core/get_box.cpp]
[import src/examples/core/set_point.cpp]
Modified: trunk/libs/geometry/doc/make_qbk.py
==============================================================================
--- trunk/libs/geometry/doc/make_qbk.py (original)
+++ trunk/libs/geometry/doc/make_qbk.py 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -68,9 +68,9 @@
call_doxygen()
algorithms = ["append", "assign", "make", "clear"
- , "area", "buffer", "centroid", "combine", "convert", "correct"
+ , "area", "buffer", "centroid", "convert", "correct"
, "convex_hull", "difference", "disjoint", "distance"
- , "envelope", "equals", "for_each", "intersection", "intersects"
+ , "envelope", "equals", "expand", "for_each", "intersection", "intersects"
, "length", "num_geometries", "num_interior_rings", "num_points"
, "overlaps", "perimeter", "reverse", "simplify", "sym_difference"
, "transform", "union", "unique", "within"]
Modified: trunk/libs/geometry/doc/quickref.xml
==============================================================================
--- trunk/libs/geometry/doc/quickref.xml (original)
+++ trunk/libs/geometry/doc/quickref.xml 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -315,10 +315,6 @@
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.algorithms.clear">clear</link></member>
</simplelist>
- <bridgehead renderas="sect3">Combine</bridgehead>
- <simplelist type="vert" columns="1">
- <member><link linkend="geometry.reference.algorithms.combine">combine</link></member>
- </simplelist>
<bridgehead renderas="sect3">Convert</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.algorithms.convert">convert</link></member>
@@ -348,6 +344,10 @@
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.algorithms.envelope">envelope</link></member>
</simplelist>
+ <bridgehead renderas="sect3">Expand</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="geometry.reference.algorithms.expand">expand</link></member>
+ </simplelist>
<bridgehead renderas="sect3">For Each</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="geometry.reference.algorithms.for_each">for each (point, segment)</link></member>
Modified: trunk/libs/geometry/doc/reference.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference.qbk (original)
+++ trunk/libs/geometry/doc/reference.qbk 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -69,10 +69,6 @@
[include generated/clear.qbk]
[endsect]
-[section:combine combine]
-[include generated/combine.qbk]
-[endsect]
-
[section:convert convert]
[include generated/convert.qbk]
[endsect]
@@ -105,6 +101,10 @@
[include generated/equals.qbk]
[endsect]
+[section:expand expand]
+[include generated/expand.qbk]
+[endsect]
+
[section:for_each for_each]
[include generated/for_each.qbk]
[endsect]
Modified: trunk/libs/geometry/doc/reference/algorithms/centroid.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/algorithms/centroid.qbk (original)
+++ trunk/libs/geometry/doc/reference/algorithms/centroid.qbk 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -14,10 +14,26 @@
[table
[[Case] [Behavior] ]
[[__point__][Returns the point itself as the centroid]]
-[[__multi_point__][Calculates centroid]]
-[[__1dim__][Calculates centroid]]
+[[__multi_point__][Calculates centroid (based on average)]]
+[[__1dim__][Calculates centroid (based on weighted length)]]
[[__2dim__][Calculates centroid]]
[[__empty__][Throws a [link geometry.reference.exceptions.centroid_exception centroid_exception] ]]
+[[__cart__][Implemented]]
+[[__sph__][Calculates the centroid as if based on Cartesian coordinates]]
+]
+
+[heading Supported geometries]
+[table
+[[ ][2D][3D]]
+[[Point][[$img/ok.png]][[$img/ok.png]]]
+[[Segment][[$img/ok.png]][[$img/ok.png]]]
+[[Box][[$img/ok.png]][[$img/ok.png]]]
+[[Linestring][[$img/ok.png]][[$img/nyi.png]]]
+[[Ring][[$img/ok.png]][[$img/nyi.png]]]
+[[Polygon][[$img/ok.png]][[$img/nyi.png]]]
+[[MultiPoint][[$img/ok.png]][[$img/ok.png]]]
+[[MultiLinestring][[$img/ok.png]][[$img/nyi.png]]]
+[[MultiPolygon][[$img/ok.png]][[$img/nyi.png]]]
]
[heading Complexity]
Added: trunk/libs/geometry/doc/reference/algorithms/centroid_strategies.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/centroid_strategies.qbk 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -0,0 +1,14 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Geodan, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot (mateusz_at_[hidden])
+ 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 Available Strategies]
+* [link geometry.reference.strategies.strategy_centroid_bashein_detmer Bashein Detmer (cartesian)]
Added: trunk/libs/geometry/doc/reference/algorithms/within.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/reference/algorithms/within.qbk 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -0,0 +1,25 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2009-2011 Barend Gehrels, Geodan, Amsterdam, the Netherlands.
+ Copyright (c) 2009-2011 Mateusz Loskot (mateusz_at_[hidden])
+ 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/within_status.qbk]
+
+[heading Notes]
+If a point is located exactly on the border of a geometry, the result depends on the strategy.
+The default strategy ([link geometry.reference.strategies.strategy_within_winding Winding (coordinate system agnostic)])
+returns false in that case.
+
+If a polygon has a reverse oriented (e.g. counterclockwise for a clockwise typed polygon), the result also depends on the strategy.
+The default strategy returns still true if a point is completely within the reversed polygon. There is a specific strategy which returns false in this case.
+
+[heading Complexity]
+Linear
+
Added: trunk/libs/geometry/doc/src/examples/algorithms/centroid.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/centroid.cpp 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -0,0 +1,52 @@
+// 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)
+
+
+//[centroid
+//` Shows calculation of a centroid of a polygon
+
+#include <iostream>
+#include <list>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
+/*<-*/ #include "create_svg_two.hpp" /*->*/
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> point_type;
+ typedef boost::geometry::model::polygon<point_type> polygon_type;
+
+ polygon_type poly;
+ boost::geometry::read_wkt(
+ "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)"
+ "(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", poly);
+
+ point_type p;
+ boost::geometry::centroid(poly, p);
+
+ std::cout << "centroid: " << boost::geometry::dsv(p) << std::endl;
+ /*<-*/ create_svg("centroid.svg", poly, p); /*->*/
+ return 0;
+}
+
+//]
+
+//[centroid_output
+/*`
+Output:
+[pre
+centroid: (4.04663, 1.6349)
+[$img/algorithms/centroid.png]
+]
+Note that the centroid might be located in a hole or outside a polygon, easily.
+*/
+//]
Modified: trunk/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/create_svg_two.hpp 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -28,7 +28,14 @@
mapper.add(b);
mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2");
- mapper.map(b, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ if (boost::geometry::geometry_id<Geometry2>::value == 1)
+ {
+ mapper.map(b, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
+ }
+ else
+ {
+ mapper.map(b, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
+ }
}
// NOTE: convert manually from svg to png using Inkscape ctrl-shift-E
Added: trunk/libs/geometry/doc/src/examples/algorithms/distance.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/distance.cpp 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -0,0 +1,65 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// 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)
+
+// Quickbook Example
+
+//[distance
+//` Shows calculation of distance of point to some other geometries
+
+#include <iostream>
+#include <list>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/multi/geometries/multi_point.hpp>
+
+#include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
+
+#include <boost/foreach.hpp>
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> point_type;
+ typedef boost::geometry::model::polygon<point_type> polygon_type;
+ typedef boost::geometry::model::linestring<point_type> linestring_type;
+ typedef boost::geometry::model::multi_point<point_type> multi_point_type;
+
+ point_type p(1,2);
+ polygon_type poly;
+ linestring_type line;
+ multi_point_type mp;
+
+ boost::geometry::read_wkt(
+ "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)"
+ "(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", poly);
+ line.push_back(point_type(0,0));
+ line.push_back(point_type(0,3));
+ mp.push_back(point_type(0,0));
+ mp.push_back(point_type(3,3));
+
+ std::cout << "distance: " << boost::geometry::distance(p, poly) << std::endl;
+ std::cout << "distance: " << boost::geometry::distance(p, line) << std::endl;
+ std::cout << "distance: " << boost::geometry::distance(p, mp) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[distance_output
+/*`
+Output:
+[pre
+distance: 1.22066
+distance: 1
+distance: 2.23607
+]
+*/
+//]
+
Added: trunk/libs/geometry/doc/src/examples/algorithms/within.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/within.cpp 2011-03-29 17:21:58 EDT (Tue, 29 Mar 2011)
@@ -0,0 +1,52 @@
+// 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)
+
+
+//[within
+//` Shows how to detect if a point is inside a polygon, or not
+
+#include <iostream>
+#include <list>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
+/*<-*/ #include "create_svg_two.hpp" /*->*/
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> point_type;
+ typedef boost::geometry::model::polygon<point_type> polygon_type;
+
+ polygon_type poly;
+ boost::geometry::read_wkt(
+ "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)"
+ "(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))", poly);
+
+ point_type p(4, 1);
+
+ std::cout << "within: " << (boost::geometry::within(p, poly) ? "yes" : "no") << std::endl;
+ /*<-*/ create_svg("within.svg", poly, p); /*->*/
+ return 0;
+}
+
+//]
+
+//[within_output
+/*`
+Output:
+[pre
+within: yes
+
+[$img/algorithms/within.png]
+]
+
+*/
+//]
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