Search code examples
geometrygridcoordinatesmeshunwarp

How to map a point onto a warped grid


Say you have a collection of points with coordinates on a Cartesian coordinate system.

an unwarped grid

You want to plot another point, and you know its coordinates in the same Cartesian coordinate system.

However, the plot you're drawing on is distorted from the original. Imagine taking the original plane, printing it on a rubber sheet, and stretching it in some places and pinching it in others, in an asymmetrical way (no overlapping or anything complex).

a warped grid (source)

You know the stretched and unstretched coordinates of each of your set of points, but not the underlying stretch function. You know the unstretched coordinates of a new point.

How can you estimate where to plot the new point in the stretched coordinates based on the stretched positions of nearby points? It doesn't need to be exact, since you can't determine the actual stretch function from a set of remapped points unless you have more information.

other possible keywords: warped distorted grid mesh plane coordinate unwarp


Solution

  • Ok, so this sounds like image warping. This is what you should do:

    1. Create a Delaunay triangulation of your unwarped grid and use your knowledge of the correspondences between the warped and unwarped grid to create the triangulation for the warped grid. Now you know the corresponding triangles in each image and since there is no overlapping, you should be able to perform the next step without much difficulty.

    2. Now, to find the corresponding point A, in the warped image:

    3. Find the triangle A lies in and use the transformation between the triangle in the unwarped grid and the warped grid to figure out the new position.

    This is explained explicitly in detail here (also archived)

    Another (much more complicated) method is the Thin Plate Spline (which is also explained in the slides above).