![]() |
![]() |
Copyright © 1995-2012 Barend Gehrels, Geodan, Amsterdam, the Netherlands.
Copyright © 2008-2012 Bruno Lalande, Paris, France.
Copyright © 2010-2012 Mateusz Loskot, Cadcorp, London, UK.
Distributed under 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)
Boost.Geometry, formally accepted by Boost, defines concepts "concepts" for geometries and implements some algorithms on such geometries. Before acceptance by Boost it was known as GGL (Generic Geometry Library) and this documentation still contains that name on various places.
Boost.Geometry contains a dimension-agnostic, coordinate-system-agnostic and scalable kernel, based on concepts, meta-functions and tag- dispatching. On top of that kernel, algorithms are built: area, length, perimeter, centroid, convex hull, intersection (clipping), within (point in polygon), distance, envelope (bounding box), simplify, transform, convert, and more. The library is also designed to support high precision arithmetic numbers, such as GMP.
Boost.Geometry contains instantiable geometry classes, but library users can also use their own. Using registration macros or traits classes their geometries can be adapted to fulfil the Boost.Geometry Concepts.
Boost.Geometry might be used in all domains where geometry plays a role: mapping and GIS, gaming, computer graphics and widgets, robotics, astronomy... The core is designed to be as generic as possible and support those domains. However, for now the development has been mostly GIS-oriented.
Boost.Geometry supports the extension model, the same way as GIL also applies it. An extension is (mostly) something more specific to domains like mentioned above.
The library follows existing conventions:
The library can be downloaded from the Boost Sandbox, go to the Download page for more information.
A (recently started) Wiki is here: http://trac.osgeo.org/ggl/wiki
It is not possible to show the whole library at a glance. A few very small examples are shown below.
It should be possible to use a very small part of the library, for example only the distance between two points.
Other often used algorithms are point-in-polygon:
or area:
It is possible, by the nature of a template library, to mix the point types declared above:
The pieces above generate this output:
It is also possible to use non-Cartesian points. For example: points on a sphere. When then an algorithm such as distance is used the library "inspects" that it is handling spherical points and calculates the distance over the sphere, instead of applying the Pythagorean theorem.
Finally an example from a totally different domain: developing window-based applications, for example using QtWidgets. We check if two rectangles overlap and if so, move the second one to another place:
More examples are on the page Examples
April 2, 2011 |
Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands Copyright © 2008-2011 Bruno Lalande, Paris, France Copyright © 2009-2010 Mateusz Loskot, London, UK |