Boost logo

Boost Users :

Subject: Re: [Boost-users] [geometry] Boost Geometry Compilation Errors
From: Joel Markham (markhamj_at_[hidden])
Date: 2013-03-20 09:06:44


http://www.boost.org/doc/libs/1_53_0/libs/geometry/doc/html/geometry/quickstart.html

On Mar 20, 2013, at 7:38 AM, Barend Gehrels <barend_at_[hidden]> wrote:

> Hi Joel,
>
>
> On 20-3-2013 2:54, Joel Markham wrote:
>> Trying to use the boost geometry library.
>>
>> Have a very simple example from the boost geometry home page
>
> From which homepage?
>
>
>>
>> int main(int argc, const char * argv[])
>> {
>> double points[][2] = {{2.0, 1.3}, {4.1, 3.0}, {5.3, 2.6}, {2.9, 0.7}, {2.0, 1.3}};
>> bgm::polygon<bgm::d2::point_xy<double> > poly;
>> bg::append(poly, points);
>> boost::tuple<double, double> p = boost::make_tuple(3.7, 2.0);
>> std::cout << "Point p is in polygon? " << std::boolalpha << bg::within(p, poly) << std::endl;
>> …
>> }
>>
>> When trying to build on my Mac I get compiler warnings:
>>
>> point_type.hpp
>> No matching function for call to 'assertion_failed"
>>
>> coordinate_type.hpp
>> No matching function for call to 'assertion_failed"
>>
>> convert_point_to_point.hpp
>> Call to function 'get that is neither visible in the template definition or found…
>>
>> access.hpp
>> Nom member named 'get in boost::geometry::core_dispatch…
>
>
> Your example is not complete (no headers) so I cannot see what is missing here. The complete version below compiles for me. Registration of tuples is necessary (to indicate which coordinate system). Same for C-Arrays, if append is used like this (it can be done differently too).
>
> Regards, Barend
> ------------------------
>
>
> #include <boost/geometry.hpp>
> #include <boost/geometry/geometries/point_xy.hpp>
> #include <boost/geometry/geometries/polygon.hpp>
> #include <boost/geometry/multi/geometries/multi_polygon.hpp>
>
> #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
> #include <boost/geometry/geometries/adapted/c_array.hpp>
>
> #include <iostream>
>
> namespace bg = boost::geometry;
> namespace bgm = boost::geometry::model;
>
> BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
> BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)
>
>
> int main(int argc, const char * argv[])
> {
> double points[][2] = {{2.0, 1.3}, {4.1, 3.0}, {5.3, 2.6}, {2.9, 0.7}, {2.0, 1.3}};
> bgm::polygon<bgm::d2::point_xy<double> > poly;
> bg::append(poly, points);
> boost::tuple<double, double> p = boost::make_tuple(3.7, 2.0);
> std::cout << "Point p is in polygon? " << std::boolalpha << bg::within(p, poly) << std::endl;
> return 0;
> }
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



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