diff --git a/doc/html/img/algorithms/covered_by.png b/doc/html/img/algorithms/covered_by.png
new file mode 100644
index 0000000000..e43d1da4b3
Binary files /dev/null and b/doc/html/img/algorithms/covered_by.png differ
diff --git a/doc/html/img/algorithms/crosses.png b/doc/html/img/algorithms/crosses.png
new file mode 100644
index 0000000000..e5b9716f91
Binary files /dev/null and b/doc/html/img/algorithms/crosses.png differ
diff --git a/doc/html/img/algorithms/disjoint.png b/doc/html/img/algorithms/disjoint.png
new file mode 100644
index 0000000000..8cf6988ef8
Binary files /dev/null and b/doc/html/img/algorithms/disjoint.png differ
diff --git a/doc/html/img/algorithms/overlaps.png b/doc/html/img/algorithms/overlaps.png
new file mode 100644
index 0000000000..bc43df08fe
Binary files /dev/null and b/doc/html/img/algorithms/overlaps.png differ
diff --git a/doc/html/img/algorithms/touches_one_geometry.png b/doc/html/img/algorithms/touches_one_geometry.png
new file mode 100644
index 0000000000..18e384ffac
Binary files /dev/null and b/doc/html/img/algorithms/touches_one_geometry.png differ
diff --git a/doc/html/img/algorithms/touches_two_geometries.png b/doc/html/img/algorithms/touches_two_geometries.png
new file mode 100644
index 0000000000..49dae63e91
Binary files /dev/null and b/doc/html/img/algorithms/touches_two_geometries.png differ
diff --git a/doc/imports.qbk b/doc/imports.qbk
index a3e8f4e592..c15921558f 100644
--- a/doc/imports.qbk
+++ b/doc/imports.qbk
@@ -31,12 +31,15 @@
[import src/examples/algorithms/convert.cpp]
[import src/examples/algorithms/convex_hull.cpp]
[import src/examples/algorithms/correct.cpp]
+[import src/examples/algorithms/covered_by.cpp]
+[import src/examples/algorithms/crosses.cpp]
[import src/examples/algorithms/densify.cpp]
[import src/examples/algorithms/densify_strategy.cpp]
[import src/examples/algorithms/discrete_frechet_distance.cpp]
[import src/examples/algorithms/discrete_frechet_distance_strategy.cpp]
[import src/examples/algorithms/discrete_hausdorff_distance.cpp]
[import src/examples/algorithms/discrete_hausdorff_distance_strategy.cpp]
+[import src/examples/algorithms/disjoint.cpp]
[import src/examples/algorithms/distance.cpp]
[import src/examples/algorithms/difference.cpp]
[import src/examples/algorithms/envelope.cpp]
@@ -66,12 +69,16 @@
[import src/examples/algorithms/num_interior_rings.cpp]
[import src/examples/algorithms/num_points.cpp]
[import src/examples/algorithms/num_segments.cpp]
+[import src/examples/algorithms/overlaps.cpp]
+[import src/examples/algorithms/perimeter.cpp]
[import src/examples/algorithms/relate.cpp]
[import src/examples/algorithms/relation.cpp]
[import src/examples/algorithms/reverse.cpp]
[import src/examples/algorithms/return_envelope.cpp]
[import src/examples/algorithms/simplify.cpp]
[import src/examples/algorithms/sym_difference.cpp]
+[import src/examples/algorithms/touches_one_geometry.cpp]
+[import src/examples/algorithms/touches_two_geometries.cpp]
[import src/examples/algorithms/transform.cpp]
[import src/examples/algorithms/transform_with_strategy.cpp]
[import src/examples/algorithms/union.cpp]
diff --git a/doc/src/examples/algorithms/covered_by.cpp b/doc/src/examples/algorithms/covered_by.cpp
new file mode 100644
index 0000000000..72eee97ef3
--- /dev/null
+++ b/doc/src/examples/algorithms/covered_by.cpp
@@ -0,0 +1,70 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[covered_by
+//` Checks if the first geometry is inside or on border the second geometry
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Checks if the first geometry is inside or on border the second geometry.
+ bg::model::polygon > poly1;
+ bg::read_wkt("POLYGON((0 2,0 3,2 4,1 2,0 2))", poly1);
+ bg::model::polygon > poly2;
+ bg::read_wkt("POLYGON((0 4,3 4,2 2,0 1,0 4))", poly2);
+ bool check_covered = bg::covered_by(poly1, poly2);
+ if (check_covered) {
+ std::cout << "Covered: Yes" << std::endl;
+ } else {
+ std::cout << "Covered: No" << std::endl;
+ }
+
+ bg::model::polygon > poly3;
+ bg::read_wkt("POLYGON((-1 -1,-3 -4,-7 -7,-4 -3,-1 -1))", poly3);
+ check_covered = bg::covered_by(poly1, poly3);
+ if (check_covered) {
+ std::cout << "Covered: Yes" << std::endl;
+ } else {
+ std::cout << "Covered: No" << std::endl;
+ }
+
+ // This should return true since both polygons are same, so they are lying on each other.
+ check_covered = bg::covered_by(poly1, poly1);
+ if (check_covered) {
+ std::cout << "Covered: Yes" << std::endl;
+ } else {
+ std::cout << "Covered: No" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
+
+//[covered_by_output
+/*`
+Output:
+[pre
+Covered: Yes
+
+[$img/algorithms/covered_by.png]
+
+Covered: No
+Covered: Yes
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/crosses.cpp b/doc/src/examples/algorithms/crosses.cpp
new file mode 100644
index 0000000000..c30380d718
--- /dev/null
+++ b/doc/src/examples/algorithms/crosses.cpp
@@ -0,0 +1,62 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[crosses
+//` Checks if two geometries crosses
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Checks if the two geometries (here, a polygon and a linestring) crosses or not.
+ bg::model::polygon > poly;
+ bg::read_wkt("POLYGON((0 0,0 3,3 3,3 0,0 0))", poly);
+ bg::model::linestring > line1;
+ bg::read_wkt("LINESTRING(1 1,2 2,4 4)", line1);
+ bool check_crosses = bg::crosses(poly, line1);
+ if (check_crosses) {
+ std::cout << "Crosses: Yes" << std::endl;
+ } else {
+ std::cout << "Crosses: No" << std::endl;
+ }
+
+ // Edge case: linestring just touches the polygon but doesn't crosses it.
+ bg::model::linestring > line2;
+ bg::read_wkt("LINESTRING(1 1,1 2,1 3)", line2);
+ check_crosses = bg::crosses(poly, line2);
+ if (check_crosses) {
+ std::cout << "Crosses: Yes" << std::endl;
+ } else {
+ std::cout << "Crosses: No" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
+
+//[crosses_output
+/*`
+Output:
+[pre
+Crosses: Yes
+Crosses: No
+
+[$img/algorithms/crosses.png]
+
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/disjoint.cpp b/doc/src/examples/algorithms/disjoint.cpp
new file mode 100644
index 0000000000..6beffc27aa
--- /dev/null
+++ b/doc/src/examples/algorithms/disjoint.cpp
@@ -0,0 +1,61 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[disjoint
+//` Checks if two geometries are disjoint
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Checks if two geometries are disjoint, which means that two geometries have zero intersection.
+ bg::model::polygon > poly1;
+ bg::read_wkt("POLYGON((0 2,-2 0,-4 2,-2 4,0 2))", poly1);
+ bg::model::polygon > poly2;
+ bg::read_wkt("POLYGON((2 2,4 4,6 2,4 0,2 2))", poly2);
+ bool check_disjoint = bg::disjoint(poly1, poly2);
+ if (check_disjoint) {
+ std::cout << "Disjoint: Yes" << std::endl;
+ } else {
+ std::cout << "Disjoint: No" << std::endl;
+ }
+
+ bg::model::polygon > poly3;
+ bg::read_wkt("POLYGON((0 2,2 4,4 2,2 0,0 2))", poly3);
+ check_disjoint = bg::disjoint(poly1, poly3);
+ if (check_disjoint) {
+ std::cout << "Disjoint: Yes" << std::endl;
+ } else {
+ std::cout << "Disjoint: No" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
+
+//[disjoint_output
+/*`
+Output:
+[pre
+Disjoint: Yes
+Disjoint: No
+
+[$img/algorithms/disjoint.png]
+
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/overlaps.cpp b/doc/src/examples/algorithms/overlaps.cpp
new file mode 100644
index 0000000000..497d5e17e3
--- /dev/null
+++ b/doc/src/examples/algorithms/overlaps.cpp
@@ -0,0 +1,61 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[overlaps
+//` Checks if two geometries overlap
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Checks if the two geometries overlaps or not.
+ bg::model::polygon > poly1;
+ bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,0 0))", poly1);
+ bg::model::polygon > poly2;
+ bg::read_wkt("POLYGON((2 2,2 6,6 7,6 1,2 2))", poly2);
+ bool check_overlap = bg::overlaps(poly1, poly2);
+ if (check_overlap) {
+ std::cout << "Overlaps: Yes" << std::endl;
+ } else {
+ std::cout << "Overlaps: No" << std::endl;
+ }
+
+ bg::model::polygon > poly3;
+ bg::read_wkt("POLYGON((-1 -1,-3 -4,-7 -7,-4 -3,-1 -1))", poly3);
+ check_overlap = bg::overlaps(poly1, poly3);
+ if (check_overlap) {
+ std::cout << "Overlaps: Yes" << std::endl;
+ } else {
+ std::cout << "Overlaps: No" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
+
+//[overlaps_output
+/*`
+Output:
+[pre
+Overlaps: Yes
+
+[$img/algorithms/overlaps.png]
+
+Overlaps: No
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/perimeter.cpp b/doc/src/examples/algorithms/perimeter.cpp
new file mode 100644
index 0000000000..130d8fdee5
--- /dev/null
+++ b/doc/src/examples/algorithms/perimeter.cpp
@@ -0,0 +1,42 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[perimeter
+//` Calculate the perimeter of a polygon
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Calculate the perimeter of a cartesian polygon
+ bg::model::polygon > poly;
+ bg::read_wkt("POLYGON((0 0,3 4,5 -5,-2 -4, 0 0))", poly);
+ double perimeter = bg::perimeter(poly);
+ std::cout << "Perimeter: " << perimeter << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[perimeter_output
+/*`
+Output:
+[pre
+Perimeter: 25.7627
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/touches_one_geometry.cpp b/doc/src/examples/algorithms/touches_one_geometry.cpp
new file mode 100644
index 0000000000..08de4b57dc
--- /dev/null
+++ b/doc/src/examples/algorithms/touches_one_geometry.cpp
@@ -0,0 +1,59 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[touches
+//` Checks if a geometry has at least one touching point (self-tangency)
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Checks if the geometry has self-tangency.
+ bg::model::polygon > poly1;
+ bg::read_wkt("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2,3 2,3 0,0 0))", poly1);
+ bool check_touches = bg::touches(poly1);
+ if (check_touches) {
+ std::cout << "Touches: Yes" << std::endl;
+ } else {
+ std::cout << "Touches: No" << std::endl;
+ }
+
+ bg::model::polygon > poly2;
+ bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,2 3,0 0))", poly2);
+ check_touches = bg::touches(poly2);
+ if (check_touches) {
+ std::cout << "Touches: Yes" << std::endl;
+ } else {
+ std::cout << "Touches: No" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
+
+//[touches_output
+/*`
+Output:
+[pre
+Touches: Yes
+
+[$img/algorithms/touches_one_geometry.png]
+
+Touches: No
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/touches_two_geometries.cpp b/doc/src/examples/algorithms/touches_two_geometries.cpp
new file mode 100644
index 0000000000..bcae41d924
--- /dev/null
+++ b/doc/src/examples/algorithms/touches_two_geometries.cpp
@@ -0,0 +1,61 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
+
+// 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)
+
+//[touches
+//` Checks if two geometries have at least one touching point (tangent - non overlapping)
+
+#include
+
+#include
+#include
+#include
+
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
+
+int main()
+{
+ // Checks if the two geometries overlaps or not.
+ bg::model::polygon > poly1;
+ bg::read_wkt("POLYGON((0 0,0 4,4 4,4 0,0 0))", poly1);
+ bg::model::polygon > poly2;
+ bg::read_wkt("POLYGON((0 0,0 -4,-4 -4,-4 0,0 0))", poly2);
+ bool check_touches = bg::touches(poly1, poly2);
+ if (check_touches) {
+ std::cout << "Touches: Yes" << std::endl;
+ } else {
+ std::cout << "Touches: No" << std::endl;
+ }
+
+ bg::model::polygon > poly3;
+ bg::read_wkt("POLYGON((1 1,0 -4,-4 -4,-4 0,1 1))", poly3);
+ check_touches = bg::touches(poly1, poly3);
+ if (check_touches) {
+ std::cout << "Touches: Yes" << std::endl;
+ } else {
+ std::cout << "Touches: No" << std::endl;
+ }
+
+ return 0;
+}
+
+//]
+
+
+//[touches_output
+/*`
+Output:
+[pre
+Touches: Yes
+
+[$img/algorithms/touches_two_geometries.png]
+
+Touches: No
+]
+*/
+//]
diff --git a/include/boost/geometry/algorithms/crosses.hpp b/include/boost/geometry/algorithms/crosses.hpp
index c9e3651ab2..6dcbdbe9d4 100644
--- a/include/boost/geometry/algorithms/crosses.hpp
+++ b/include/boost/geometry/algorithms/crosses.hpp
@@ -252,6 +252,11 @@ inline bool crosses(Geometry1 const& geometry1,
\return \return_check2{crosses}
\qbk{[include reference/algorithms/crosses.qbk]}
+\qbk{
+[heading Examples]
+[crosses]
+[crosses_output]
+}
*/
template
inline bool crosses(Geometry1 const& geometry1, Geometry2 const& geometry2)
diff --git a/include/boost/geometry/algorithms/detail/covered_by/interface.hpp b/include/boost/geometry/algorithms/detail/covered_by/interface.hpp
index bdc92db43b..4749ed1684 100644
--- a/include/boost/geometry/algorithms/detail/covered_by/interface.hpp
+++ b/include/boost/geometry/algorithms/detail/covered_by/interface.hpp
@@ -217,7 +217,11 @@ struct covered_by<
\note The default strategy is used for covered_by detection
\qbk{[include reference/algorithms/covered_by.qbk]}
-
+\qbk{
+[heading Examples]
+[covered_by]
+[covered_by_output]
+}
*/
template
inline bool covered_by(Geometry1 const& geometry1, Geometry2 const& geometry2)
diff --git a/include/boost/geometry/algorithms/detail/disjoint/interface.hpp b/include/boost/geometry/algorithms/detail/disjoint/interface.hpp
index 64898e35fe..fc4aecbb03 100644
--- a/include/boost/geometry/algorithms/detail/disjoint/interface.hpp
+++ b/include/boost/geometry/algorithms/detail/disjoint/interface.hpp
@@ -228,6 +228,11 @@ inline bool disjoint(Geometry1 const& geometry1,
\return \return_check2{are disjoint}
\qbk{[include reference/algorithms/disjoint.qbk]}
+\qbk{
+[heading Examples]
+[disjoint]
+[disjoint_output]
+}
*/
template
inline bool disjoint(Geometry1 const& geometry1,
diff --git a/include/boost/geometry/algorithms/detail/overlaps/interface.hpp b/include/boost/geometry/algorithms/detail/overlaps/interface.hpp
index f9f6a853fd..088b51fe2e 100644
--- a/include/boost/geometry/algorithms/detail/overlaps/interface.hpp
+++ b/include/boost/geometry/algorithms/detail/overlaps/interface.hpp
@@ -99,6 +99,11 @@ inline bool overlaps(Geometry1 const& geometry1,
\return \return_check2{overlap}
\qbk{[include reference/algorithms/overlaps.qbk]}
+\qbk{
+[heading Examples]
+[overlaps]
+[overlaps_output]
+}
*/
template
inline bool overlaps(Geometry1 const& geometry1, Geometry2 const& geometry2)
diff --git a/include/boost/geometry/algorithms/detail/touches/interface.hpp b/include/boost/geometry/algorithms/detail/touches/interface.hpp
index d2e0cc8c4e..9f41b36086 100644
--- a/include/boost/geometry/algorithms/detail/touches/interface.hpp
+++ b/include/boost/geometry/algorithms/detail/touches/interface.hpp
@@ -261,6 +261,11 @@ struct self_touches >
\qbk{distinguish,one geometry}
\qbk{[def __one_parameter__]}
\qbk{[include reference/algorithms/touches.qbk]}
+\qbk{
+[heading Examples]
+[touches_one_geometry]
+[touches_one_geometry_output]
+}
*/
template
inline bool touches(Geometry const& geometry)
@@ -280,6 +285,11 @@ inline bool touches(Geometry const& geometry)
\qbk{distinguish,two geometries}
\qbk{[include reference/algorithms/touches.qbk]}
+\qbk{
+[heading Examples]
+[touches_two_geometries]
+[touches_two_geometries_output]
+}
*/
template
inline bool touches(Geometry1 const& geometry1, Geometry2 const& geometry2)
diff --git a/include/boost/geometry/algorithms/perimeter.hpp b/include/boost/geometry/algorithms/perimeter.hpp
index 47b0649727..f8fbb03a1d 100644
--- a/include/boost/geometry/algorithms/perimeter.hpp
+++ b/include/boost/geometry/algorithms/perimeter.hpp
@@ -192,6 +192,11 @@ struct perimeter >
\return \return_calc{perimeter}
\qbk{[include reference/algorithms/perimeter.qbk]}
+\qbk{
+[heading Example]
+[perimeter]
+[perimeter_output]
+}
*/
template
inline typename default_length_result::type perimeter(