箱のような形を以下のようなフーリエ級数で展開し、N=Mを増やしていったときにどんな感じになるかの確認。
\begin{eqnarray}
f(x,y)=\sum_{m=1}^{M}\sum_{n=1}^{N}b_{mn}sin\frac{mπ}{L}x・sin\frac{nπ}{L}y
\end{eqnarray}
// (x,y)での高さを計算
float calcHeight(float x, float y, int N, int M)
{
float y = 0.0f, temp_y = 0.0f;
int i, j;
for (i = 1; i <= N; i++)
{
temp_y = sin((float)i*PI*0.5f)*cos((float)i*PI*0.1f*x)/(float)i;
for (j = 1; j <= M; j++)
{
y += tempy*sin((float)j*PI*0.5f)*cos((float)i*PI*0.1f*y)/(float)j;
}
}
y *= 4.0f/(PI*PI);
return y;
}