$include_dir="/home/hyper-archives/geometry/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [geometry] boost::geometry::equals and the ring model
From: Menelaos Karavelas (menelaos.karavelas_at_[hidden])
Date: 2015-04-02 01:59:40
Hi Alexandre.
On 02/04/2015 07:02 Ïμ, Alexandre Pretyman wrote:
> Hello list!
>
> I am having trouble using the equals method on a ring model, maybe I 
> missed something in the documentation. Can you guys give me some 
> directions on how can I fix the error below?
>
> I have the following code (also attached):
>
> using point = bg::model::point<double, 2, bg::cs::geographic<bg::degree>>;
> using ring = bg::model::ring<point, true, true>;
> ring r1;
> r1.push_back(bg::make<point>(0, 0));
> r1.push_back(bg::make<point>(0, 1));
> r1.push_back(bg::make<point>(1, 1));
> r1.push_back(bg::make<point>(1, 0));
> r1.push_back(bg::make<point>(0, 0));
> ring r2;
> r2.push_back(bg::make<point>(0, 0));
> r2.push_back(bg::make<point>(0, 1));
> r2.push_back(bg::make<point>(1, 1));
> r2.push_back(bg::make<point>(1, 0));
> r2.push_back(bg::make<point>(0, 0));
> // equals with ring doesn't work ;(
> std::cout << "ring equals:" << bg::equals(r1, r2) << std::endl;
>
> And it fails with the following message (full log also attached):
>
> n file included from /usr/include/boost/mpl/aux_/na_assert.hpp:23:0,
>                  from /usr/include/boost/mpl/arg.hpp:25,
>                  from /usr/include/boost/mpl/placeholders.hpp:24,
>                  from /usr/include/boost/mpl/apply.hpp:24,
>                  from /usr/include/boost/mpl/for_each.hpp:19,
>                  from /usr/include/boost/test/unit_test_suite_impl.hpp:29,
>                  from /usr/include/boost/test/unit_test_suite.hpp:19,
>                  from /usr/include/boost/test/unit_test.hpp:20,
>                  from 
> /unit-tests/geometry-equals/cxx/geometry-equals.cxx:3:
> /usr/include/boost/geometry/strategies/area.hpp: In instantiation of 
> âstruct 
> boost::geometry::strategy::area::services::default_strategy<boost::geometry::geographic_tag, 
> boost::geometry::model::point<double, 2ul, 
> boost::geometry::cs::geographic<boost::geometry::degree> > >â:
> /usr/include/boost/geometry/strategies/default_area_result.hpp:42:17: 
>   required from âstruct 
> boost::geometry::default_area_result<boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true> >â
> /usr/include/boost/geometry/algorithms/area.hpp:266:53:   required by 
> substitution of âtemplate<class Geometry> typename 
> boost::geometry::default_area_result<Geometry>::type 
> boost::geometry::area(const Geometry&) [with Geometry = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>]â
> /usr/include/boost/geometry/algorithms/equals.hpp:122:41:   required 
> from âstatic bool 
> boost::geometry::detail::equals::area_check::apply(const Geometry1&, 
> const Geometry2&) [with Geometry1 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>; Geometry2 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>]â
> /usr/include/boost/geometry/algorithms/equals.hpp:146:55:   required 
> from âstatic bool 
> boost::geometry::detail::equals::equals_by_collection<TrivialCheck>::apply(const 
> Geometry1&, const Geometry2&) [with Geometry1 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>; Geometry2 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>; TrivialCheck = boost::geometry::detail::equals::area_check]â
> /usr/include/boost/geometry/algorithms/equals.hpp:344:52:   required 
> from âstatic bool boost::geometry::resolve_variant::equals<Geometry1, 
> Geometry2>::apply(const Geometry1&, const Geometry2&) [with Geometry1 
> = boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>; Geometry2 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>]â
> /usr/include/boost/geometry/algorithms/equals.hpp:460:55:   required 
> from âbool boost::geometry::equals(const Geometry1&, const Geometry2&) 
> [with Geometry1 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>; Geometry2 = 
> boost::geometry::model::ring<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, true, 
> true>]â
> /unit-tests/geometry-equals/cxx/geometry-equals.cxx:44:51:   required 
> from here
> /usr/include/boost/geometry/strategies/area.hpp:37:5: error: no 
> matching function for call to 
> âassertion_failed(mpl_::failed************ 
> (boost::geometry::strategy::area::services::default_strategy<boost::geometry::geographic_tag, 
> boost::geometry::model::point<double, 2ul, 
> boost::geometry::cs::geographic<boost::geometry::degree> > 
> >::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::************)(mpl_::assert_::types<boost::geometry::model::point<double, 
> 2ul, boost::geometry::cs::geographic<boost::geometry::degree> >, 
> mpl_::na, mpl_::na, mpl_::na>))â
>      BOOST_MPL_ASSERT_MSG
>
I have not looked at the code, but I think this is what is happening: 
area (which is required apparently for the equality testing) is not yet 
implemented for points in the geographic coordinate system.
Please bear in mind that bg::equals is testing for geometric equality 
(i.e., whether two point sets coincide), which means that simply 
checking the vertices of a ring for equality is not really enough, as 
you might define the same ring in many different ways.
Best,
- m.
> Thanks for any insight!
> -- 
> Alexandre Pretyman
>
>
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://listarchives.boost.org/mailman/listinfo.cgi/geometry