Boost logo

Boost :

From: Barend Gehrels (barend_at_[hidden])
Date: 2008-01-14 08:36:12


Is there any interest in a template geometry library?

The library we are developing is basic 2D geometry library. In this
library, data structures are small and simple (but polygons can still
have holes). Nevertheless, the library provides a lot of useful
algorithms such as point-in-polygon, line intersections and polygon

We at Geodan are developing our library since 1995, and recently
restructured, simplified and enhanced the geometry core. Now that it is
clean and well designed, and still with years of experience, we aim to
publish it in Boost under the Boost Software License.

To give some impressions, points are like this:
template <typename T> class point {
inline const T& x() const (...)
inline const T& y() const (...)

and lines are completely empty, like this:
template <typename P>
class linestring : public std::vector<P> { };
(Besides that you can also specify another container).

Data and algorithms are separated, so there are algorithms like:
template <typename P, typename POL>
bool point_in_polygon(const P& p, const POL& pol);

and like this:
template <typename S1, typename S2, typename MP>
intersection_result intersection_segment(const S1& segment1, const S2&
segment2, MP& multipoint);

but also generic wrappers like a "within" algorithm which is defined for
all relevant geometry types
template <typename P1, typename P2>
inline bool within(const P& p, const polygon<P2>& poly)
Because the library is completely templatized, you can use your own
geometry types, and/or container types (provided that they follow the
basic interface).

The library follows std:: and boost:: standards and conventions, as well
as the OGC (The Consortium on Standards in Geographical Information
Systems) conventions.

I know there have been discussions before on geometry libraries and on
CGAL, e.g. We
are using boost in our library since about 2000.

If there is interest I will complete the documentation and examples
according to Boost standards, and prepare a submission.

Barend Gehrels

Barend Gehrels
Geodan Holding b.v.
President Kennedylaan 1
1079 MB Amsterdam, the Netherlands
E-mail: barend.gehrels_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at