Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm for 2D Interpolation

I have two shapes which are cross sections of a channel. I want to calculate the cross section of an intermediate point between the two defined points. What's the simplest (relatively simple?) algorithm to use in this situation?

P.S.: I came across several algorithms like natural neighbor and poisson, which seemed complex. I'm looking for a simple solution, which could be implemented quickly.

EDIT: I removed the word "Simplest" from the title since it might be misleading

like image 669
Gayan Avatar asked Mar 16 '10 08:03

Gayan


People also ask

What is the interpolation algorithm?

Interpolation search is an improved variant of binary search. This search algorithm works on the probing position of the required value. For this algorithm to work properly, the data collection should be in a sorted form and equally distributed. Binary search has a huge advantage of time complexity over linear search.

What is bilinear algorithm?

Bilinear Interpolation : is a resampling method that uses the distanceweighted average of the four nearest pixel values to estimate a new pixel value. The four cell centers from the input raster are closest to the cell center for the output processing cell will be weighted and based on distance and then averaged.

What are the 3 interpolation methods for images?

Image interpolation is generally achieved through one of three methods: nearest neighbor, bilinear interpolation, or bicubic interpolation.


1 Answers

This is simple:

  1. On each cross section draw N points at evenly spaced intervals along the boundary of the cross-section.
  2. Draw straight lines from the n-th point on cross-section 1 to the n-th point on cross-section 2.
  3. Take off your new cross-section at the desired distance between the old cross-sections.

Simpler still:

  1. Use one of the existing cross-sections without modification.

This second suggestion might be too simple I suppose, but I bet no-one suggests a simpler one !

EDIT following OP's comment: (too much for a re-comment)

Well, you did ask for a simple method ! I'm not sure I see the same problem with the first method as you do. If the cross sections are not too weird (probably best if they are convex polygons) and you don't do anything strange such as map the left side of one cross-section to the right side of the other (thereby forcing lots of crossing lines) then the method should produce some kind of sensible cross section. In the case you suggest of a triangle and a rectangle, suppose the triangle is sitting on its base, one vertex at the top. Map that point to, say, the top left corner of the rectangle, then proceed in the same direction (clockwise or anti-clockwise) around the boundaries of both cross-sections joining corresponding points. I don't see any crossing lines, and I see a well-defined shape at any distance between the two cross-sections.

like image 179
High Performance Mark Avatar answered Oct 23 '22 01:10

High Performance Mark