I wanted users to have the option to use non-square seed image. Hence, why you’re seeing hyp_img, and the initial n being based off solving b for a=sqrt(2b^2). Non-square images is not quite the correct way of using this script, but eh I don’t really care about whether users will use a square image or not, and I do know how to create the option of forcing a non-square image to be a square seed.
I did that, it still doesn’t seem to work.
In addition, that can be simplified to:
NN=(N-1)^2
increment=1/NN
incrementValue=-NN
zeroV=4*NN
Here’s the new code which is a lot easier to read.
rep_hamiltonian:
repeat $! l[$>]
if s>1 to_gray. fi
ge. {avg(im,iM)}
hyp_img={sqrt(sqr(w)+sqr(h))}
n={int(sqrt(($hyp_img^2)/2))}
nn={($n-1)^2}
npts={sqr($n)}
npts_n={$npts-$n}
npts_1={$npts-1}
increment={1/$nn}
incrementValue={-$nn}
zeroV={4*$nn}
$npts,$npts
$npts,5,1,1,"begin(
const inc_v="$incrementValue";
const zv="$zeroV";
cv=[crop(#-2)];
initial_pos_x=[0,0,0,1,"$n"];
initial_pos_y=["$n",1,0,0,0];
v(a)=inc_v*cv[a];
);
y==2?(
i(#-1,x,x)=zv;
):(
pos_x=x+initial_pos_x[y];
pos_y=x+initial_pos_y[y];
i(#-1,pos_x,pos_y)=v(x);
);"
k..
eigen.
k.
endl done
Also, this doesn’t work either:
increment={(1/($n-1))^2}
incrementValue={-1/$increment}
zeroV={4/$increment}
EDIT: unroll instead of crop does not work either. I’m stumped.