c++ - Interpolate the values at the contour points -


given : list of ordered points (2d) representing closed contour current status : points on contour sampled (uniformly or arbitrarily) , value (say descriptor of sort) computed each point.

task : interpolate the value calculated @ sampled points points not in sample. perhaps can take 3 sampled points in order , interpolate values non-sampled points lie between 2 extreme points of chosen 3 points. reading bunch of papers getting extremely confused do: interpolate curve (catmul rom example) or surface. perhaps there c++ library want or ideas.

to clarify futher:

set of 2d points in contour (the last points joins first point), si = (xi,yi)

s0, s1, s2, s3, s4, s5, s6, s7 ,s8, s9, s10, s11 , s12 , s13, s14, s15 

sampled points

s0          s3          s6          s9             s12             s15 

calculate value @ sampled points

f(s0)     f(s3)       f(s6)       f(s9)          f(s12)           f(s15) 

now goal find interpolated values @ other points

     s1 s2     s4 s5       s7 s8        s10  s11       s13  s14 

you can simple weighted average. example have point x between , b distance function d , property p can do

p(x) = ( p(a) * d(x, a) + p(b) * d(x,b) ) / (d(x,a) + d(x,b)) 

you can same 3 points (a, b , c) if want more curvy results (the example above going linear).

these should ok approximations, unless know more original curve. if don't know original curve there's no way predict values perfectly.


Comments