Morph between two polygons (structures) of different sizes

benoitlahoz's picture

Hi all !

I was wondering if someone could give me a tip on this problem : I have these two structures of polygons (triangles actually) that come one frame after the other (on each frame I perform a contour finder and a Constrained Delaunay), and I would like the transition to be smoothed. But the structures don't have the same number of triangles, so the program will have to choose with which triangle it will have to "morph" (BTW, I'd be very thankful to have a tip on how is made the Kineme 2D Vector Morph patch).

So, my questions are, for one triangle :

  • How to choose with which triangle it will morph ?
  • How to perform the smooth between the first and the second triangle ?

I was thinking of doing it like that :

  • Compare the 1st triangle (known) and the 2nd frame triangles centroids and choose the one which is the nearest (but it might be terrible for performances to perform a naive nearest point on a lot of points).
  • Find the nearest vertex on the 2nd triangle for each 1st triangle vertex.
  • Interpolate (I'll have to look at this JS Smooth Structure comp posted somewhere on the site) between the two vertices according to a smooth time.

Does it appear a valid option for you ?

Thanks a lot in advance !

Ben