XML Feeds

.

[jitter] constrain matrix to boundaries

yair reshef yair99 at gmail.com
Mon Oct 15 12:31:37 MDT 2007


no thats not it.
mybe i didnt explained enough?

On 10/15/07, vade <doktorp at mac.com> wrote:
>
> you should be able to use a "lumakey" mixer (I think, If I understand)
> with a white circular mask and black border. This would set values to 0
> where the mask is black, and pass through anything in the white?
> On Oct 15, 2007, at 1:51 PM, yair reshef wrote:
>
> hi, i have a "shatter"-based particle system which i would like to
> constrain to a maximum radius (circle).
> did anyone had success with boundary clipping of a matrix?
> i *think* what i need is jit.clip with a second input for matrix. i tried
> using jit.op (<p,max) but failed. another option was to find the distance
> of each particle from center and constrain it if it is longer the allowed.
>
> here is a patch
>
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 338 201 18 9109513 <<;
> #N vpatcher 15 55 615 455;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 50 95 93 9109513 jit.op @op * @val 2.;
> #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 pop;
> #P newobj 255 201 82 9109513 p noisy_placment;
> #N vpatcher 15 55 615 455;
> #P window setfont "Sans Serif" 9.;
> #P newex 50 251 32 9109513 jit.clip;
> #P comment 244 222 18 9109513 ??;
> #P newex 50 219 191 9109513 jit.expr @expr "hypot(snorm[0] \\\,
> snorm[1])";
> #P window linecount 2;
> #P comment 180 155 227 9109513 and even if there was \, this matrix wont
> help as every particle will only be checked against one point;
> #P window linecount 1;
> #P newex 52 99 105 9109513 jit.matrix 3 float32 10 8;
> #P newex 166 91 105 9109513 jit.matrix 3 float32 80 1;
> #P newex 166 114 118 9109513 jit.scanwrap 3 float32 10 8;
> #P newex 52 138 124 9109513 jit.op @op clip;
> #P button 166 50 15 0;
> #P newex 166 70 314 9109513 jit.gl.gridshape @shape circle @dim 80 1
> @matrixoutput 1 @automatic 1;
> #P comment 185 52 271 9109513 get outer ring and warp to fill all matrix;
> #P comment 180 139 100 9109513 but there isnt one...;
> #P connect 7 0 4 0;
> #P connect 3 0 2 0;
> #P connect 2 0 6 0;
> #P connect 6 0 5 0;
> #P connect 5 0 4 1;
> #P pop;
> #P newobj 355 201 54 9109513 p constrain;
> #P newex 255 139 33 9109513 r draw;
> #P newex 255 159 68 9109513 speedlim 1000;
> #P objectname jit.matrix[5];
> #P button 144 36 15 0;
> #P newex 255 224 16 9109513 t l;
> #P objectname jit.matrix[3];
> #N vpatcher 421 64 850 484;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 137 257 191 9109513 < here we force every quad to face ceneter;
> #P button 72 52 15 0;
> #P newex 128 286 87 9109513 jit.matrix _distance;
> #B color 4;
> #P objectname jit.matrix[1];
> #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 746 385;
> #P origin 0 -10;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 285 29 69 9109513 loadmess 1.57;
> #P objectname jit.expr[1];
> #P flonum 249 32 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 0;
> #P newex 16 49 249 9109513 jit.expr @expr "in[0].p[0]*cos(PI/2.) -
> in[0].p[1]*sin(PI/2.)" "in[0].p[1]*cos(PI/2.) + in[0].p[0]*sin(PI/2.)" in[0]
> in[0] in[0];
> #P objectname jit.expr;
> #P inlet 16 31 15 0;
> #P outlet 16 121 15 0;
> #P connect 1 0 2 0;
> #P connect 2 0 0 0;
> #P connect 4 0 3 0;
> #P connect 3 0 2 1;
> #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 window linecount 2;
> #P comment 218 287 100 9109513 < use the distance to clip motion to
> circle;
> #P connect 15 0 13 0;
> #P connect 12 0 13 0;
> #P connect 13 0 2 0;
> #P connect 13 1 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 4 0;
> #P connect 4 0 11 0;
> #P fasten 7 0 5 0 290 180 55 180;
> #P connect 11 0 5 0;
> #P connect 5 0 9 0;
> #P connect 9 0 6 0;
> #P connect 6 0 1 0;
> #P fasten 10 0 8 0 290 226 123 226;
> #P fasten 8 0 6 1 123 251 123 251;
> #P fasten 8 0 14 0 123 252 133 252;
> #P fasten 7 0 10 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 293 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 182 15 0;
> #P newex 266 257 86 9109513 jit.matrix feedback;
> #P objectname jit.matrix[4];
> #P newex 145 257 120 9109513 jit.op @op + + + pass pass;
> #P objectname jit.op[2];
> #P window linecount 2;
> #P comment 415 202 83 9109513 how do i constrain position to circle?;
> #P window linecount 1;
> #P comment 357 258 137 9109513 look in quad_prepere for usage;
> #P connect 21 0 2 1;
> #P lcolor 1;
> #P fasten 21 0 3 0 260 250 271 250;
> #P lcolor 1;
> #P connect 4 0 26 0;
> #P connect 26 0 21 0;
> #P connect 13 0 12 0;
> #P connect 17 0 10 0;
> #P connect 10 0 9 0;
> #P fasten 9 0 7 0 53 83 53 83;
> #P fasten 7 2 11 0 101 102 53 102;
> #P connect 7 0 11 0;
> #P connect 7 1 8 0;
> #P fasten 18 0 9 1 77 49 93 49;
> #P connect 22 0 14 0;
> #P connect 14 0 15 0;
> #P connect 15 0 19 0;
> #P connect 15 1 16 0;
> #P connect 20 0 2 0;
> #P lcolor 1;
> #P connect 2 0 6 0;
> #P lcolor 1;
> #P connect 24 0 23 0;
> #P lcolor 1;
> #P connect 23 0 4 0;
> #P lcolor 1;
> #P window clipboard copycount 28;
>
> _______________________________________________
> jitter mailing list
> jitter at cycling74.com
> http://www.cycling74.com/mailman/listinfo/jitter
>
>
> *v a d e //*
>
> *www.vade.info*
> *abstrakt.vade.info*
>
>
>
>
> _______________________________________________
> jitter mailing list
> jitter at cycling74.com
> http://www.cycling74.com/mailman/listinfo/jitter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cycling74.com/pipermail/jitter/attachments/20071015/6b4556d6/attachment.htm


More information about the jitter mailing list