我一直在努力解决这个问题,但似乎没有任何效果。
我基本上是在尝试以任意速度制作行波。
一般来说,我一直在尝试使用的是涉及平面波方程的东西,当你有 aVector velocity
和 a时,它就像这样Point position
:
float pi2 = 2 * PI;
// For our purposes lambda is the speed
float lambda = velocity.length();
// Therefore frequency is 1
float frequency = 1.0F;
// Making angular frequency equal to 2 * PI
float omega = pi2;
// Lambda is the wavelength and pi2 / lambda is the wave number
Vector waveVector = velocity.norm().multiply(pi2 / lambda);
// Theta is the angle from the origin to the new position at time
float theta = waveVector.dot(position.toVector()) - (omega * time);
// Here's where I'm stuck. Psi is equal to the current disturbance of the wave.
// Where do I go from here to get the new coordinates?
float psi = amplitude * cos(theta);
在一维中测试,这当然有效。在哪里
float x = speed
和
float y = amplitude * cos((waveNumber * position.x) - (omega * time))
这对我来说很有意义。但是对于 2 维,我被困在 psi 上。