New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected results with expand() and make_inverse() for spherical and geographic CS #498

vissarion opened this Issue Jul 2, 2018 · 0 comments


None yet
2 participants

vissarion commented Jul 2, 2018

The code below (as posted in boost.geometry mailing list) returns

((0, 0), (5, 5))
((0, 0), (5, 5))
((-180, 0), (180, 5))
((-3.14159, 0), (3.14159, 5))

which is unexpected. There is an issue in the initialization of the box using make_inverse. Note that if the box is initialized by the first point point_type{0,0} of the expansion the result is as expected.

#include <boost/geometry.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point_xy.hpp>

#include <iostream>

// XXX -- default template parameters correspond to the Boost.Geometry
//        example; see
template < typename Coordinate = short int
           , typename CS = boost::geometry::cs::cartesian
struct expand_example
  static void apply ()
    using point_type = boost::geometry::model::d2::point_xy<Coordinate,CS>;
    using box_type = boost::geometry::model::box<point_type>;

    using boost::geometry::expand;

    box_type box = boost::geometry::make_inverse<box_type>();

    expand(box, point_type{0,0});
    expand(box, point_type{1,2});
    expand(box, point_type{5,4});
    expand(box, boost::geometry::make<box_type>(3,3,5,5));

    std::cout << boost::geometry::dsv(box) << std::endl;

int main ()
  using namespace boost::geometry;

@vissarion vissarion added the bug label Jul 2, 2018

@vissarion vissarion closed this Jul 10, 2018

@awulkiew awulkiew added this to the 1.68 milestone Jul 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment