Boost logo

Geometry :

Subject: [ggl] nearest neighbor/segment
From: Matt Anderson (matt)
Date: 2010-09-09 12:47:29


   Hi list,

   This is a polygon question:

   When a point is found to be within a polygon, is there a GGL method
already in place to find the polygon segment and corresponding anchor
nodes closest to that point within the polygon?

   for example, suppose:

   double coorB[][2] = {
         {0.0,0.0}, {0.0,1.0}, {1.0,1.0}, {1.0,0.0}
         };

   polygon_2d elementB;
   assign(elementB, coorB);
   correct(elementB);

   if ( within(make<point_2d>(0.5,0.8), elementB) ) {

     // a hitherto unknown GGL method
     nodes = unknown_method(make<point_2d>(0.5,0.8),
elementB);
     // this method would return the nodes of polygon segment closest to
     // the point (0.5,0.8), namely: {0.0,1.0} and {1.0,1.0}

   }

   Does a method similar to above illustrated 'unkown_method' exist which
would return the nodes in question?

   thanks,

   Matt

---------------------------------------------------------------------------
http://relativity.phys.lsu.edu/~matt/


Geometry list run by mateusz at loskot.net