jit.expr help! normalize from center outwards? hypot() comes close...

derp mcderpington's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'm trying with jit.expr to scale some numbers from the center outwards.
example patch included- any help is much appreciated!
-brian c

Luke Hall's icon

Try using [jit.expr @expr (abs(snorm[0]+snorm[1])+abs(snorm[0]-snorm[1]))*12.5] will work. The last number should be half what you want the outside values to be. There's probably a much neater way of doing it.

lh

derp mcderpington's icon

that is exactly what i was looking for, thank you! now if i could just figure out why that works!

Luke Hall's icon

Well snorm[0] and snorm[1] gives you the signed normalised cell values about the central column/row. Finding the sum and difference gives you the same values running down each of the diagonals. If you find the absolute values of each of these and sum them you'll get the concentric rings of values where the maximum is 2. Multiplying this by 12.5 scales it from 0 to 50. Try using each of these expressions one by one to see what is happening. I'm not a jitter pro so I did it half trial-and-error half basic maths. There might be an easier way to do it still.

lh