1

I want to interpolate a polygon between two polygons (one contained inside of the other). Right now I am using a very cumbersome way to do this, and I wanted to ask if anybody had any other idea or suggestion I could investigate to achieve this.

Right now what I do is:

  1. project polygons into a raster (matrix) and assign a value of 0 to the raster cells where the inner perimeter lays, and a a value of 1 where the outer perimeter lays.
  2. Interpolate values at every cell in the raster (I use an inverse distance algorithm)
  3. Use a Polygonizer function over the raster to obtain the perimeter at a given value between 0 and 1

Right now I do not use any library to do theses steps but I could work with things like Nettopologysuite, GDAL, Arcgis-runtime if it was necesary. Thanks.

The polygons are 2D and represent isolines of the terrain (contour lines with same height). So I basically have a mountain isoline at 100m and 1000m, and I want to compute the isoline at 300m interpolating the other two.

SandiaDeDia
  • 291
  • 2
  • 9
  • 2D,3D,ND ? any sample input? usual way is to pair the vertexes between polygons (if not matching use resampling to match) and then just linearly interpolate ... see this very similar QA: [How can I connect two parallel 2d polygons to create a seamless 3d mesh?](https://stackoverflow.com/a/25076849/2521214) – Spektre Jul 04 '20 at 08:27
  • Thank you for the link. Its 2D. I am using terrain isolines (contour lines with same height), and I want to generate the expected isoline between two known ones. For example I have the isolines of a mountain at 100 and 500 meters, and I want to interpolate the isoline at height 300. Using the closest point for that does not work since many points of the outer perimeter are not closest to any inner vertex. – SandiaDeDia Jul 05 '20 at 00:33
  • do you have also surface triangulation? that should simplify this a lot ... – Spektre Jul 05 '20 at 07:14

1 Answers1

1

It's not completely clear what condition your interpolated polygon needs to satisfy.

How many vertices should it have, the same as the original inside polygon, or some other number?

Are the polygons convex?

What I would try:

for each vertex of the inner polygon:

find the side of the outer polygon which it is closest to.

find the line from the centre of the inner polygon through the vertex

move the vertex along this line so that its distance to the outer polygon's side is halved.

tgdavies
  • 10,307
  • 4
  • 35
  • 40
  • Thank you, polygons do not need to be convex, and the interpolated polygon could have any number of vertices (up to several times the total number of vertices in the other polygons for example). I think using the closest line between polygons, or the centroid of the inner polygon to link inner/outter points, and interpolate over that line, would not work in many cases either. Thanks – SandiaDeDia Jul 03 '20 at 01:41