How to use geometry::within with a polygon that encompasses a pole

Hi, I'm have an issue with polygons from the geometry library using the spherical_equatorial coordinates when the polygon is meant to wrap a pole. e.g. namespace bg = boost::geometry; typedef bg::model::point < double, 2, bg::cs::spherical_equatorialbg::degree > LonLatPoint; bg::model::polygon < LonLatPoint> northPoleBoundary; double lon = -180; while (lon <= 180) { bg::append(northPoleBoundary, LonLatPoint(lon, 88)); lon += 5; } LonLatPoint northPole(90, 0); bool isInNorthPole = bg::within(northPole, northPoleBoundary); This code is giving me isInNorthPole == false. Am I constructing my polygon incorrectly? Is this a bug? Or is this behavior simply not implemented? Thanks for your help!

On Mon, Jan 7, 2013 at 5:20 PM, Cameron Sabol
Hi,
I'm have an issue with polygons from the geometry library using the spherical_equatorial coordinates when the polygon is meant to wrap a pole.
e.g.
namespace bg = boost::geometry; typedef bg::model::point < double, 2, bg::cs::spherical_equatorialbg::degree > LonLatPoint;
bg::model::polygon < LonLatPoint> northPoleBoundary;
double lon = -180; while (lon <= 180) { bg::append(northPoleBoundary, LonLatPoint(lon, 88)); lon += 5; }
LonLatPoint northPole(90, 0);
bool isInNorthPole = bg::within(northPole, northPoleBoundary);
This code is giving me isInNorthPole == false. Am I constructing my polygon incorrectly? Is this a bug? Or is this behavior simply not implemented? Thanks for your help!
I think you meant: LonLatPoint northPole(0, 90); --Mike

Yes, sorry for the typo. Example code should read:
namespace bg = boost::geometry;
typedef bg::model::point
<
double, 2, bg::cs::spherical_equatorialbg::degree
> LonLatPoint;
bg::model::polygon < LonLatPoint> northPoleBoundary;
double lon = -180;
while (lon <= 180)
{
bg::append(northPoleBoundary, LonLatPoint(lon, 88));
lon += 5;
}
LonLatPoint northPole(0, 90);
bool isInNorthPole = bg::within(northPole, northPoleBoundary);
Where result is isInNorthPole == false, but expected is isInNorthPole ==
true.
On Tue, Jan 8, 2013 at 12:26 PM, Michael Fawcett
On Mon, Jan 7, 2013 at 5:20 PM, Cameron Sabol
wrote: Hi,
I'm have an issue with polygons from the geometry library using the
spherical_equatorial coordinates when the polygon is meant to wrap a pole.
e.g.
namespace bg = boost::geometry; typedef bg::model::point < double, 2, bg::cs::spherical_equatorialbg::degree > LonLatPoint;
bg::model::polygon < LonLatPoint> northPoleBoundary;
double lon = -180; while (lon <= 180) { bg::append(northPoleBoundary, LonLatPoint(lon, 88)); lon += 5; }
LonLatPoint northPole(90, 0);
bool isInNorthPole = bg::within(northPole, northPoleBoundary);
This code is giving me isInNorthPole == false. Am I constructing my
polygon incorrectly? Is this a bug? Or is this behavior simply not implemented? Thanks for your help!
I think you meant:
LonLatPoint northPole(0, 90);
--Mike _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Cameron Sabol
-
Michael Fawcett