![Page 1: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/1.jpg)
Boost.Geometry
Introduction to Boost.Geometry
presented by Mateusz Loskot (Cadcorp Ltd.)at FOSS4G 2010
![Page 2: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/2.jpg)
Boost.Geometry
mateusz loskot● OSGeo charter member, 2007
● GDAL/OGR maintainer 2006-2008
● contributor to OSGeo, GDAL/OGR, libLAS, WKT Raster, GEOS, PostGIS, Feature Data Objects, PROJ.4, libtiff, libgeotiff and others
● with Cadcorp since 2009
http://mateusz.loskot.net
![Page 3: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/3.jpg)
Boost.Geometry
contents● overview
● design
● features
● performance
![Page 4: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/4.jpg)
Boost.Geometry
overview
![Page 5: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/5.jpg)
Boost.Geometry
what is Boost.Geometry?
• a library dedicated to programmers
• collection of types and algorithms
• solving computational geometry problems
• written in C++ programming language
• header-only library
![Page 6: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/6.jpg)
Boost.Geometry
what is Boost?
full name: Boost C++ Libraries
http://boost.org/
“The Boost C++ Libraries are a collection of free libraries that extend the functionality of C++”
» Wikipedia
![Page 7: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/7.jpg)
Boost.Geometry
history (1)
• 1995 - Geodan Geographic Library
• 2008 - 1st preview for Boost as Geometry Library
• 2009 - 4th preview for Boost as Generic Geometry Library (GGL)
• November 2009 - final review and acceptance to Boost collection as Boost.Geometry
![Page 8: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/8.jpg)
Boost.Geometry
Boost review
• start on November 5, 2009• review manager: Hartmut Kaiser (Boost.Spirit)• 14 reviewers• finish on November 23, 2009• final report on November 28, 2009
– 12 votes Yes– 2 votes No– Several conditions of acceptance
![Page 9: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/9.jpg)
Boost.Geometry
conclusions
“The design is very clear. I think it can serve as a standard example of how to cover a big non trivial problem domain using meta-programming, partial
specialization and tag dispatch to make it uniformly accessible by a set of generic algorithms”
![Page 10: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/10.jpg)
Boost.Geometry
future
• incorporate to Boost C++ Libraries– work steadily moves on
• release– Boost 1.44? or 1.45 or 1.46 or ...
![Page 11: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/11.jpg)
Boost.Geometry
team
• Barend Gehrels at Geodan– lead developer and project manager
• Bruno Lalande– lead developer
• Mateusz Loskot– supporting developer
![Page 12: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/12.jpg)
Boost.Geometry
community
• GGL mailing list– http://lists.osgeo.org/mailman/listinfo/ggl– ~50 users
• Boost mailing lists– http://lists.boost.org– very large community with a couple of dozens
hackers discussing ideas for Boost.Geometry
![Page 13: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/13.jpg)
Boost.Geometry
users
• Merkaartor (Open Street Map)
• Open Graph Router
• Flight Logbook
• Games (Tangram)
• Geodan
![Page 14: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/14.jpg)
Boost.Geometry
guardian.co.uk
![Page 15: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/15.jpg)
Boost.Geometry
potential
?
![Page 16: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/16.jpg)
Boost.Geometry
design
![Page 17: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/17.jpg)
Boost.Geometry
challenges
to design and implement a library as
● generic● fast● robust● not specific to any domain● extensible
programming tool satisfying many with usable “explosion of capabilities”
![Page 18: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/18.jpg)
Boost.Geometry
technology
● C++ Programming Language● ISO/IEC 14882:2003
● C++ Standard Library
● Boost C++ Libraries
● Generic programming techniques
![Page 19: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/19.jpg)
Boost.Geometry
Metaprogramming(generic programming)
template+
instantiation+
compiler=
final source code of a specific program
![Page 20: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/20.jpg)
Boost.Geometry
metaprogramming techniques● templates – generic form of source (type)● metafunctions – generate type at compile-time,
type selection techniques, encapsulate computation algorithm
● traits – associates additional information● tag dispatching – uses traits to distinguish types
dispatch calls● concepts – non-intrusive design - “generate” your
own library of types and algorithms● compile-time strategy pattern
![Page 21: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/21.jpg)
Boost.Geometry
concepts and models
“A concept is a set of requirements consisting of valid expressions, associated types, invariants, and
complexity guarantees.”
“A type that satisfies the requirements is said to model the concept”
- David Abrahams and Jeremy Siek
![Page 22: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/22.jpg)
Boost.Geometry
strategies
template+
type parameters (traits)+
instantiation=
selection of algorithms
![Page 23: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/23.jpg)
Boost.Geometry
agnosticism of dimension● dimension
point<int, 1, cartesian>
polygon< point<double, 2, spherical<radian>>>
![Page 24: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/24.jpg)
Boost.Geometry
agnosticism of coordinate type (1)● support of different numeric types
point<int, 2, cartesian>
polygon< point<double, 3, spherical<radian>>>
![Page 25: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/25.jpg)
Boost.Geometry
agnosticism of coordinate type (2)● support arbitrary precision arithmetic numbers
● GMP and others (adapted by Boost.Math)● algorithms select most precise type :
● int + int → int● int + float → float● int + GMP → GMP● GMP + double → GMP
![Page 26: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/26.jpg)
Boost.Geometry
agnosticism of coordinate space● points instantiated with coordinate system● support user-defined coordinate systems● traits and tag dispatching delegate computations to
strategies suitable for specified coordinate system
point<int, 1, cartesian>
polygon< point<double, 2, spherical<radian>>>
![Page 27: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/27.jpg)
Boost.Geometry
features
![Page 28: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/28.jpg)
Boost.Geometry
![Page 29: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/29.jpg)
Boost.Geometry
Adapted:Boost.Tuple, Boost.Array, C Array, std::vector, std::deque, std::pair
![Page 30: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/30.jpg)
Boost.Geometry
![Page 31: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/31.jpg)
Boost.Geometry
![Page 32: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/32.jpg)
Boost.Geometry
![Page 33: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/33.jpg)
Boost.Geometry
![Page 34: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/34.jpg)
Boost.Geometry
![Page 35: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/35.jpg)
Boost.Geometry
![Page 36: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/36.jpg)
Boost.Geometry
![Page 37: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/37.jpg)
Boost.Geometry
![Page 38: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/38.jpg)
Boost.Geometry
performance
![Page 39: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/39.jpg)
Boost.Geometry
http://trac.osgeo.org/ggl/wiki/Performance
“We are aware of the weaknesses of performance tests and that it is hard to design objective benchmarks”
“There are so many differences in behaviour in all libraries under different circumstances, it appeared to be impossible or at least very difficult to compare libraries
in one benchmark”
Try it yourself! http://svn.osgeo.org/osgeo/foss4g/benchmarking/geometry_libraries/
![Page 40: Introduction to Boost.Geometry - FOSS4G2010.foss4g.org/presentations/3785.pdfIntroduction to Boost.Geometry presented by Mateusz Loskot (Cadcorp Ltd.) at FOSS4G 2010. Boost.Geometry](https://reader034.vdocuments.us/reader034/viewer/2022042415/5f3049819f624b6c851842f8/html5/thumbnails/40.jpg)
Boost.Geometry
presented today with friendly support from Cadcorp
Thank you!
Boost.Geometryhttp://trac.osgeo.org/ggl/