Fastest way to 'frame' a matrix

May 19, 2006 at 4:28pm

Fastest way to 'frame' a matrix

Hello

Im wondering if this patch is the fastest (only?) way to ‘frame’ one
matrix within another.

basically, I want put borders around a matrix. one matrix centered
within another.

Jit.op normalizes the dimensions of the second smaller matrix, and im
sure one could finagle something with srcdim/dstdim, but im not
‘getting’ it. Can anyone show me an alternative?

thanks,

max v2;
#N vpatcher 20 74 620 474;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 316 102 44 196617 setall 0;
#P newex 248 64 20 196617 t b;
#P message 248 102 56 196617 setall 255;
#P user jit.pwindow 153 246 82 62 0 1 0 0 1 0;
#P message 62 162 84 196617 brgb 0 0 0 , clear;
#P message 173 191 213 196617 drawpict thingy 15 10 320 240 0 0 320 240;
#P newex 153 161 30 196617 t b b;
#P newex 153 226 111 196617 jit.lcd 4 char 350 260;
#P toggle 153 40 15 0;
#P newex 153 59 51 196617 qmetro 2;
#P newex 248 127 163 196617 jit.matrix thingy 4 char 320 240;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P connect 4 0 3 0;
#P connect 5 0 3 0;
#P connect 6 0 3 0;
#P connect 3 0 7 0;
#P connect 4 1 5 0;
#P fasten 2 0 9 0 158 57 253 57;
#P connect 9 0 8 0;
#P connect 1 0 0 0;
#P connect 10 0 0 0;
#P connect 8 0 0 0;
#P pop;

v a d e //

http://www.vade.info
abstrakt.vade.info

#26065
May 19, 2006 at 4:50pm

jit.expr @expr “(abs(snorm[0])<0.9)*(abs(snorm[1])<0.9)*in[0]"

#77442
May 19, 2006 at 6:07pm

Hrm, Andrew, thanks. This is actually a bit slower for me, and not
quite what I need. THis is resizing the incoming matrix to 90% of its
size internally (re-scaling/sampling), and then passing it out.

I need to be able to take 2 matrixes, one larger, and center the
smaller on top of it, with the frame of the first larger visible
around the smaller second one.

I re-did the expr to jit.expr @expr “(abs(snorm[0])<0.9)*(abs(snorm
[1])<0.9)*in[1]" (in 1 vs in 0), which seems to work, but seems much
slower to me, and I cant guarantee that I am not re-sampling the
smaller matrix (which i dont want to do)

so, any way to not resample, simply overlay a smaller matrix on top
of a larger?

thanks again!

v a d e //

http://www.vade.info
abstrakt.vade.info

#77443
May 19, 2006 at 6:41pm

Maybe something like this- depends what exactly you want to achieve. John.

max v2;
#N vpatcher 19 224 619 624;
#P window setfont “Sans Serif” 9.;
#P user jit.fpsgui 89 85 60 196617 0;
#P user jit.pwindow 210 229 82 62 0 1 0 0 1 0;
#P window linecount 1;
#P message 211 91 56 196617 setall 255;
#P newex 211 148 157 196617 jit.matrix white 4 char 320 240;
#P window linecount 2;
#P newex 211 193 216 196617 jit.matrix thingy 4 char 350 260 @usedstdim 1
@dstdimstart 15 10 @dstdimend 335 250;
#P window linecount 1;
#P newex 211 60 70 196617 t b b;
#P message 271 91 44 196617 setall 0;
#P toggle 153 40 15 0;
#P newex 153 59 51 196617 qmetro 2;
#P newex 271 122 160 196617 jit.matrix thingy 4 char 350 260;
#P fasten 1 0 9 0 158 80 94 80;
#P connect 2 0 1 0;
#P fasten 2 0 4 0 158 57 216 57;
#P connect 4 0 7 0;
#P fasten 1 0 6 0 158 123 216 123;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 8 0;
#P connect 4 1 3 0;
#P connect 3 0 0 0;
#P pop;

#77444
May 19, 2006 at 6:58pm

we have a winner.

thanks, I keep getting confused with srcdim and dstdim with the
matrix. this is exactly what I want.

mad props++;

v a d e //

http://www.vade.info
abstrakt.vade.info

#77445

You must be logged in to reply to this topic.