Forums > Jitter

Strange artifacts in a Matrix

July 7, 2007 | 1:57 pm

Hi,

I’m putting the forumla below through a matrix and doing a cartisan to polar conversion to create a chladni pattern.

(-4755.8*pow(norm[0],7)+15454*pow(norm[0],6)-19820*pow(norm[0],5)+12702*pow(norm[0],4)-4240.1*pow(norm[0],3)+698.68*pow(norm[0],2)-49.568*norm[0]+1.4278)*cos(2*snorm[1]*PI)*cos(17.960)

However, the pattern is *perfect* and the formula is correct but there are strange artifacts in the picture attached. What are these?

Thanks,

Carl.


July 7, 2007 | 2:19 pm

Hmm adding jit.normalize removes the artifacts… but the pattern is too blured.


July 7, 2007 | 5:32 pm

That looks cool. working on cymatics stuff? if you get it working and
dont mind, id love to look at the patch :)

Are you feeding in a float32 matrix of a char matrix? might be
rounding errors ?

just a wild guess.

On Jul 7, 2007, at 9:57 AM, Carl Knott wrote:

> Hi,
>
> I’m putting the forumla below through a matrix and doing a cartisan
> to polar conversion to create a chladni pattern.
>
> (-4755.8*pow(norm[0],7)+15454*pow(norm[0],6)-19820*pow(norm[0],5)
> +12702*pow(norm[0],4)-4240.1*pow(norm[0],3)+698.68*pow(norm[0],
> 2)-49.568*norm[0]+1.4278)*cos(2*snorm[1]*PI)*cos(17.960)
>
> However, the pattern is *perfect* and the formula is correct but
> there are strange artifacts in the picture attached. What are these?
>
> Thanks,
>
> Carl.
>
>
>

v a d e //

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



Dan
July 7, 2007 | 8:36 pm

Where are the artifacts, Carl? I’m not familiar with Chladni
patterns and I’m curious what’s wrong with your results — they look
fine to me.


July 8, 2007 | 4:48 pm

Xade – affraid thats not it, but when I get it sorted I’ll give you a shout! should be a month or so.

Dan – can you see the big white blobs on the outskirts of the window.. well, they should’t be there, also, sometimes I get a flashing dot in the centre of the first circle! Strange…

Any ideas? Could it be something to do with my Cart-to-polar conversion?


July 8, 2007 | 4:57 pm

Is your data wrapping? that would be my guess. If it’s oustide the
range [0, 1] it won’t look right.

wes

On 7/8/07, Carl Knott wrote:
>
> Xade – affraid thats not it, but when I get it sorted I’ll give you a shout! should be a month or so.
>
> Dan – can you see the big white blobs on the outskirts of the window.. well, they should’t be there, also, sometimes I get a flashing dot in the centre of the first circle! Strange…
>
> Any ideas? Could it be something to do with my Cart-to-polar conversion?
>


July 8, 2007 | 6:10 pm

I’m not sure if I’ve wrapped it correctly Wes.

I’ve just written this example for you, perhaps you could take a look and try to isolate the problem for me?

max v2;
#N vpatcher 414 250 1175 936;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 408 240 48 196617 loadbang;
#P newex 301 335 152 196617 jit.expr @expr "1 – abs(in[0])";
#N vpatcher 464 211 1064 611;
#P outlet 156 285 15 0;
#P inlet 210 59 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 79 161 478 415;
#P outlet 62 194 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 62 165 64 196617 jit.op @op +;
#P inlet 212 60 15 0;
#P inlet 62 61 15 0;
#P inlet 310 68 15 0;
#P window linecount 0;
#P newex 310 105 30 196617 !- 1.;
#P window linecount 1;
#P newex 212 131 108 196617 jit.op @op * @val 0.1;
#P window linecount 0;
#P newex 62 130 114 196617 jit.op @op * @val 0.94;
#P connect 4 0 0 0;
#P connect 0 0 6 0;
#P connect 6 0 7 0;
#P connect 1 0 6 1;
#P fasten 3 0 0 1 315 97 171 97;
#P connect 5 0 1 0;
#P connect 3 0 2 0;
#P connect 2 0 1 1;
#P pop;
#P newobj 156 195 45 196617 p mixer;
#P newex 156 230 65 196617 jit.op @op *;
#P newex 156 164 181 196617 jit.matrix 1 float32 256 256 @thru 0;
#P newex 172 129 134 196617 jit.noise 1 float32 256 256;
#P newex 156 91 63 196617 qmetro 100;
#P inlet 156 59 15 0;
#P window linecount 2;
#P comment 11 46 100 196617 Virtual sand , not written by Carlos.;
#P fasten 1 0 2 0 161 90;
#P fasten 5 0 4 0 161 257 136 257 136 154 161 154;
#P connect 2 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 8 0;
#P fasten 2 0 3 0 161 122 177 122;
#P connect 3 0 6 1;
#P connect 7 0 5 1;
#P pop;
#P newobj 227 381 84 196617 p setVirtualSand;
#P newex 301 296 117 196617 jit.repos @boundmode 4;
#N vpatcher 495 125 1095 525;
#P outlet 132 317 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 201 183 14 196617 1;
#P newex 132 275 167 196617 jit.matrix cartopol 2 long 256 256;
#P flonum 270 215 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 201 214 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 132 243 148 196617 jit.expr @inputs 3 @verbose 1;
#P newex 132 152 275 196617 jit.gencoord 2 float32 256 256 @scale 2. 2. @offset -1 -1;
#P window linecount 2;
#P message 158 101 328 196617 expr "hypot(in[0].p[0]*in[1]\,in[0].p[1]*in[2])*dim[0]" "(((atan2(in[0].p[1]*in[2]\,in[0].p[0]*in[1])/PI)*0.5)+0.5)*dim[1]";
#P button 132 71 15 0;
#P inlet 132 43 15 0;
#P comment 170 43 133 196617 Cartisian to polar conversion.;
#P connect 1 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 5 0;
#P fasten 3 0 5 0 163 138 137 138;
#P connect 5 0 8 0;
#P connect 8 0 10 0;
#P fasten 2 0 3 0 137 92 163 92;
#P fasten 2 0 9 0 137 175 206 175;
#P connect 9 0 6 0;
#P connect 6 0 5 1;
#P fasten 9 0 7 0 206 206 275 206;
#P connect 7 0 5 2;
#P pop;
#P newobj 408 266 77 196617 p setCartToPol;
#P newex 227 423 205 196617 jit.window CircleMembrane @size 256 256;
#P button 301 185 15 0;
#P newex 301 212 142 196617 jit.matrix 1 float32 256 256;
#P newex 301 267 45 196617 jit.expr;
#P newex 301 27 48 196617 loadbang;
#P newex 301 153 69 196617 prepend expr;
#P newex 301 123 52 196617 toSymbol;
#P window linecount 3;
#P message 301 70 308 196617 (-697.45*pow(norm[0]\,6)+2374.6*pow(norm[0]\,5)-3165.5*pow(norm[0]\,4)+2083*pow(norm[0]\,3)-697*pow(norm[0]\,2)+107.87*norm[0]-5.5013)*cos(3*PI*snorm[1]);
#P window linecount 2;
#P comment 420 124 196 196617 For this one there is flickerin in the center.;
#P comment 489 236 100 196617 U mite have to fire this urself;
#P window linecount 6;
#P comment 28 68 184 196617 (-788.44*pow(norm[0]\,6)+2535.6*pow(norm[0]\,5)-3137*pow(norm[0]\,4)+1866.5*pow(norm[0]\,3)-541.85*pow(norm[0]\,2)+67.561*norm[0]-2.332)* cos(1*PI*snorm[1]);
#P comment 26 148 186 196617 (-321.41*pow(norm[0]\,6)+1243.3*pow(norm[0]\,5)-1848.9*pow(norm[0]\,4)+1322.5*pow(norm[0]\,3)-462.47*pow(norm[0]\,2)+69.878*norm[0]-2.9903)*cos(1*PI*snorm[1]);
#P comment 27 226 183 196617 (-697.45*pow(norm[0]\,6)+2374.6*pow(norm[0]\,5)-3165.5*pow(norm[0]\,4)+2083*pow(norm[0]\,3)-697*pow(norm[0]\,2)+107.87*norm[0]-5.5013)*cos(3*PI*snorm[1]);
#P window linecount 2;
#P comment 36 35 100 196617 Copy and paste these examples….;
#P window linecount 6;
#P comment 28 306 180 196617 (173.17*pow(norm[0]\,6)-703.87*pow(norm[0]\,5)+1073.6*pow(norm[0]\,4)-769.18*pow(norm[0]\,3)+262.7*pow(norm[0]\,2)-38.31*norm[0]+1.8886)*cos(4*PI*snorm[1]);
#P window linecount 1;
#P comment 622 66 100 196617 < --- Click me :);
#P window linecount 3;
#P comment 233 475 196 196617 Btw… in these examples the smallest circle where the artifact is shouldn’t be there….;
#P window linecount 1;
#P comment 503 537 100 196617 Thank u :);
#P fasten 13 0 20 0 306 50 232 50;
#P connect 20 0 17 0;
#P connect 13 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P fasten 12 0 16 0 306 183 306 183;
#P connect 16 0 15 0;
#P fasten 12 0 14 0 306 178 291 178 291 238 306 238;
#P connect 15 0 14 0;
#P connect 14 0 19 0;
#P connect 19 0 21 0;
#P connect 21 0 20 1;
#P connect 22 0 18 0;
#P connect 18 0 19 1;
#P pop;


July 8, 2007 | 6:30 pm

If you stick jit.3m at the end there, you’ll see hwat the problem is.
Jit.3m reports the range of data being [-inf, inf]. Apparently you
have a singularity where the image is trashed.

wes

On 7/8/07, Carl Knott wrote:
>
> I’m not sure if I’ve wrapped it correctly Wes.
>
> I’ve just written this example for you, perhaps you could take a look and try to isolate the problem for me?
>
> max v2;
> #N vpatcher 414 250 1175 936;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 408 240 48 196617 loadbang;
> #P newex 301 335 152 196617 jit.expr @expr "1 – abs(in[0])";
> #N vpatcher 464 211 1064 611;
> #P outlet 156 285 15 0;
> #P inlet 210 59 15 0;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #N vpatcher 79 161 478 415;
> #P outlet 62 194 15 0;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 62 165 64 196617 jit.op @op +;
> #P inlet 212 60 15 0;
> #P inlet 62 61 15 0;
> #P inlet 310 68 15 0;
> #P window linecount 0;
> #P newex 310 105 30 196617 !- 1.;
> #P window linecount 1;
> #P newex 212 131 108 196617 jit.op @op * @val 0.1;
> #P window linecount 0;
> #P newex 62 130 114 196617 jit.op @op * @val 0.94;
> #P connect 4 0 0 0;
> #P connect 0 0 6 0;
> #P connect 6 0 7 0;
> #P connect 1 0 6 1;
> #P fasten 3 0 0 1 315 97 171 97;
> #P connect 5 0 1 0;
> #P connect 3 0 2 0;
> #P connect 2 0 1 1;
> #P pop;
> #P newobj 156 195 45 196617 p mixer;
> #P newex 156 230 65 196617 jit.op @op *;
> #P newex 156 164 181 196617 jit.matrix 1 float32 256 256 @thru 0;
> #P newex 172 129 134 196617 jit.noise 1 float32 256 256;
> #P newex 156 91 63 196617 qmetro 100;
> #P inlet 156 59 15 0;
> #P window linecount 2;
> #P comment 11 46 100 196617 Virtual sand , not written by Carlos.;
> #P fasten 1 0 2 0 161 90;
> #P fasten 5 0 4 0 161 257 136 257 136 154 161 154;
> #P connect 2 0 4 0;
> #P connect 4 0 6 0;
> #P connect 6 0 5 0;
> #P connect 5 0 8 0;
> #P fasten 2 0 3 0 161 122 177 122;
> #P connect 3 0 6 1;
> #P connect 7 0 5 1;
> #P pop;
> #P newobj 227 381 84 196617 p setVirtualSand;
> #P newex 301 296 117 196617 jit.repos @boundmode 4;
> #N vpatcher 495 125 1095 525;
> #P outlet 132 317 15 0;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P message 201 183 14 196617 1;
> #P newex 132 275 167 196617 jit.matrix cartopol 2 long 256 256;
> #P flonum 270 215 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 201 214 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 132 243 148 196617 jit.expr @inputs 3 @verbose 1;
> #P newex 132 152 275 196617 jit.gencoord 2 float32 256 256 @scale 2. 2. @offset -1 -1;
> #P window linecount 2;
> #P message 158 101 328 196617 expr "hypot(in[0].p[0]*in[1]\,in[0].p[1]*in[2])*dim[0]" "(((atan2(in[0].p[1]*in[2]\,in[0].p[0]*in[1])/PI)*0.5)+0.5)*dim[1]";
> #P button 132 71 15 0;
> #P inlet 132 43 15 0;
> #P comment 170 43 133 196617 Cartisian to polar conversion.;
> #P connect 1 0 2 0;
> #P connect 2 0 4 0;
> #P connect 4 0 5 0;
> #P fasten 3 0 5 0 163 138 137 138;
> #P connect 5 0 8 0;
> #P connect 8 0 10 0;
> #P fasten 2 0 3 0 137 92 163 92;
> #P fasten 2 0 9 0 137 175 206 175;
> #P connect 9 0 6 0;
> #P connect 6 0 5 1;
> #P fasten 9 0 7 0 206 206 275 206;
> #P connect 7 0 5 2;
> #P pop;
> #P newobj 408 266 77 196617 p setCartToPol;
> #P newex 227 423 205 196617 jit.window CircleMembrane @size 256 256;
> #P button 301 185 15 0;
> #P newex 301 212 142 196617 jit.matrix 1 float32 256 256;
> #P newex 301 267 45 196617 jit.expr;
> #P newex 301 27 48 196617 loadbang;
> #P newex 301 153 69 196617 prepend expr;
> #P newex 301 123 52 196617 toSymbol;
> #P window linecount 3;
> #P message 301 70 308 196617 (-697.45*pow(norm[0]\,6)+2374.6*pow(norm[0]\,5)-3165.5*pow(norm[0]\,4)+2083*pow(norm[0]\,3)-697*pow(norm[0]\,2)+107.87*norm[0]-5.5013)*cos(3*PI*snorm[1]);
> #P window linecount 2;
> #P comment 420 124 196 196617 For this one there is flickerin in the center.;
> #P comment 489 236 100 196617 U mite have to fire this urself;
> #P window linecount 6;
> #P comment 28 68 184 196617 (-788.44*pow(norm[0]\,6)+2535.6*pow(norm[0]\,5)-3137*pow(norm[0]\,4)+1866.5*pow(norm[0]\,3)-541.85*pow(norm[0]\,2)+67.561*norm[0]-2.332)* cos(1*PI*snorm[1]);
> #P comment 26 148 186 196617 (-321.41*pow(norm[0]\,6)+1243.3*pow(norm[0]\,5)-1848.9*pow(norm[0]\,4)+1322.5*pow(norm[0]\,3)-462.47*pow(norm[0]\,2)+69.878*norm[0]-2.9903)*cos(1*PI*snorm[1]);
> #P comment 27 226 183 196617 (-697.45*pow(norm[0]\,6)+2374.6*pow(norm[0]\,5)-3165.5*pow(norm[0]\,4)+2083*pow(norm[0]\,3)-697*pow(norm[0]\,2)+107.87*norm[0]-5.5013)*cos(3*PI*snorm[1]);
> #P window linecount 2;
> #P comment 36 35 100 196617 Copy and paste these examples….;
> #P window linecount 6;
> #P comment 28 306 180 196617 (173.17*pow(norm[0]\,6)-703.87*pow(norm[0]\,5)+1073.6*pow(norm[0]\,4)-769.18*pow(norm[0]\,3)+262.7*pow(norm[0]\,2)-38.31*norm[0]+1.8886)*cos(4*PI*snorm[1]);
> #P window linecount 1;
> #P comment 622 66 100 196617 < --- Click me :);
> #P window linecount 3;
> #P comment 233 475 196 196617 Btw… in these examples the smallest circle where the artifact is shouldn’t be there….;
> #P window linecount 1;
> #P comment 503 537 100 196617 Thank u :);
> #P fasten 13 0 20 0 306 50 232 50;
> #P connect 20 0 17 0;
> #P connect 13 0 10 0;
> #P connect 10 0 11 0;
> #P connect 11 0 12 0;
> #P fasten 12 0 16 0 306 183 306 183;
> #P connect 16 0 15 0;
> #P fasten 12 0 14 0 306 178 291 178 291 238 306 238;
> #P connect 15 0 14 0;
> #P connect 14 0 19 0;
> #P connect 19 0 21 0;
> #P connect 21 0 20 1;
> #P connect 22 0 18 0;
> #P connect 18 0 19 1;
> #P pop;
>
>


July 8, 2007 | 7:29 pm

Thanks Wez, from your advice I looked at the approximation again and, though not perfect, it has something to do with my range. Thanks for ur help :)


Viewing 9 posts - 1 through 9 (of 9 total)