Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Incorrect result for Boost Geometry line intersection for spherical_equatorial over pole (Boost 1.58.0)
#include <iostream>
#include <boost/geometry.hpp>
int main(int argc, const char *argv[])
{
typedef boost::geometry::model::point<double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> > spoint;
typedef boost::geometry::model::linestring<spoint> sline;
sline sline1, sline2;
boost::geometry::append(sline1, spoint(90.0, 80.0));
boost::geometry::append(sline1, spoint(-90.0, 80.0));
boost::geometry::append(sline2, spoint(180.0, 80.0));
boost::geometry::append(sline2, spoint(0.0, 80.0));
typedef std::vector<spoint> pointvec;
pointvec res3;
boost::geometry::intersection(sline1, sline2, res3);
for(pointvec::iterator p = res3.begin(); p != res3.end(); p++)
std::cout << p->get<0>() << " " << p->get<1>() << "\n";
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.