Current:
void function_smooth_matrix(int matnum,int tilex,int tilez,int times)
{
int x,z;
float a,b,c,d,e,f,g,h,total,av;
for(x=1;x<tilex-1;x++)
{
for(z=1;tilez-1;z++)
{
a=dbGetMatrixHeight(matnum,x-1,z+1);
b=dbGetMatrixHeight(matnum,x,z+1);
c=dbGetMatrixHeight(matnum,x+1,z+1);
d=dbGetMatrixHeight(matnum,x+1,z);
e=dbGetMatrixHeight(matnum,x+1,z-1);
f=dbGetMatrixHeight(matnum,x,z-1);
g=dbGetMatrixHeight(matnum,x-1,z-1);
h=dbGetMatrixHeight(matnum,x-1,z);
total=a+b+c+d+e+f+g+h;
av=total/8;
dbSetMatrixHeight(matnum,x,z,av);
}
}
for(x=0;x<tilex;x++)
{
dbSetMatrixHeight(matnum,x,0,dbGetMatrixHeight(matnum,x,1));
}
for(x=0;x<tilex;x++)
{
dbSetMatrixHeight(matnum,x,tilez,dbGetMatrixHeight(matnum,x,tilez-1));
}
for(z=0;z<tilez;z++)
{
dbSetMatrixHeight(matnum,0,z,dbGetMatrixHeight(matnum,1,z));
}
for(z=0;z<tilez;z++)
{
dbSetMatrixHeight(matnum,tilex,z,dbGetMatrixHeight(matnum,tilex-1,z));
}
dbUpdateMatrix(matnum);
}
Original:
function smooth_matrix(matnum,tilex,tilez,times)
for multiple=1 to times
for x=1 to tilex-1
for z=1 to tilez-1
a=get matrix height(matnum,x-1,z+1)
b=get matrix height(matnum,x,z+1)
c=get matrix height(matnum,x+1,z+1)
d=get matrix height(matnum,x+1,z)
e=get matrix height(matnum,x+1,z-1)
f=get matrix height(matnum,x,z-1)
g=get matrix height(matnum,x-1,z-1)
h=get matrix height(matnum,x-1,z)
total=a+b+c+d+e+f+g+h
av#=total/8
set matrix height matnum,x,z,av#
next z
next x
next multiple
for x=0 to tilex
set matrix height matnum,x,0,get matrix height(matnum,x,1)
next x
for x=0 to tilex
set matrix height matnum,x,tilez,get matrix height(matnum,x,tilez-1)
next x
for z=0 to tilez
set matrix height matnum,0,z,get matrix height(matnum,1,z)
next z
for z=0 to tilez
set matrix height matnum,tilex,z,get matrix height(matnum,tilex-1,z)
next z
update matrix matnum
endfunction
Thanks in advance,
Jim
Intel Pentium 4 3.40 Ghz HT, 1.5 GB RAM, Nvidia Geforce 6800, 19" Dell CRT Monitor ... I need to upgrade ^-^