Boost logo

Boost :

Subject: [boost] Proposal/InterestCheck: Boost.Geom
From: Anis Benyelloul (anis.benyelloul_at_[hidden])
Date: 2009-01-26 07:57:11

Hi people,

Boost.Geom purpose is to provide a unified, zero-cost and pretty interface
around existing geometric primitive implementations (for now only points and
rectangles in 2D and 3D).

I have uploaded the code+doc+tests in in the vault.

* The rest of this mail gives an idea about the rational behind the library
* If you still have time, the manual contains a chapter `Rational'
 ( that explains the library purpose in
 detail (please read that before answering)
* If you want to test it, the library is header-only and doesn't not depend on
anything else (not even other parts of boost), you only need to add an include
directory (see the manual chapters `Installation' and `Kick Start')

Rational (summary)

For illustrative purposes, say you are working with Qt (QPoint and QRect):

geom::point<QPoint> pt; // A QPoint instance behind a geom::point interface
geom::box<QRect> rc; // A QRect instance behind a geom::box interface

Now you can write code that uses pt and rc without having to worry about QPoint
and QRect. Further more, if later you port your code to, say, WxWidgets (WxPoint
and wxRect), all you have to do is to change the above two lines to:

geom::point<wxPoint> pt; // Now using wxPoint internally
geom::box<wxRect> rc; // Now using wxRect internally

And the rest of the code remains the same (since the interface presented by
geom::point<> and geom::box<> remains the same).

Key points
* Using QPoint directly is NOT faster than using geom::point<QPoint>.
* Using geom::point<QPoint> makes the rest of your code independent of QPoint
(so that you can easily switch to another library later),
* geom::point/geom::box provide a richer interface than most existing points and
rectangles implementations.
* The library provides it's own implementation types (that you can plug into
geom::point and geom::box) so you can test it even if you don't use Qt,
WxWidgets.. etc

I'll be happy to hear your opinion,

Links: (If you are reading this mail long after the date it was written (26 Jan
2009) these links might be broken, checkout the library archive in the vault

- Full manual
- Rational chapter
- Library archive (code+doc+tests) (int the vault)


-- Anis

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