Jump to content
  • Advertisement
Sign in to follow this  
derek7

if I know 4 point ,how get interpolate?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


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

Share this post


Link to post
Share on other sites
anyone? or give some reference.

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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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...
:)

Share this post


Link to post
Share on other sites
If you can interpolate in one dimension then you can interpolate in any number of dimensions.


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


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!