views:

143

answers:

3

Simulating Ocean Water: http://www.finelightvisualtechnology.com/docs/coursenotes2004.pdf

I'm trying to simulate ocean and I need your help. Please be patient, I'm newbie to computer graphics but I know basics of physics and mathematics. As you can see I need to compute the formula:

formula

k is a vector, x is a coordinate (so I suggest that it could be equal to vector?).

So, first question: how to compute e to the power of such strange thing?

Second, it says that h(x,t) is height and also that to get the value it's needed to do FFT. I can't understand it.

A: 

If x is a coordinate (bidimensional?) you can use the Point class. What is in the Sum should be translated into a loop and computed iterating on k.

FFT is the fourier tranformation, search for Cooley-Tukey algorithm to compute it fast.

vulkanino
+2  A: 

e to the power of something imaginary can be computed with sin and cos waves
http://upload.wikimedia.org/math/4/0/d/40d9a3c31c4a52cb551dd4470b602d82.png
wikipedia entry for e

and vector exponentiation has it's own page as well
alt text
matrix exponential

Jean-Bernard Pellerin
-1 stop! there is no such thing as "vector exponentiation". The exponent in this case is a scalar value obtained by the scalar product of the two vectors k and x.
Tobias Kienzler
+2  A: 

This equation is a representation of a multidimensional Fourier transform of the heights of the waves at each x-y position (represented by x) h(x, t) into a sum of complex exponentials with amplitudes h~(k, t). Notice that what is being exponentiated is a dot product, k · x, which has a scalar result. This means that you are exponentiating a complex number, which can easily be done by using Euler's formula with sine and cosine, as stated in the other post. As for actually computing the h~, you need to use a multidimensional FFT on the 2-D array containing the h data. I believe you can use an ordinary 1-D FFT to compute it, but look on Wikipedia to learn how to do that. When you do get to using your FFT routine, look to see what coefficients are put outside the sum in whatever mathematical representation is used in your library (i.e., 1/N), and correct for those.

ascent1729
could you please be more specific? I don't understand how to get h~? I have just a formula for doing this, why do I need fft?
FeLiX