Boost logo

Geometry :

Subject: [ggl] Within polygon detection including the polygon borders
From: Ivan Marin (ispmarin)
Date: 2009-09-03 17:23:57

Dear all,

I successfully compiled the examples and now I'm trying to use the ggl. I
need to check if a point is inside a polygon, and I want to consider de
borders as part of the polygon. Is this possible in ggl? All the tests that
I've made showed me that this is not possible. Am I wrong?

Thank you!


#include <geometry/geometry.hpp>
#include <geometry/geometries/cartesian2d.hpp>

#include <geometry/io/wkt/streamwkt.hpp>
#include <geometry/algorithms/within.hpp>

#include <vector>
#include <iostream>

std::string boolstr(bool v)
        return v ? "true" : "false";

using namespace geometry;
using namespace geometry::strategy::within;

int main () {

      geometry::polygon_2d poly;
      geometry::point_2d c3 = make<point_2d>(1.0,1.0);
      geometry::point_2d c4 = make<point_2d>(1.0,3.0);
      geometry::point_2d c5 = make<point_2d>(3.0,3.0);
      geometry::point_2d c6 = make<point_2d>(3.0,1.0);
      geometry::point_2d c7 = make<point_2d>(1.0,1.0);

      std::vector <geometry::point_2d> vec;



      std::cout << poly << std::endl;

     std::cout << "point in polygon:"
                << " p1: " << boolstr(within(make<point_2d>(1.5, 1.0),

                << std::endl;

return 0;

-------------- next part --------------
An HTML attachment was scrubbed...

Geometry list run by mateusz at