• 10
• 12
• 12
• 14
• 17

# if I know 4 point ,how get interpolate?

This topic is 4711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

for 1 dimensional , it is simple.like this: or click this function Cosine_Interpolate(a, b, x) ft = x * 3.1415927 f = (1 - cos(ft)) * .5 return a*(1-f) + b*f but for 2 dimensional ,how to do ?
	//
A   B
*---*
| / |
*---*
C   D
ABCE is four point and how to get the point inside ABCD?



##### Share on other sites
Have a look at this I think the function your are looking for is cubic interpolation.

##### Share on other sites
no take a look:

x z of yellow vertex are known.
I mean if I know yellow mesh height,how to calculate the inpolation mesh?

##### Share on other sites
simplify a little:
If I know the yellow mesh ,how to get the smoothly interpolated mesh(grey mesh).

##### Share on other sites
anyone? or give some reference.

I just want my object can walk smoothly on the hill.

##### Share on other sites
You could always use the 2D smoothing method described in this. Specifically, look at the part labeled '2-dimensional Smooth Noise'.

##### Share on other sites
It could be interpolated, but I haven't find any good link and I don't think I can write the maths here. If I find it I will tell you.But If it's only for a smooth walk you can try to smooth the terrain instead. For example take a look at
Smoothing
there are two simple ideas to smooth a terrain.

Good luck.

/* Forgive my english... */

EDIT: I 've used lately a variant of the second one of the link and depending of the terrain I do it more than once.
You can also google for bilinear interpolation or bicubic but I haven't tried:(

##### Share on other sites
You 2nd example looks like a simple bezier curve. Your first example looks like simple interpolation.

Here's a quick way to smooth things out if the second is what you're looking for.

For any vertex, make up a triangle. The top vertex is the point that will be "smoothed". Take the midpoints of the two legs of the triangle. Draw a line between those two midpoints. Your 'smoothed' point is then going to be the midpoint of that line (the midpoint of the line made between the midpoints of the legs). Very simple in 2D, and with a little thought can be easily carried into 3D.

##### Share on other sites
I don't know how relevant this is, but the output of your smoothed mesh can vary quite a bit depending on which interpolation scheme you use. You may require C1 or C2 continuity and...

you know, I think I'm just complicating things... just ignore me...
:)

function Interpolate(a,b,c,d,x,y){ab = Interpolate(a,b,x);cd = Interpolate(c,d,x);return Interpolate(ab,cd,y);}     aba--->x<--b|    |   ||    |   |y  (x,y) y|    |   ||    |   |c--->x<--d     cd