in reply to polygon buffering algorithms

If you have a set of lines that represents a closed polygon, the following pseudo-code should work
foreach edge (edges in polygon, clockwise) construct parallel line distance d from edge, store it in an array done foreach parallel line find intersection with next line in array, allowing for wrap around store intersection in an array done #intersections are the vertexes of your new polygon
If you need more, let us know.

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

Replies are listed 'Best First'.
Re^2: polygon buffering algorithms
by ikegami (Patriarch) on Feb 08, 2005 at 18:17 UTC
    ................................... ................................... ................................... ................................... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... ...............!!!!!!!!!!!!!!!..... ...............!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... .....!!!!!!!!!!!!!!!!!!!!!!!!!..... ................................... ................................... ................................... ...................................

    The above with $d == 3 gives a weird polygon, but that's ok as long you're expecting it.

      You're right...the algorithm that I outlined works for convex polygons. In order to deal with polygons with concavities, I believe that you need to allow for overlap and take the union of all points that lie in the interior. In the case of the polygon that you gave, it would then be a square. Just for my own edification, what is the $d that you're referring to?

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

        The OP refered to "buffer distance 'd'". That's what I meant by $d. (I added the $ without thinking.)