max v2; #N vpatcher 121 44 826 530; #P origin 0 38; #P user hslider 169 207 15 128 100 1 1 0; #P window setfont "Sans Serif" 9.; #P number 132 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P comment 51 253 259 196617 3 components after projection by PCA on the last values; #P window linecount 4; #P comment 286 40 333 196617 This patch calculates a PCA on a ring buffer of the x y z acceleration coordinates and projects the current coordinates on the main component. This way you can shake your Wiimote in any direction and always get a value moving back and forth.; #P window linecount 2; #P comment 464 103 110 196617 first 2 components after projection; #P window linecount 1; #P hidden newex 594 130 62 196617 ftm.list; #N vpatcher 525 313 945 710; #P outlet 80 322 15 0; #P inlet 80 53 15 0; #P user ftm.mess 80 177 224 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#ftm version 2 1; #T _#scope begin; #T _#absargs $0_ $1_ $2_ $3_ $4_ $5_ $6_ $7_ $8_ $9_; #T _#line "_lineto (64 + $1[0] * 90.5) (64 - $1[1] * 90.5)"; #P connect 1 0 0 0; #P connect 0 0 2 0; #P pop; #P hidden newobj 464 130 128 196617 p line; #N vpatcher 525 313 945 710; #P outlet 80 322 15 0; #P inlet 80 53 15 0; #P user ftm.mess 80 177 224 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#line "_lineto (64 + $1[0] * 90.5) (64 - $1[1] * 90.5)"; #P connect 1 0 0 0; #P connect 0 0 2 0; #P pop; #P hidden newobj 334 130 128 196617 p line; #N vpatcher 10 59 445 429; #P user ftm.mess 217 153 50 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#line "_$1[2 0]"; #P user ftm.mess 144 153 50 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#line "_$1[1 0]"; #P user ftm.mess 71 153 50 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#line "_$1[0 0]"; #P window setfont "Sans Serif" 9.; #N vpatcher 20 74 548 564; #P user ftm.mess 27 173 196 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 2; #T _#line "_($vec10 rotate -1)\; ($vec10 set 0 0 $1)"; #P outlet 27 413 15 0; #P inlet 27 71 15 0; #P user ftm.mess 126 257 196 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 2; #T _#line "_($vec50 rotate -1)\; ($vec50 set 0 0 $1)"; #P outlet 126 413 15 0; #P inlet 126 71 15 0; #P user ftm.mess 101 235 196 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 2; #T _#line "_($vec40 rotate -1)\; ($vec40 set 0 0 $1)"; #P outlet 101 413 15 0; #P inlet 101 71 15 0; #P user ftm.mess 76 213 196 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 2; #T _#line "_($vec30 rotate -1)\; ($vec30 set 0 0 $1)"; #P outlet 76 413 15 0; #P inlet 76 71 15 0; #P user ftm.mess 51 193 196 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 2; #T _#line "_($vec20 rotate -1)\; ($vec20 set 0 0 $1)"; #P outlet 51 413 15 0; #P inlet 51 71 15 0; #P user ftm.object 366 198 66 18 3 9 --> 2; #T _#obj 1 fmat; #T _#def 0 "_fmat 256 1" vec50 local; #P user ftm.object 366 177 66 18 3 9 --> 2; #T _#obj 2 fmat; #T _#def 0 "_fmat 256 1" vec40 local; #P user ftm.object 366 156 66 18 3 9 --> 2; #T _#obj 3 fmat; #T _#def 0 "_fmat 256 1" vec30 local; #P user ftm.object 366 135 66 18 3 9 --> 2; #T _#obj 4 fmat; #T _#def 0 "_fmat 256 1" vec20 local; #P user ftm.object 366 115 66 18 3 9 --> 2; #T _#obj 5 fmat; #T _#def 0 "_fmat 256 1" vec10 local; #P connect 17 0 19 0; #P connect 19 0 18 0; #P connect 5 0 7 0; #P connect 7 0 6 0; #P connect 8 0 10 0; #P connect 10 0 9 0; #P connect 11 0 13 0; #P connect 13 0 12 0; #P connect 14 0 16 0; #P connect 16 0 15 0; #P pop; #P newobj 71 215 304 196617 p scroll display 0; #P outlet 71 274 15 0; #P outlet 144 274 15 0; #P outlet 217 274 15 0; #P outlet 290 274 15 0; #P outlet 363 274 15 0; #P inlet 71 71 15 0; #P connect 0 0 7 0; #P connect 7 0 6 0; #P connect 6 0 5 0; #P connect 0 0 8 0; #P connect 8 0 6 1; #P connect 6 1 4 0; #P connect 0 0 9 0; #P connect 9 0 6 2; #P connect 6 2 3 0; #P pop; #P hidden newobj 41 271 615 196617 p projection; #P user multiSlider 594 130 62 128 0. 1. 3 2937 15 0 0 2 0 0 0; #M frgb 124 124 124; #M brgb 255 255 255; #M rgb2 127 127 127; #M rgb3 0 0 0; #M rgb4 37 52 91; #M rgb5 74 105 182; #M rgb6 112 158 18; #M rgb7 149 211 110; #M rgb8 187 9 201; #M rgb9 224 62 37; #M rgb10 7 114 128; #P hidden newex 487 164 60 196617 loadmess 1; #P hidden newex 487 185 64 196617 metro 4000; #P user lcd 334 130 128 128 1 1 0 0 0; #P comment 19 81 211 196617 (DAAD-Edgard-Varese-Gastprofessor 2007); #P window setfont "Sans Serif" 12.; #P comment 19 17 214 196620 FTM meets the Wiimote (in Berlin); #P window setfont "Sans Serif" 9.; #P comment 19 68 156 196617 Norbert Schnell at the TU-Berlin; #P window setfont "Sans Serif" 24.; #P comment 19 34 150 196632 moving PCA; #P window setfont "Sans Serif" 9.; #P comment 75 121 57 196617 disconnect; #P hidden newex 106 135 50 196617 closebang; #P button 80 135 24 0; #P button 41 135 24 0; #P toggle 132 166 15 0; #N vpatcher 140 44 730 655; #P window setfont "Sans Serif" 9.; #P message 124 92 14 196617 0; #P user ftm.object 405 373 54 18 3 9 --> 1; #T _#obj 6 fmat; #T _#def 0 "_fmat 3 1" xyz local; #P inlet 101 51 15 0; #P outlet 244 505 15 0; #P message 101 147 57 196617 disconnect; #P outlet 404 505 15 0; #P newex 404 465 62 196617 prepend set; #P inlet 179 51 15 0; #P toggle 179 146 30 0; #P newex 266 274 71 196617 route connect; #P newex 194 114 31 196617 == 1; #P outlet 179 505 15 0; #P inlet 53 51 15 0; #P newex 279 249 63 196617 print status; #P newex 179 337 111 196617 route motion buttons; #P newex 179 310 69 196617 route remote; #P message 266 193 58 196617 getbattery; #N vpatcher 10 59 651 300; #P outlet 50 174 15 0; #P outlet 99 174 15 0; #P outlet 148 174 15 0; #P outlet 197 174 15 0; #P outlet 246 174 15 0; #P outlet 295 174 15 0; #P outlet 344 174 15 0; #P outlet 393 174 15 0; #P outlet 442 174 15 0; #P outlet 491 174 15 0; #P outlet 540 174 15 0; #P window setfont "Sans Serif" 9.; #P window linecount 0; #P newex 50 51 45 196617 & 8095; #P window linecount 1; #P newex 50 77 40 196617 change; #P toggle 540 140 15 0; #P newex 540 106 45 196617 & 4096; #P comment 555 140 29 196617 Plus; #P toggle 491 140 15 0; #P newex 491 106 45 196617 & 2048; #P comment 506 140 19 196617 Up; #P toggle 442 140 15 0; #P newex 442 106 45 196617 & 1024; #P comment 457 140 34 196617 Down; #P toggle 393 140 15 0; #P newex 393 106 39 196617 & 512; #P comment 408 140 33 196617 Right; #P toggle 344 140 15 0; #P newex 344 106 39 196617 & 256; #P comment 359 140 26 196617 Left; #P toggle 295 140 15 0; #P newex 295 106 39 196617 & 128; #P comment 310 140 34 196617 Home; #P toggle 246 140 15 0; #P newex 246 106 33 196617 & 16; #P comment 261 140 36 196617 Minus; #P toggle 197 140 15 0; #P newex 197 106 27 196617 & 8; #P comment 212 140 15 196617 A; #P toggle 148 140 15 0; #P newex 148 106 27 196617 & 4; #P comment 163 140 14 196617 B; #P toggle 99 140 15 0; #P newex 99 106 27 196617 & 2; #P comment 114 140 14 196617 1; #P toggle 50 140 15 0; #P newex 50 106 27 196617 & 1; #P comment 65 140 14 196617 2; #P inlet 50 25 15 0; #P connect 0 0 35 0; #P connect 35 0 34 0; #P fasten 34 0 2 0 55 100 55 100; #P connect 2 0 3 0; #P connect 3 0 46 0; #P fasten 34 0 5 0 55 100 104 100; #P connect 5 0 6 0; #P connect 6 0 45 0; #P fasten 34 0 8 0 55 100 153 100; #P connect 8 0 9 0; #P connect 9 0 44 0; #P fasten 34 0 11 0 55 100 202 100; #P connect 11 0 12 0; #P connect 12 0 43 0; #P fasten 34 0 14 0 55 100 251 100; #P connect 14 0 15 0; #P connect 15 0 42 0; #P fasten 34 0 17 0 55 100 300 100; #P connect 17 0 18 0; #P connect 18 0 41 0; #P fasten 34 0 20 0 55 100 349 100; #P connect 20 0 21 0; #P connect 21 0 40 0; #P fasten 34 0 23 0 55 100 398 100; #P connect 23 0 24 0; #P connect 24 0 39 0; #P fasten 34 0 26 0 55 100 447 100; #P connect 26 0 27 0; #P connect 27 0 38 0; #P fasten 34 0 29 0 55 100 496 100; #P connect 29 0 30 0; #P connect 30 0 37 0; #P fasten 34 0 32 0 55 100 545 100; #P connect 32 0 33 0; #P connect 33 0 36 0; #P pop; #P newobj 229 364 66 196617 p buttons; #P message 53 148 44 196617 connect; #P newex 179 196 58 196617 metro 20; #P newex 179 249 97 196617 aka.wiiremote; #B color 5; #P user ftm.mess 179 420 317 15 3 9 255 255 255 0 0 0 1 3 0 0 --> 1; #T _#line "_(($xyz set 0 0 ($1 - 132.5) (130.5 - $3) ($2 - 131)) div 153.796)"; #P connect 9 0 3 0; #P connect 19 0 17 0; #P connect 19 0 21 0; #P connect 14 0 13 0; #P connect 11 0 13 0; #P connect 21 0 13 0; #P connect 13 0 2 0; #P connect 5 0 1 0; #P connect 3 0 1 0; #P connect 17 0 1 0; #P connect 2 0 1 0; #P connect 1 0 6 0; #P connect 6 0 7 0; #P connect 7 0 0 0; #P connect 0 0 10 0; #P connect 12 0 11 0; #P connect 7 1 4 0; #P connect 7 0 18 0; #P connect 1 1 12 0; #P connect 1 1 8 0; #P connect 13 0 15 0; #P connect 15 0 16 0; #P pop; #P newobj 41 165 89 196617 p wii input; #P comment 149 166 43 196617 running; #P comment 36 121 44 196617 connect; #N vpatcher 148 44 660 663; #P user ftm.mess 380 94 92 27 3 9 255 255 255 0 0 0 2 2 0 0 --> 1; #T _#line "_($Qxyz rows $1)\;"; #T _#line "_($1 - 1)"; #P inlet 380 38 15 0; #P window setfont "Sans Serif" 9.; #P window linecount 1; #P comment 288 272 29 196617 PCA; #P user ftm.object 296 183 60 18 3 9 --> 1; #T _#obj 7 fmat; #T _#def 0 "_fmat 16 3" Qxyz local; #N counter 0 15; #X flags 0 0; #P newobj 324 126 68 196617 counter 0 15; #P newex 42 96 292 196617 t l l b; #P user ftm.mess 183 154 152 15 3 9 255 255 255 0 0 0 1 4 0 0 --> 1; #T _#line "_((($Qxyz rowref $4) set $1))"; #P outlet 42 565 15 0; #P outlet 286 570 15 0; #P inlet 42 38 15 0; #P window linecount 0; #P newex 42 199 164 196617 t l b; #N mnm.transpose --> 1; #P newobj 273 344 78 196617 mnm.transpose; #N ftm.copy fmat --> 1; #P newobj 42 418 74 196617 ftm.copy fmat; #P user ftm.mess 42 440 63 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#line "_($1 sub $2)"; #N mnm.xmul @swap yes --> 1; #P newobj 42 489 344 196617 mnm.xmul @swap yes; #P user ftm.mess 196 240 50 15 3 9 255 255 255 0 0 0 1 2 0 0 --> 1; #T _#line _$Qxyz; #P newex 196 267 65 196617 t l l; #P newex 196 344 65 196617 mnm.mv sub; #N mnm.meanstd --> 1; #P newobj 251 304 70 196617 mnm.meanstd; #N mnm.diag --> 1; #P newobj 286 422 51 196617 mnm.diag; #N mnm.svd 3 @mode manual --> 1; #T _#scope end; #P newobj 196 376 190 196617 mnm.svd 3 @mode manual; #P comment 200 79 59 196617 ring buffer; #P connect 12 0 16 0; #P connect 16 0 11 0; #P connect 11 0 9 0; #P connect 9 0 8 0; #P connect 8 0 7 0; #P connect 7 0 14 0; #P connect 10 0 8 1; #P connect 16 1 15 0; #P connect 11 1 6 0; #P connect 6 0 5 0; #P connect 5 0 4 0; #P connect 4 0 1 0; #P connect 5 1 3 0; #P connect 3 0 4 1; #P connect 3 0 10 0; #P connect 1 1 2 0; #P connect 2 0 13 0; #P connect 16 2 17 0; #P connect 17 0 15 3; #P connect 1 2 7 1; #P connect 20 0 21 0; #P connect 21 0 17 4; #P pop; #P newobj 41 206 89 196617 p PCA; #P hidden message 487 206 92 196617 clear \, line 0 0 0 0; #P user lcd 464 130 128 128 1 1 0 0 0; #P user ftm.vecdisplay 41 271 615 163 0. 127. 127. 190 190 190 0 5 1 -1. 1. 255 0 0 1 -1. 1. 0 255 0 1 -1. 1. 0 0 255 1 0. 1. 255 0 255 1 0. 1. 255 255 0; #P comment 334 115 110 196617 x y before projection; #P comment 286 25 169 196617 Not sure if this is really efficient...; #P window linecount 2; #P comment 593 103 73 196617 variance of the 3 components; #P window linecount 1; #P comment 170 192 94 196617 moving PCA length; #P connect 12 0 10 0; #P connect 10 0 7 0; #P connect 7 0 24 0; #P hidden connect 24 0 4 0; #P hidden connect 14 0 13 0; #P connect 13 0 10 1; #P hidden connect 11 0 10 2; #P hidden connect 31 0 7 1; #P hidden connect 10 2 11 0; #P hidden connect 32 0 31 0; #P hidden connect 24 1 4 1; #P hidden connect 6 0 20 0; #P hidden connect 10 0 25 0; #P hidden connect 25 0 20 0; #P hidden connect 24 2 4 2; #P hidden connect 6 0 5 0; #P hidden connect 7 0 26 0; #P hidden connect 26 0 5 0; #P hidden connect 22 0 21 0; #P hidden connect 21 0 6 0; #P hidden connect 24 3 4 3; #P hidden connect 7 1 27 0; #P hidden connect 27 0 23 0; #P hidden connect 24 4 4 4; #P pop;