Update of /cvsroot/pure-data/externals/hcs/hid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22498
Modified Files: TODO notescale-help.pd Added Files: deg2hid-help.pd deg2hid.pd hid2deg-help.pd hid2deg.pd hid2rad-help.pd hid2rad.pd hid_polar-help.pd hid_polar.pd hid_spiral-help.pd hid_spiral.pd rad2hid-help.pd rad2hid.pd Log Message:
- created a suite of hid objects for using polar coordinates and converting between the range of 0-1 and degrees/radians.
- made two joystick/polar examples
- added some pretty colors to help patches
--- NEW FILE: hid_spiral.pd --- #N canvas 492 167 669 441 10; #X obj 30 58 inlet; #X obj 25 363 outlet; #X text 73 363 output range: 0 to 1; #X text 72 57 input range: 0 to 1; #X obj 232 362 outlet; #X obj 222 58 inlet; #X text 264 57 input range: 0 to 1; #X text 29 29 x-axis value; #X text 221 26 y-axis value; #X text 11 5 [hid_spiral]; #X text 254 411 released under the GNU GPL; #X text 40 396 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X obj 268 258 +; #X obj 299 258 f; #X msg 219 227 1; #X msg 315 227 -1; #X obj 232 327 +; #X obj 164 140 t f f; #X obj 194 161 delta; #X obj 105 109 hid_polar; #X obj 269 291 * 1; #X obj 221 185 moses -0.4; #X obj 271 205 moses 0.4; #X text 260 110 changes over 0.4 mean one rotation. I can't move fast enough on my joystick to get near a change of 0.4 This might not work on other devices , like tablets , but we'll cross that bridge when we get to it (i.e. when I get a tablet); #X text 280 362 output range: infinite , one rotation = 1; #X connect 0 0 19 0; #X connect 5 0 19 1; #X connect 12 0 13 0; #X connect 12 0 20 0; #X connect 13 0 12 1; #X connect 14 0 12 0; #X connect 15 0 12 0; #X connect 16 0 4 0; #X connect 17 0 16 0; #X connect 17 1 18 0; #X connect 18 0 21 0; #X connect 19 0 1 0; #X connect 19 1 17 0; #X connect 20 0 16 1; #X connect 21 0 14 0; #X connect 21 1 22 0; #X connect 22 1 15 0;
--- NEW FILE: deg2hid-help.pd --- #N canvas 82 386 483 323 10; #X obj 5 2 cnv 15 450 20 empty empty [deg2hid] 2 11 1 18 -233017 -66577 0; #X obj 422 3 pddp; #X text 254 269 released under the GNU GPL; #X text 185 228 For more info:; #X obj 289 226 all_about_hid_mapping; #X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X text 300 168 related objects:; #X obj 333 184 rad2hid; #X floatatom 56 203 7 0 0 1 - - -; #X obj 59 103 hsl 300 15 -720 720 0 0 empty empty degrees 6 7 1 10 -262131 -1 -1 3100 0; #X floatatom 82 133 5 0 0 0 - - -; #X text 26 34 This object converts numbers from the [hid] range (0 to 1) to radians (-pi to pi) with the 0's lining up in the same place. ; #X obj 274 184 hid2rad; #X obj 392 184 hid2deg; #X obj 56 168 deg2hid; #X connect 9 0 10 0; #X connect 9 0 14 0; #X connect 14 0 8 0;
--- NEW FILE: rad2hid.pd --- #N canvas 258 110 429 400 10; #X obj 42 36 inlet; #X obj 140 297 outlet; #X text 19 9 [rad2hid]; #X obj 141 234 % 628318; #X obj 127 167 moses 0; #X obj 141 255 / 628318; #X obj 42 96 * 100000; #X obj 41 167 % 628318; #X obj 42 136 moses -314159; #X obj 85 200 + 628318; #X text 10 66 % is an int operation , we want floats , so convert to large integers; #X text 225 351 released under the GNU GPL; #X text 8 337 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X connect 0 0 6 0; #X connect 3 0 5 0; #X connect 4 0 9 0; #X connect 4 1 3 0; #X connect 5 0 1 0; #X connect 6 0 8 0; #X connect 7 0 9 0; #X connect 8 0 7 0; #X connect 8 1 4 0; #X connect 9 0 3 0;
--- NEW FILE: hid2deg.pd --- #N canvas 163 40 444 356 10; #X obj 88 30 inlet; #X obj 89 264 outlet; #X obj 88 56 min 1; #X obj 88 74 max 0; #X text 133 63 its a [hid] object , so limit input range; #X text 232 311 released under the GNU GPL; #X text 15 297 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X text 19 9 [hid2deg]; #X text 129 28 input range: 0 to 1 , 0 = east/right; #X text 143 264 output range: 0 to 360 , 0 = north/top; #X obj 88 100 * 360; #X text 162 189 % is an int operation; #X text 169 207 this saves accuracy; #X obj 88 148 abs; #X obj 88 123 - 450; #X text 131 122 <- rotate zero to north; #X text 130 148 <- change direction of rotation; #X obj 89 202 % 3.6e+07; #X obj 89 223 / 100000; #X obj 89 181 * 100000; #X connect 0 0 2 0; #X connect 2 0 3 0; #X connect 3 0 10 0; #X connect 10 0 14 0; #X connect 13 0 19 0; #X connect 14 0 13 0; #X connect 17 0 18 0; #X connect 18 0 1 0; #X connect 19 0 17 0;
--- NEW FILE: rad2hid-help.pd --- #N canvas 147 313 467 307 10; #X obj 5 2 cnv 15 450 20 empty empty [rad2hid] 2 11 1 18 -233017 -66577 0; #X obj 422 3 pddp; #X text 254 269 released under the GNU GPL; #X text 185 228 For more info:; #X obj 289 226 all_about_hid_mapping; #X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X text 300 168 related objects:; #X obj 273 184 rad2hid; #X obj 332 184 deg2hid; #X obj 391 184 hid2deg; #X floatatom 69 195 5 0 0 1 hid - -; #X obj 72 95 hsl 128 15 -3.14159 3.14159 0 0 empty empty radians 6 7 1 10 -262131 -1 -1 0 0; #X floatatom 95 125 9 0 0 0 - - -; #X obj 69 160 rad2hid; #X text 21 35 This object converts numbers from radians (-pi to pi) to the [hid] range (0 to 1) with the 0's lining up in the same place. ; #X connect 11 0 12 0; #X connect 11 0 13 0; #X connect 13 0 10 0;
Index: notescale-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/notescale-help.pd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** notescale-help.pd 28 Nov 2004 20:57:26 -0000 1.1 --- notescale-help.pd 13 Apr 2005 03:47:19 -0000 1.2 *************** *** 1,3 **** ! #N canvas 577 303 460 463 10; #X floatatom 26 85 5 0 0 0 - - -; #X floatatom 26 160 0 0 0 0 - - -; --- 1,3 ---- ! #N canvas 577 303 464 467 10; #X floatatom 26 85 5 0 0 0 - - -; #X floatatom 26 160 0 0 0 0 - - -; *************** *** 13,21 **** #X floatatom 150 160 0 0 0 0 - - -; #X floatatom 297 160 0 0 0 0 - - -; ! #X obj 213 83 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 0; #X text 17 426 $Revision$$Date$; #X text 18 439 $Author$; ! #X obj 140 244 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 0; #X obj 26 130 notescale 30 60; --- 13,21 ---- #X floatatom 150 160 0 0 0 0 - - -; #X floatatom 297 160 0 0 0 0 - - -; ! #X obj 213 83 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271 -1 -1 0 0; #X text 17 426 $Revision$$Date$; #X text 18 439 $Author$; ! #X obj 140 244 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262131 -1 -1 0 0; #X obj 26 130 notescale 30 60;
--- NEW FILE: hid_polar.pd --- #N canvas 328 234 464 407 10; #X obj 30 58 inlet; #X obj 25 323 outlet; #X text 73 323 output range: 0 to 1; #X text 72 57 input range: 0 to 1; #X text 11 5 [hid_polar]; #X obj 232 322 outlet; #X obj 224 56 inlet; #X text 264 57 input range: 0 to 1; #X text 29 29 x-axis value; #X text 221 26 y-axis value; #X obj 25 292 / 1.41421; #X text 92 292 (sqrt 2); #X obj 104 220 cart2pol; #X obj 223 85 t b f; #X obj 29 180 f; #X obj 252 140 - 1; #X obj 252 120 * 2; #X obj 29 140 - 1; #X obj 29 120 * 2; #X text 61 125 convert range to -1 to 1; #X text 280 322 output range: 0 to 1; #X text 245 371 released under the GNU GPL; #X text 28 357 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X obj 231 290 rad2hid; #X connect 0 0 18 0; #X connect 6 0 13 0; #X connect 10 0 1 0; #X connect 12 0 10 0; #X connect 12 1 23 0; #X connect 13 0 14 0; #X connect 13 1 16 0; #X connect 14 0 12 0; #X connect 15 0 12 1; #X connect 16 0 15 0; #X connect 17 0 14 0; #X connect 18 0 17 0; #X connect 23 0 5 0;
--- NEW FILE: hid_polar-help.pd --- #N canvas 601 232 478 451 10; #X obj 5 2 cnv 15 450 20 empty empty [hid_polar] 2 11 1 18 -233017 -66577 0; #X obj 422 3 pddp; #X text 244 411 released under the GNU GPL; #X floatatom 100 248 5 0 0 0 - - -; #X floatatom 100 335 7 0 0 0 radius-> - -; #X text 175 375 For more info:; #X obj 279 373 all_about_hid_mapping; #X obj 100 295 hid_polar; #X text 27 397 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X obj 101 161 hsl 128 15 0 1 0 0 empty empty x-axis 133 7 1 10 -225280 -1 -1 6350 0; #X obj 157 103 vsl 15 128 0 1 0 0 empty empty y-axis -6 -9 1 10 -261681 -1 -1 6350 0; #X floatatom 159 335 7 0 0 1 <-angle - -; #X floatatom 158 248 5 0 0 0 - - -; #X obj 157 265 t b f; #X obj 334 335 polar-joystick; #X text 275 273 related objects:; #X text 273 334 example:; #X msg 97 86 0.5; #X text 43 86 center:; #X text 17 29 Converts cartesian coordinates(x , y) to polar coordinates (radius , angle). The angle is in radians (-pi to pi). The angle 0 is at cartesian (1 , 0.5) or to the right.; #X obj 361 293 hid_spiral; #X obj 245 293 hid2rad; #X obj 303 293 hid2deg; #X connect 3 0 7 0; #X connect 7 0 4 0; #X connect 7 1 11 0; #X connect 9 0 3 0; #X connect 10 0 12 0; #X connect 12 0 13 0; #X connect 13 0 3 0; #X connect 13 1 7 1; #X connect 17 0 9 0; #X connect 17 0 10 0;
--- NEW FILE: hid_spiral-help.pd --- #N canvas 56 302 475 480 10; #X obj 5 2 cnv 15 450 20 empty empty [hid_spiral] 2 11 1 18 -233017 -66577 0; #X obj 422 3 pddp; #X text 245 451 released under the GNU GPL; #X floatatom 70 288 5 0 0 0 - - -; #X floatatom 70 375 5 0 0 0 radius-> - -; #X text 175 408 For more info:; #X text 28 437 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X obj 71 201 hsl 128 15 0 1 0 0 empty empty x-axis 133 7 1 10 -225280 -1 -1 0 0; #X obj 127 143 vsl 15 128 0 1 0 0 empty empty y-axis -6 -9 1 10 -261681 -1 -1 0 0; #X floatatom 136 376 8 0 0 1 <-angle - -; #X floatatom 128 288 5 0 0 0 - - -; #X obj 127 305 t b f; #X text 246 271 related objects:; #X text 264 324 example:; #X msg 69 126 0.5; #X text 15 126 center:; #X obj 323 324 spiral-joystick; #X obj 70 335 hid_spiral; #X obj 279 406 all_about_hid_mapping; #X obj 362 271 hid_polar; #X text 24 32 Converts cartesian coordinates(x , y) to spiral in polar coordinates (radius , angle). The angle is from 0 to 1 The angle 0 is at cartesian (1 , 0) or far right center.; #X text 24 81 The angle will just keep going up/down as long as there is rotation rather than reset like [hid_polar].; #X connect 3 0 17 0; #X connect 7 0 3 0; #X connect 8 0 10 0; #X connect 10 0 11 0; #X connect 11 0 3 0; #X connect 11 1 17 1; #X connect 14 0 8 0; #X connect 14 0 7 0; #X connect 17 0 4 0; #X connect 17 1 9 0;
--- NEW FILE: hid2rad.pd --- #N canvas 287 246 432 344 10; #X obj 88 30 inlet; #X obj 89 264 outlet; #X text 19 9 [hid2rad]; #X obj 89 198 * 6.28318; #X obj 88 101 moses 0.5; #X obj 88 56 min 1; #X obj 88 74 max 0; #X obj 147 133 - 1; #X text 133 63 its a [hid] object , so limit input range; #X text 129 28 input range: 0 to 1; #X text 143 264 output range: -pi to pi; #X text 232 311 released under the GNU GPL; #X text 15 297 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X connect 0 0 5 0; #X connect 3 0 1 0; #X connect 4 0 3 0; #X connect 4 1 7 0; #X connect 5 0 6 0; #X connect 6 0 4 0; #X connect 7 0 3 0;
--- NEW FILE: hid2rad-help.pd --- #N canvas 633 307 471 311 10; #X obj 5 2 cnv 15 450 20 empty empty [hid2rad] 2 11 1 18 -233017 -66577 0; #X obj 422 3 pddp; #X text 254 269 released under the GNU GPL; #X text 185 228 For more info:; #X obj 289 226 all_about_hid_mapping; #X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X text 300 168 related objects:; #X obj 273 184 rad2hid; #X obj 332 184 deg2hid; #X obj 391 184 hid2deg; #X obj 69 150 hid2rad; #X floatatom 69 185 9 0 0 1 radians - -; #X obj 72 85 hsl 128 15 0 1 0 0 empty empty hid 6 7 1 10 -262131 -1 -1 0 0; #X floatatom 95 115 5 0 0 0 - - -; #X text 26 34 This object converts numbers from the [hid] range (0 to 1) to radians (-pi to pi) with the 0's lining up in the same place. ; #X connect 10 0 11 0; #X connect 12 0 13 0; #X connect 12 0 10 0;
--- NEW FILE: deg2hid.pd --- #N canvas 380 212 444 356 10; #X obj 88 30 inlet; #X obj 89 264 outlet; #X text 232 311 released under the GNU GPL; #X text 15 297 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X text 143 264 output range: 0 to 360 , 0 = north/top; #X text 19 9 [deg2hid]; #X text 129 28 input range: 0 to 360 , 0 = east/right; #X obj 88 170 / 360; #X text 162 108 % is an int operation; #X text 169 126 this saves accuracy; #X obj 89 121 % 3.6e+07; #X obj 89 142 / 100000; #X obj 89 100 * 100000; #X obj 45 210 moses 0; #X obj 45 230 + 1; #X connect 0 0 12 0; #X connect 7 0 13 0; #X connect 10 0 11 0; #X connect 11 0 7 0; #X connect 12 0 10 0; #X connect 13 0 14 0; #X connect 13 1 1 0; #X connect 14 0 1 0;
Index: TODO =================================================================== RCS file: /cvsroot/pure-data/externals/hcs/hid/TODO,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TODO 3 Mar 2005 20:03:34 -0000 1.13 --- TODO 13 Apr 2005 03:47:19 -0000 1.14 *************** *** 100,103 **** --- 100,121 ----
============================================================================== + = figure out whole degree issue + + - BUG: zexy's 3D conversion objects just pass through Z rather than converting + it to elevation in rad/deg. + + - make [hid_polar] output 0 to 1 for angle rather than -pi to pi + + - [hid2rad], [hid2deg], [rad2hid], [deg2hid] + + - should degree conversion also change rotation direction and 0 point? The + degrees on a compass rotate the opposite direction of radians. The 0 point + of a compass is due north, with radians, its right/due east. + + - [hid_polar] should take an argument (in degrees?) which specifies where the + 0 is on the circle + + + ============================================================================== = mapping object ideas
*************** *** 115,118 **** --- 133,138 ---- start-point and start-value.
+ [infinitepot] for use with a [knob] or any single axis that could be infinite. +
/++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\
--- NEW FILE: hid2deg-help.pd --- #N canvas 589 387 483 323 10; #X obj 5 2 cnv 15 450 20 empty empty [hid2deg] 2 11 1 18 -233017 -66577 0; #X obj 422 3 pddp; #X text 254 269 released under the GNU GPL; #X text 185 228 For more info:; #X obj 289 226 all_about_hid_mapping; #X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner hans@at.or.at ; #X text 300 168 related objects:; #X obj 333 184 rad2hid; #X obj 392 184 deg2hid; #X floatatom 69 185 7 0 0 1 degrees - -; #X obj 72 85 hsl 128 15 0 1 0 0 empty empty hid 6 7 1 10 -262131 -1 -1 500 0; #X floatatom 95 115 5 0 0 0 - - -; #X obj 274 184 hid2rad; #X obj 69 150 hid2deg; #X text 26 34 This object converts numbers from the [hid] range (0 to 1) to degrees (0 to 360) with the 0 being north.; #X connect 10 0 11 0; #X connect 10 0 13 0; #X connect 13 0 9 0;