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@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/geometry