Question

I have two questions:

1.) i^ve just found the boost 1.53 Polygon implementation (on http://www.boost.org/doc/libs/1_53_0/libs/polygon) and would like to test it, because the features are amazing for CAD programmers like me. (But i dont get the stuff with the template reinitialization "http://www.boost.org/doc/libs/1_53_0/libs/polygon/doc/voronoi_basic_tutorial.htm") Does anybody knows a good tutorial which explains why this template reinitialization is needed and how to do it right. Or how to get along without it.

2.) At looking for Tutorials i found a lot of web sites working with #include "boost/geometry/geometries/polygon..." Is this the same as #include "boost/polygon..." Or does boost uses two implementations of the same thing (polygon)? Or is it just a Versioning thing?

Thanks to anyone who can help me to clear this. Regards

Was it helpful?

Solution

There are two libraries in Boost which introduces it's own Polygons concepts:

I'm not sure what do you have in mind saying "template reinitialization". Maybe you wanted to say "template specialization" which is sometimes required to adapt some class to a Concept.

If you're wondering why this is done this way. This allows to call algorithms implemented in those libraries passing objects of some legacy classes. The programmer must just adapt those classes to one of the required concepts and he can use them without the conversion to some intermediate object.

This is very similar to the way how traits are used in C++. E.g. when some new iterator class is implemented the std::iterator_traits<> template may be specialized to define traits for this iterator. This would be one of the things the programmer should do to adapt this new iterator class to one of the Iterator concepts, e.g. ForwardIterator concept. Then he could use it in STL algorithms like std::for_each().

Polygons concepts introduced by those libraries are described here:

Typically, libraries provides also classes already adapted to the supported Concepts. E.g. Boost.Geometry provides boost::geometry::model::polygon<> (http://www.boost.org/libs/geometry/doc/html/geometry/reference/models/model_polygon.html)

Probably it'd be possible to adapt some class to both concepts and use it in both libraries but I'm not sure about it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top