diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2008-01-03 13:07:48 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2008-01-03 13:07:48 +0000 |
commit | 0bad9be7b54fce990a34af835aa01ad6568395da (patch) | |
tree | 3933843c3bdf02c4175493cd2ba530aa67c9f19b | |
parent | c3a067dc355fc57a5759d4e9a97bcbcd878caf13 (diff) |
fixed mtx_diegg and tests (it was really inconsistent)
svn path=/trunk/externals/iem/iemmatrix/; revision=9115
-rw-r--r-- | doc/mtx_diegg-help.pd | 10 | ||||
-rw-r--r-- | src/mtx_diegg.c | 12 | ||||
-rw-r--r-- | tests/mtx_diegg/01_init.pd | 5 | ||||
-rw-r--r-- | tests/mtx_diegg/02_getdiegg.pd | 17 | ||||
-rw-r--r-- | tests/mtx_diegg/02_init.pd | 3 |
5 files changed, 32 insertions, 15 deletions
diff --git a/doc/mtx_diegg-help.pd b/doc/mtx_diegg-help.pd index bcbbebe..72c9524 100644 --- a/doc/mtx_diegg-help.pd +++ b/doc/mtx_diegg-help.pd @@ -1,4 +1,4 @@ -#N canvas 13 81 566 290 10; +#N canvas 310 132 566 428 10; #X text 295 30 updated for; #X obj 383 30 iemmatrix 0.2; #X obj 432 56 matrix; @@ -18,6 +18,14 @@ #X text 30 89 create a turned diagonal matrix; #X obj 300 197 mtx_diegg; #X obj 103 201 mtx_diegg 7 9 8; +#X text 58 299 "turned" means rotated by -90deg:; +#X text 90 339 1 0 0; +#X text 90 353 0 2 0; +#X text 90 366 0 0 3; +#X text 200 353 0 2 0; +#X text 200 339 0 0 1; +#X text 200 366 3 0 0; +#X text 148 353 ==>; #X connect 6 0 18 0; #X connect 7 0 18 0; #X connect 8 0 10 0; diff --git a/src/mtx_diegg.c b/src/mtx_diegg.c index 394a3b6..0c17294 100644 --- a/src/mtx_diegg.c +++ b/src/mtx_diegg.c @@ -21,7 +21,10 @@ static void mtx_diegg_matrix(t_matrix *x, t_symbol *s, int argc, t_atom *argv) t_atom *ap = (t_atom *)getbytes(length * sizeof(t_atom)), *dummy=ap; if(row*col>argc-2)post("mtx_diegg: sparse matrices not yet supported : use \"mtx_check\""); else { - for(n=0;n<length;n++, dummy++)SETFLOAT(dummy, atom_getfloat(argv+(n-1)*(col-1))); + for(n=0;n<length;n++, dummy++){ + int index=(n+1)*(col-1); + SETFLOAT(dummy, atom_getfloat(argv+index)); + } outlet_list(x->x_obj.ob_outlet, gensym("diegg"), length, ap); } freebytes(ap, (length * sizeof(t_atom))); @@ -34,11 +37,8 @@ static void *mtx_diegg_new(t_symbol *s, int argc, t_atom *argv) x->atombuffer = 0; if(!argc)return(x); - x->atombuffer = (t_atom *)getbytes((argc*argc+2)*sizeof(t_atom)); - setdimen(x, argc, argc); - matrix_set(x, 0); - argv+=argc-1; - while(argc--)SETFLOAT(x->atombuffer+2+argc*(1+x->col), atom_getfloat(argv--)); + + matrix_diegg(x, s, argc, argv); return (x); } diff --git a/tests/mtx_diegg/01_init.pd b/tests/mtx_diegg/01_init.pd index 72ed245..4675850 100644 --- a/tests/mtx_diegg/01_init.pd +++ b/tests/mtx_diegg/01_init.pd @@ -1,4 +1,4 @@ -#N canvas 0 0 450 432 10; +#N canvas 192 359 450 432 10; #X msg 69 90 bang; #X obj 69 187 unpack 0 0 0 0 0 0; #X obj 141 212 == 1; @@ -12,6 +12,9 @@ #X obj 69 145 mtx_diegg 1 2; #X obj 69 65 inlet bang; #X obj 117 305 outlet; +#X text 265 139 0 1; +#X text 265 154 2 0; +#X text 200 145 1 2 -->; #X connect 0 0 10 0; #X connect 1 2 3 0; #X connect 1 3 2 0; diff --git a/tests/mtx_diegg/02_getdiegg.pd b/tests/mtx_diegg/02_getdiegg.pd index a4b3944..2d19d89 100644 --- a/tests/mtx_diegg/02_getdiegg.pd +++ b/tests/mtx_diegg/02_getdiegg.pd @@ -1,17 +1,20 @@ -#N canvas 0 0 450 432 10; +#N canvas 446 389 450 432 10; #X obj 87 257 *; #X obj 69 65 inlet bang; #X obj 87 305 outlet; #X obj 69 125 mtx_diegg; #X msg 69 90 matrix 2 2 0 1 2 0; #X obj 69 187 unpack 0 0; -#X obj 87 235 == 2; -#X obj 111 212 == 1; +#X text 265 139 0 1; +#X text 265 154 2 0; +#X text 297 145 --> 1 2; +#X obj 87 235 == 1; +#X obj 111 212 == 2; #X connect 0 0 2 0; #X connect 1 0 4 0; #X connect 3 0 5 0; #X connect 4 0 3 0; -#X connect 5 0 6 0; -#X connect 5 1 7 0; -#X connect 6 0 0 0; -#X connect 7 0 0 1; +#X connect 5 0 9 0; +#X connect 5 1 10 0; +#X connect 9 0 0 0; +#X connect 10 0 0 1; diff --git a/tests/mtx_diegg/02_init.pd b/tests/mtx_diegg/02_init.pd index 307a1e5..d66366f 100644 --- a/tests/mtx_diegg/02_init.pd +++ b/tests/mtx_diegg/02_init.pd @@ -13,6 +13,9 @@ #X obj 69 145 mtx_diegg; #X msg 69 126 1 2; #X obj 69 166 route matrix; +#X text 265 139 0 1; +#X text 265 154 2 0; +#X text 200 145 1 2 -->; #X connect 0 0 12 0; #X connect 1 2 3 0; #X connect 1 3 2 0; |