[Boost-bugs] [Boost C++ Libraries] #12314: boost::geometry::within for a point in a geographic coordinate system fails

Subject: [Boost-bugs] [Boost C++ Libraries] #12314: boost::geometry::within for a point in a geographic coordinate system fails
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-07 07:47:37


#12314: boost::geometry::within for a point in a geographic coordinate system fails
-------------------------------------------------+-------------------------
 Reporter: oleary.simon@… | Owner:
     Type: Bugs | barendgehrels
Milestone: To Be Determined | Status: new
  Version: Boost 1.61.0 | Component: geometry
 Keywords: geometry within geographic | Severity: Showstopper
  coordinate system cs |
-------------------------------------------------+-------------------------
 I am using the geometry part of the library for a GIS application. The
 idea is to find points within defined regions (a rectangle in this case).
 This works sometimes but not always. Here is an example where the point
 should be within the rectangle but isn't...

 {{{

 #include <boost/geometry.hpp>
 #include <boost/geometry/geometries/polygon.hpp>
 #include <boost/geometry/multi/geometries/multi_polygon.hpp>
 #include <boost/geometry/geometries/register/point.hpp>
 #include <iostream>
 #include <boost/geometry/io/wkt/wkt.hpp>

 class wxPoint
 {
 public :
     double getx() const
     {
         return m_x;
     }
     double gety() const
     {
         return m_y;
     }
     void setx( double in)
     {
         m_x = in;
     }
     void sety(double in)
     {
         m_y = in;
     }
 private:
     double m_x;
     double m_y;
 };

 BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(
     wxPoint,
     double,
     boost::geometry::cs::geographic<boost::geometry::degree>,
     wxPoint::getx,
     wxPoint::gety,
     wxPoint::setx,
     wxPoint::sety )

 int main()
 {
     boost::geometry::model::polygon< wxPoint > poly;

     boost::geometry::read_wkt( "POLYGON((0 89, 180 89, 180 0, 0 0, 0 89
 ))", poly );

     wxPoint point;
     point.setx( 150 );
     point.sety( 88 );

     bool within = boost::geometry::within( point, poly );


     return 0;
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12314>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC