[geometry][ggl] boost array adapted mechanism

The documentation of GGL (Generic Geometry Library) is still scattered
and hard to follow. As usual the first test I do on a library is to
see how well it can be adapted to existing code. GGL seems to be able
to adapt c_arrays and tuples as nD points. I was wondering if
boost::array and fusion::vector can be adapted as well.
The manual says it is but the header file
boost/geometry/geometries/adapted/boost_array_as_ring.hpp
doesn't seem to have that purpose.
In the following example, p4 doesn't work as a point
#include

hi Alfredo,
The documentation of GGL (Generic Geometry Library) is still scattered and hard to follow.
We are working on it. It is being written using QuickBook, and it will be within Boost.
As usual the first test I do on a library is to see how well it can be adapted to existing code. GGL seems to be able to adapt c_arrays and tuples as nD points.
Yes.
I was wondering if boost::array and fusion::vector can be adapted as well.
Boost Array can be adapted as a linear ring or as a linestring, both with a fixed number of coordinates. Boost Array cannot yet be adapted as a point, which is actually not complex and a good idea. Fusion, I started it once but continued with other things... So not yet there indeed.
boost::array
p4={{10,11,12}}; In other words, why there is not boost/geometry/geometries/adapted/boost_array_cartesian.hpp ?
Yes, not yet there and it is a good idea.
And it indeed this adaptation of boost::array is not included in the library, what steps should I follow to make a boost::array adapted to GGL?
Adapting to the Point Concept is necessary, which is actually not hard. Most samples use registration macro's, which is probably not possible here. So perhaps the c05_custom_point_pointer_example.cpp gives the idea. Basically you have to specialize the tag, coordinate_type, coordinate_system, dimension metafunctions (all trivial) and the access structure, also not too hard. In case you start with this, I'm interested in the result, for incorporation. Otherwise it will probably be included as well but then it might take longer. Good point. Regards, Barend

Hi Barend,
On Wed, Oct 27, 2010 at 1:15 AM, Barend Gehrels
In other words, why there is not
boost/geometry/geometries/adapted/boost_array_cartesian.hpp ?
Yes, not yet there and it is a good idea.
good, some times I ask just to not repeat code and to understand better the library.
And it indeed this adaptation of boost::array is not included in the
library, what steps should I follow to make a boost::array adapted to GGL?
Adapting to the Point Concept is necessary, which is actually not hard. Most samples use registration macro's, which is probably not possible here. So perhaps the c05_custom_point_pointer_example.cpp gives the idea. Basically you have to specialize the tag, coordinate_type, coordinate_system, dimension metafunctions (all trivial) and the access structure, also not too hard.
In case you start with this, I'm interested in the result, for incorporation. Otherwise it will probably be included as well but then it might take longer.
sure, you will find these files attached:
boost/geometry/geometries/adapted/boost_array.hpp
boost/geometry/geometries/adapted/boost_array_cartesian.hpp
boost/geometry/geometries/adapted/boost_array_geographic.hpp
and
geometry_boost_array_test.cpp
Feel free to incorporate it in Boost.Geometry. I am working in a fusion
adapter too. This is very useful to me because I do most of the (cartesian)
geometry related stuff with boost::array

Hi Alfredo,
In case you start with this, I'm interested in the result, for incorporation. Otherwise it will probably be included as well but then it might take longer.
sure, you will find these files attached:
Wow, that is quick, super. It works, great.
Feel free to incorporate it in Boost.Geometry. I am working in a fusion adapter too. This is very useful to me because I do most of the (cartesian) geometry related stuff with boost::array
I just added them to SVN. Fusion would be great too! Thanks! Barend
participants (3)
-
alfC
-
Alfredo Correa
-
Barend Gehrels