Boost logo

Boost Users :

Subject: [Boost-users] [geometry][ggl] boost array adapted mechanism
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-10-26 21:56:35


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<boost/geometry/geometry.hpp>
#include<boost/geometry/geometries/cartesian3d.hpp>
#include<boost/geometry/geometries/adapted/boost_array_as_ring.hpp>
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
#include<iostream>
int main(){
        using namespace boost::geometry;
        point<double, 3, cs::cartesian> p1(1,2,3);
        double p2[3] = {4,5,6};
        boost::tuple<double, double, double> p3(7,8,9);
        boost::array<double, 3> p4={{10,11,12}};
        std::clog << distance(p1,p2) << std::endl;
        std::clog << distance(p2,p3) << std::endl;
        std::clog << distance(p3,p4) << std::endl;
        return 0;
}

In other words, why there is not
boost/geometry/geometries/adapted/boost_array_cartesian.hpp
?

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?

Thank you,
Alfredo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net