[jitter] constrain matrix to boundaries
Wesley Smith
wesley.hoke at gmail.com
Mon Oct 15 15:37:41 MDT 2007
- Previous message: [jitter] constrain matrix to boundaries
- Next message: [jitter] weird slab behaviour?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
For a distance calculation often it's enough to just multiply a matrix by itself. Most of the time you don't need exact distance and distance squared is both good enough and cheaper. wes On 10/15/07, yair reshef <yair99 at gmail.com> wrote: > thnx, if u find some optimizing that can be done, please do. > > #P window setfont "Sans Serif" 9.; > #P window linecount 1; > #P newex 233 341 44 9109513 jit.matrix; > #P newex 233 364 181 9109513 jit.matrix 3 float32 10 8 @planemap 1 2 3; > #P newex 233 316 62 9109513 jit.alphablend; > #P newex 301 265 56 9109513 jit.unpack 3; > #P newex 286 287 55 9109513 jit.pack 4; > #P user jit.pwindow 227 272 42 32 0 0 0 0 1 0; > #P newex 255 244 104 9109513 jit.op @op < @val 0.92; > #P window setfont "Sans Serif" 10.; > #P newex 255 220 118 9109514 jit.matrix 1 float32 10 8; > #P objectname jit.matrix[1]; > #P newex 255 197 276 9109514 jit.expr @expr "sqrt(pow(in[0].p[1] > \\\,2)+pow(in[0].p[0] \\\, 2)"; > #P objectname jit.matrix[2]; > #P window setfont "Sans Serif" 9.; > #N vpatcher 15 55 259 206; > #P window setfont "Sans Serif" 9.; > #P flonum 154 77 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 50 95 129 9109513 jit.op @op * * * @val 2. 2. 0.; > #P objectname jit.matrix[2]; > #P newex 50 72 97 9109513 jit.op @op - @val 0.5; > #P objectname jit.matrix[1]; > #P newex 50 50 101 9109513 jit.noise 3 float32 10 8; > #P objectname jit.matrix[6]; > #P inlet 50 30 15 0; > #P outlet 50 119 15 0; > #P connect 1 0 2 0; > #P connect 2 0 3 0; > #P lcolor 1; > #P connect 3 0 4 0; > #P lcolor 1; > #P connect 4 0 0 0; > #P connect 5 0 4 1; > #P pop; > #P newobj 255 145 82 9109513 p noisy_placment; > #P newex 255 83 33 9109513 r draw; > #P newex 255 103 68 9109513 speedlim 1000; > #P objectname jit.matrix[5]; > #P button 144 36 15 0; > #P newex 255 168 56 9109513 t l l; > #P objectname jit.matrix[3]; > #N vpatcher 421 64 850 484; > #P window setfont "Sans Serif" 9.; > #P comment 137 257 191 9109513 < here we force every quad to face ceneter; > #P button 72 52 15 0; > #P newex 50 71 27 9109513 b 2; > #P newex 50 50 21 9109513 r l0; > #P newex 50 159 195 9109513 jit.op @op * * * pass pass @val 0.15 0.15 0.; > #B color 6; > #P objectname jit.op[2]; > #P newex 285 190 86 9109513 jit.matrix feedback; > #B color 4; > #P objectname jit.matrix[4]; > #N vpatcher 370 221 856 378; > #P origin 0 -10; > #P window setfont "Sans Serif" 14.; > #P newex 16 49 407 9109518 jit.expr @expr "in[0].p[0]*cos(HALFPI) - > in[0].p[1]*sin(HALFPI)" "in[0].p[1]*cos(HALFPI) + in[0].p[0]*sin(HALFPI)" > in[0] in[0] in[0]; > #P objectname jit.expr; > #P inlet 16 31 15 0; > #P outlet 16 128 15 0; > #P connect 1 0 2 0; > #P connect 2 0 0 0; > #P pop; > #P newobj 50 205 102 9109513 p matrix2rotationZZZZ; > #B color 5; > #P newex 118 231 212 9109513 jit.expr @expr 0. 0. "atan2(in[0].p[1] \\\, > in[0].p[0])"; > #P newex 285 158 33 9109513 r draw; > #P objectname receive[3]; > #N vpatcher 370 221 928 467; > #P origin 0 -10; > #P window setfont "Sans Serif" 9.; > #P window linecount 1; > #P newex 11 83 467 9109513 jit.expr @expr in[0] > "in[0].p[1]*cos(in[1])-in[0].p[2]*sin(in[1])" > "in[0].p[2]*cos(in[1])+in[0].p[1]*sin(in[1])" in[0] in[0]; > #P objectname jit.expr [2]; > #P window linecount 0; > #P newex 469 56 56 9109513 jit.unpack 3; > #P objectname jit.unpack; > #P newex 11 120 469 9109513 jit.expr @expr > "in[0].p[0]*cos(in[1])+in[0].p[2]*sin(in[1])" in[0] > "in[0].p[2]*cos(in[1])-in[0].p[0]*sin(in[1])" in[0] in[0]; > #P objectname jit.expr[1]; > #P newex 11 159 480 9109513 jit.expr @expr "in[0].p[0]*cos(in[1]) - > in[0].p[1]*sin(in[1])" "in[0].p[1]*cos(in[1]) + in[0].p[0]*sin(in[1])" in[0] > in[0] in[0]; > #P objectname jit.expr; > #P inlet 11 63 15 0; > #P inlet 467 32 15 0; > #P outlet 11 181 15 0; > #P connect 2 0 6 0; > #P connect 6 0 4 0; > #P connect 4 0 3 0; > #P connect 3 0 0 0; > #P connect 5 0 6 1; > #P connect 1 0 5 0; > #P fasten 5 1 4 1 489 119 475 119; > #P fasten 5 2 3 1 504 150 486 150; > #P pop; > #P newobj 50 254 78 9109513 p matrix2rotation; > #B color 5; > #P newex 50 183 44 9109513 jit.matrix; > #P objectname receive[2]; > #N vpatcher 25 70 595 342; > #P origin 0 -10; > #P button 75 28 15 0; > #P window setfont "Sans Serif" 9.; > #P flonum 152 129 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0; > #P window linecount 0; > #P newex 50 129 98 9109513 jit.op @op * @val 0.9; > #P objectname jit.op[4]; > #P newex 50 108 58 9109513 jit.op @op +; > #P objectname jit.op[3]; > #P window setfont "Sans Serif" 14.; > #P window linecount 2; > #P newex 98 73 392 9109518 jit.expr @expr > "(cell[0]%4.>0.)*(cell[0]%4.<3.)" "(cell[0]%4>1)" "0." > "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.1" "(cell[0]%4>1)*0.1"; > #P objectname jit.expr[1]; > #P window setfont "Sans Serif" 9.; > #P window linecount 1; > #P newex 50 50 110 9109513 jit.matrix 5 float32 40 10; > #B color 4; > #P objectname jit.matrix[1]; > #P inlet 50 30 15 0; > #P outlet 50 153 15 0; > #P comment 191 131 100 9109513 why?!; > #P connect 2 0 3 0; > #P connect 8 0 3 0; > #P connect 3 0 5 0; > #P connect 5 0 6 0; > #P connect 6 0 1 0; > #P connect 7 0 8 0; > #P fasten 3 0 4 0 55 71 103 71; > #P connect 4 0 5 1; > #P connect 7 0 6 1; > #P pop; > #P newobj 50 137 61 9109513 p quadMaker; > #P newex 50 115 203 9109513 jit.expr @expr "-0.5" "-0.5" "0." norm[0] > norm[1]; > #P objectname jit.expr[2]; > #P newex 50 94 105 9109513 jit.matrix 5 float32 10 8; > #P objectname jit.matrix[3]; > #P outlet 50 312 15 0; > #P connect 13 0 12 0; > #P connect 11 0 12 0; > #P connect 12 0 1 0; > #P connect 12 1 1 0; > #P connect 1 0 2 0; > #P connect 2 0 3 0; > #P connect 3 0 10 0; > #P fasten 6 0 4 0 290 180 55 180; > #P connect 10 0 4 0; > #P connect 4 0 8 0; > #P connect 8 0 5 0; > #P connect 5 0 0 0; > #P fasten 9 0 7 0 290 226 123 226; > #P fasten 7 0 5 1 123 251 123 251; > #P fasten 6 0 9 0 290 183 290 183; > > #P pop; > #P newobj 145 232 73 9109513 p quad_Prepere; > #P newex 159 86 23 9109513 s l2; > #P number 72 30 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0; > #P objectname number; > #P newex 24 27 21 9109513 r l2; > #P objectname receive; > #P newex 183 86 23 9109513 s l0; > #P newex 159 62 34 9109513 t b b; > #P window setfont "Sans Serif" 14.; > #P newex 159 34 67 9109518 loadbang; > #B color 5; > #P window setfont "Sans Serif" 9.; > #N vpatcher 530 245 771 446; > #P origin 64 -4; > #P window setfont "Sans Serif" 9.; > #P window linecount 1; > #P newex 51 84 40 9109513 sel 0 1; > #P message 51 128 152 9109513 border 1 \, size 320 240 \, pos 10 463; > #P message 66 107 160 9109513 border 0 \, size 1024 778 \, \, pos 1024 0; > #P toggle 51 66 15 0; > #P window linecount 0; > #P newex 50 44 35 9109513 sel 27; > #P newex 50 21 40 9109513 key; > #P outlet 56 154 15 0; > #P fasten 1 0 2 0 55 42 55 42; > #P connect 2 0 3 0; > #P connect 3 0 6 0; > #P fasten 6 0 5 0 56 106 56 106; > #P connect 4 0 0 0; > #P connect 5 0 0 0; > #P connect 6 1 4 0; > #P pop; > #P newobj 9 142 25 9109513 p fs; > #P window linecount 2; > #P newex 9 164 131 9109513 jit.window rott @size 320 240 @floating 1 @pos 10 > 450; > #P objectname jit.window; > #P newex 48 127 141 9109513 jit.gl.render rott @camera 0 0 3 @erase_color 0. > 0. 0. 1.; > #P objectname jit.gl.render; > #P toggle 48 27 20 0; > #P objectname toggle; > #P window linecount 1; > #P newex 48 53 50 9109513 qmetro 20; > #P newex 72 106 35 9109513 s draw; > #P newex 48 75 58 9109513 t b b erase; > #P window linecount 2; > #P newex 145 418 234 9109513 jit.gl.mesh rott @draw_mode quads @color 1. 1. > 1. 1. @blend_enable 1 @depth_enable 0 @texture numbers; > #P objectname jit.gl.mesh; > #P window linecount 1; > #P comment 229 40 28 9109513 bang; > #P button 255 126 15 0; > #P newex 145 395 120 9109513 jit.op @op + + + pass pass; > #P objectname jit.op[2]; > #P user panel 224 190 314 201; > #X brgb 191 191 191; > #X frgb 0 0 0; > #X border 1; > #X rounded 0; > #X shadow 0; > #X done; > #P comment 542 201 56 9109513 << distance; > #P connect 12 0 11 0; > #P connect 16 0 9 0; > #P connect 9 0 8 0; > #P fasten 8 0 6 0 53 83 53 83; > #P fasten 6 2 10 0 101 102 53 102; > #P connect 6 0 10 0; > #P connect 6 1 7 0; > #P fasten 17 0 8 1 77 49 93 49; > #P connect 19 0 2 0; > #P lcolor 1; > #P connect 2 0 5 0; > #P lcolor 1; > #P connect 21 0 13 0; > #P connect 13 0 14 0; > #P connect 14 0 18 0; > #P connect 14 1 15 0; > #P fasten 27 0 28 0 260 267 233 267; > #P fasten 29 0 31 0 291 311 238 311; > #P connect 31 0 33 0; > #P connect 33 0 32 0; > #P connect 23 0 22 0; > #P lcolor 1; > #P connect 22 0 3 0; > #P lcolor 1; > #P connect 3 0 24 0; > #P connect 24 0 20 0; > #P connect 20 0 25 0; > #P connect 25 0 26 0; > #P connect 26 0 27 0; > #P connect 32 0 2 1; > #P connect 33 0 31 1; > #P fasten 27 0 29 0 260 267 291 267; > #P connect 20 1 30 0; > #P connect 30 0 29 1; > #P connect 30 1 29 2; > #P connect 30 2 29 3; > #P window clipboard copycount 34; > > > > On 10/15/07, andrew benson <andrewb at cycling74.com> wrote: > > Your best bet will be to convert the matrix to polar coordinates, apply > > your clamp or modulo function on the amplitude, and then convert back to > > cartesian coords. Jit.expr should be your best bet with that. > > > > I don't have time to come up with an example, but I think there have > > already been some cartopol/poltocar jit.expr examples posted. > > > > Best of luck, > > Andrew B. > > _______________________________________________ > > jitter mailing list > > jitter at cycling74.com > > http://www.cycling74.com/mailman/listinfo/jitter > > > > > _______________________________________________ > jitter mailing list > jitter at cycling74.com > http://www.cycling74.com/mailman/listinfo/jitter > >
- Previous message: [jitter] constrain matrix to boundaries
- Next message: [jitter] weird slab behaviour?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
