Commit 8582e3fd authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

flesh out the [draw array] example

parent 994a8f73
Pipeline #1053 passed with stage
in 319 minutes and 53 seconds
#N struct drawtut-svg float x float y;
#N canvas 1 53 537 571 10;
#N canvas 1 53 537 618 10;
#N canvas 290 275 450 300 META 0;
#X text 16 6 KEYWORDS tutorial data_structure draw;
#X text 16 26 LICENSE SIBSD;
......@@ -7,57 +7,60 @@
#X text 16 86 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X text 16 46 DESCRIPTION getting a viewBox with the [draw] command
;
#X restore 400 538 pd META;
#X restore 470 584 pd META;
#X text 0 1 New Drawing Commands: nested svg;
#X text 1 1 ________________________________;
#X obj 51 30 struct drawtut-svg float x float y;
#X text 49 64 You can specify a container with a viewport using [draw
#X text 49 59 You can specify a container with a viewport using [draw
svg]. Like [draw g] \, it is a container for other shapes \, but it
also has a viewport outside which the graphics are clipped.;
#N canvas 0 0 450 300 (subpatch) 0;
#X obj 107 66 draw circle 30 45 45;
#X text 46 113 Draw a little dotted rect to show the boundaries of
the clipping rectangle. By default \, there is no border at all.;
#X obj 61 176 loadbang;
#X msg 61 198 stroke-width 2 \, stroke-dasharray 2 3 \, stroke black
\, fill none;
#X obj 107 22 inlet;
#X msg 107 44 cx \$1;
#X obj 61 240 draw rect 350 100;
#X connect 2 0 3 0;
#X connect 3 0 6 0;
#X connect 4 0 5 0;
#X connect 5 0 0 0;
#X restore 49 304 draw svg;
#X obj 134 215 loadbang;
#X msg 134 237 width 350 \, height 100;
#X scalar drawtut-svg 50 341 \;;
#X obj 49 129 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 49 171 f;
#X obj 49 193 / 360;
#X obj 49 215 * 6.28319;
#X obj 49 237 sin;
#X obj 49 259 * 200;
#X floatatom 100 128 5 0 0 0 - - -, f 5;
#X obj 49 281 + 200;
#X obj 85 171 + 3;
#X text 49 459 Unfortunately the clipped drawing is still used to calculate
the scrollbars \, which isn't a great user-experience.;
#X text 132 274 You can also change the origin and scaling factors
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X restore 49 344 draw svg;
#X obj 124 223 loadbang;
#X msg 124 245 width 350 \, height 100;
#X scalar drawtut-svg 50 381 \;;
#X obj 49 124 tgl 26 0 empty empty click\ to\ animate 31 5 0 10 -73190
-1 -1 0 1;
#X obj 49 201 f;
#X obj 49 223 / 360;
#X obj 49 245 * 6.28319;
#X obj 49 267 sin;
#X obj 49 289 * 200;
#X floatatom 94 153 5 0 0 0 - - -, f 5;
#X obj 49 311 + 200;
#X obj 85 201 + 3;
#X text 142 304 You can also change the origin and scaling factors
using the "viewBox" message \, which can be used for panning. See the
help file for [draw svg] for more details about that.;
#X obj 49 149 metro 75;
#X obj 49 179 metro 75;
#X msg 141 275 viewBox 0 0 175 50;
#X text 267 244 width and height of the viewport;
#X obj 49 542 loadbang;
#X obj 49 586 draw rect 350 100;
#X msg 49 564 stroke-width 2 \, stroke-dasharray 4 6 \, stroke black
\, fill none, f 61;
#X text 106 541 dotted border to elucidate the size of the viewport
;
#X text 49 489 Unfortunately \, the clipped drawing is still used to
calculate the size of the canvas for displaying the scrollbars.;
#X connect 6 0 7 0;
#X connect 7 0 5 1;
#X connect 9 0 20 0;
#X connect 9 0 19 0;
#X connect 10 0 11 0;
#X connect 10 0 17 0;
#X connect 11 0 12 0;
#X connect 12 0 13 0;
#X connect 13 0 14 0;
#X connect 14 0 16 0;
#X connect 15 0 20 1;
#X connect 15 0 19 1;
#X connect 16 0 5 0;
#X connect 17 0 10 1;
#X connect 20 0 10 0;
#X connect 19 0 10 0;
#X connect 20 0 5 1;
#X connect 22 0 24 0;
#X connect 24 0 23 0;
#N struct drawtut-array float x float y;
#N canvas 2 75 537 571 10;
#N struct drawtut-array-element float x;
#N struct drawtut-array float x float y array a drawtut-array-element
;
#N canvas 1 53 537 571 10;
#N canvas 290 275 450 300 META 0;
#X text 16 6 KEYWORDS tutorial data_structure draw;
#X text 16 26 LICENSE SIBSD;
......@@ -10,5 +12,147 @@ array] command;
#X restore 400 538 pd META;
#X text 0 1 New Drawing Commands: arrays;
#X text 1 1 ____________________________;
#X obj 51 30 struct drawtut-array float x float y;
#X text 144 202 Under construction;
#N canvas 459 235 450 300 drawtut-array-element 0;
#X obj 68 26 struct drawtut-array-element float x;
#N canvas 585 156 450 323 bruno 0;
#X obj 48 54 draw path m 92.2864 284.149 c -4.36335 -1.12694 6.37031
-4.28678 1.6499 -3.52069 c -1.73343 -1.27818 -4.72276 0.98165 -4.09474
0.29 c 0.01025 -1.85619 -2.95458 -4.33117 -0.256845 -4.02948 c 1.56343
-3.52432 4.14994 -7.08918 5.31155 -9.54871 c 2.38599 -1.87163 -3.62313
-4.83057 -5.82561 -2.75664 c 7.06907 0.65728 -0.28958 11.4675 -4.53676
8.28059 c 0.276062 0.11726 -4.41255 -1.37322 -7.65153 -1.03429 c -1.99258
0.0591 -18.5303 -1.87374 -12.6691 -1.63443 c -2.02994 -1.7385 1.27311
-4.73681 -1.38125 -5.44311 c 3.74863 -5.52849 11.7829 -5.33489 16.0321
-12.2554 c 5.12587 -6.52694 -3.04617 -12.0737 -0.09498 -18.4964 c -6.82267
-7.28509 -8.2417 -18.1498 -11.4637 -27.5206 c -4.71899 -14.2297 -6.12285
-29.1834 -9.3834 -43.7515 c -0.788717 -10.1157 -1.40952 -20.4793 1.34298
-30.3725 c -4.23303 -4.04276 -5.86171 -8.58135 -0.347852 -1.61655 c
5.30633 -10.271 7.37274 -22.2306 11.473 -33.4754 c 1.94448 -6.44163
6.73034 -14.016 4.85512 -16.5693 c 3.24891 0.401866 -3.01016 -3.5759
1.17252 -2.2643 c 0.546761 -7.54397 -1.88763 1.24493 -0.857551 -5.22112
c -1.41534 -8.08102 7.28129 0.01834 3.33059 -7.94846 c -4.02777 -13.5753
-5.38085 1.19028 -6.93864 7.1028 C 72.2527 69.4791 66.6823 62.5901
59.9893 62.6685 C 54.182 58.7093 53.56 57.6073 47.8332 52.3607 C 40.7426
48.6565 38.7605 39.9986 32.6768 35.4332 C 30.1953 32.8371 22.7161 21.9629
23.2488 31.0931 C 22.0208 26.0945 14.2847 21.3419 17.4008 15.4822 C
12.2259 11.4233 3.76829 14.0448 3.73363 9.16197 C 3.5467 9.7331 2.11641
-4.3927 10.3541 0.112038 C 18.7536 4.89249 27.3623 14.9189 33.9179
20.1159 c 3.38145 4.4639 12.3805 7.7 15.323 12.0572 c 4.43357 1.99409
11.8512 6.22171 18.5684 5.63237 c 8.05286 0.765378 17.441 -2.93434
19.2284 0.730509 c -2.99575 -7.74083 3.66394 6.72701 5.29626 1.74613
c 15.1455 3.89716 1.77207 -14.4 8.70942 -21.5336 c 0.49178 -6.5104
-4.15894 4.06382 -3.00347 -5.28577 c -3.26982 -7.84216 8.56082 -13.6307
12.291 -11.8818 c 5.99 -1.29364 10.7015 0.198124 15.3204 4.65091 c
3.42766 2.68349 3.19075 13.2966 0.63087 19.2613 c -0.21272 9.53045
-8.72596 14.4887 -0.88048 22.9894 c 8.36649 0.530298 -0.22246 7.98615
9.2469 5.157 c 11.3759 -1.1811 12.1271 13.117 20.4247 17.9868 c 4.02028
4.18092 0.92386 5.65861 9.73054 8.17479 c 10.3145 6.30599 22.9678 6.27662
34.1149 10.3812 c 11.4033 0.06937 5.35577 22.476 1.11852 16.1922 c
1.24363 -9.03156 -13.7311 0.85666 -18.8798 -4.83261 c -5.16782 -0.57199
-23.5989 -0.98095 -21.7053 -3.60992 c 9.0044 -4.8229 -13.3194 -7.13789
-17.7131 -5.52061 c -4.54269 3.18155 -9.14919 -11.03 -13.7609 -1.35163
c -2.42955 3.93246 -2.47079 8.68619 3.40152 6.31047 c -5.15861 8.58339
-11.5805 17.9917 -18.1436 24.6337 c -4.96614 7.48154 -2.18779 18.5786
-7.81432 25.5924 c -1.11494 7.61908 -6.89397 13.9803 -6.12003 21.658
c -2.78174 9.62164 -7.82927 19.3545 -0.900831 27.4369 c 5.84826 9.08216
6.05513 21.7227 8.60067 32.3425 c 4.45521 5.42701 -1.15708 10.9185
5.09772 17.0569 c 1.95028 5.06139 -6.64382 1.64969 -0.0902 7.06867
c -0.79286 6.78024 -3.25335 16.3962 -5.29487 22.1368 c -0.71119 2.9061
-5.07618 3.44134 -5.39668 3.70689 c -4.03637 0.64765 -1.15428 3.07721
-4.89479 1.57928 c 1.84876 2.54299 -3.92834 0.55633 -2.83132 2.33281
c -1.16513 -0.67758 -0.358909 2.6097 -1.30494 1.2335 z m 7.99133 -5.36728
c -2.00985 -1.78091 0.0642 2.82544 0 0 z m -6.97378 0.26403 c -1.37263
-0.42285 -0.684918 0.64933 0 0 z m -2.32248 -1.2661 c -0.450903 -1.36317
-0.919536 1.32816 0 0 z m 15.4009 -3.55186 c -1.05517 0.72075 -0.44286
1.62174 0 0 z m -18.4596 -2.45229 c -2.40191 -0.76695 1.1373 1.70944
0 0 z m 1.75376 0.41154 c -0.91953 -1.32816 -0.450896 1.36316 0 0 z
m 9.32101 -8.97017 c -1.12003 -2.47476 -0.996658 3.1856 0 0 z m -3.68
-0.87023 c 3.07011 -2.90184 -0.17539 -14.8517 -2.51728 -9.36088 c -1.22198
4.58336 3.33049 0.48018 0.774217 9.35439 c -0.957559 1.73096 1.91221
1.17445 1.74306 0.006 z m -2.84471 -8.80162 c -1.97467 -1.36214 0.417977
1.28496 0 0 z m 3.6818 -1.78879 c 0.244061 -3.05658 -1.73028 1.1895
0 0 z m 1.58612 -3.45125 c -2.366 -6.8929 -1.00319 4.50374 0 0 z m
9.05822 -14.7423 c -6.78951 -5.33808 2.39293 3.42152 0 0 z m 0.40106
-88.5361 c -1.15809 -1.35214 -0.7075 1.8774 0 0 z M 67.8895 133.529
c 2.87876 -5.66737 -2.99106 -0.44399 0 0 z m 51.3431 -25.741 c -1.00308
-3.60996 -1.62583 2.82009 0 0 z m 1.01679 -1.47555 c -1.29405 -1.88885
-1.17659 1.19527 0 0 z m 1.11852 -0.2043 c -0.0541 -4.61824 -1.90383
2.94425 0 0 z m 1.75276 -2.35226 c 4.36102 -8.14461 -5.52962 5.0097
0 0 z m 2.72132 -5.1887 c -0.73103 -1.72581 -1.28615 1.84418 0 0 z
m 69.2987 -1.61564 c -1.26892 -11.1358 -1.71495 4.98411 0 0 l 0 0 z
m -27.8257 0.823399 c -3.2209 -1.52657 0.89146 1.46766 0 0 z m -1.95189
-0.07772 c -1.54225 -2.79316 -1.57905 0.709716 0 0 z m -1.79586 -0.826467
c -1.62903 -0.330165 1.15464 1.68525 0 0 z M 76.6271 71.3902 c -0.514823
-2.27807 -0.902172 3.02466 0 0 z m -5.5926 -8.06602 c 0.894859 -4.12435
5.80084 -2.79925 0.424822 -8.60281 c -2.38795 -5.4944 -3.39073 1.42952
-7.22916 0.245612 c -1.82083 0.29192 3.64897 8.20515 1.53638 4.11171
c -2.52518 1.04066 5.65572 8.05156 5.26796 4.24549 z m -1.69311 -8.52817
c -0.45547 -1.86997 1.21351 1.41996 0 0 z m -14.1373 3.40517 c -3.20176
-1.77089 0.274689 1.90142 0 0 z m -0.574592 -2.83962 c -2.36216 -5.82509
-7.911 -1.9055 0 0 z M 65.0691 53.9108 c -0.870095 -1.28063 -1.07386
0.710477 0 0 z m 0.372845 -0.954106 c -0.919535 -1.32816 -0.450903
1.36316 0 0 z m 37.9541 -5.64081 c -2.16256 -7.69792 -1.71444 4.34983
0 0 z m 17.8367 -11.1134 c -0.76416 -3.18357 -2.12569 6.79931 0 0 z
M 27.168 28.1467 c -1.19459 -1.46821 0.407884 1.84858 0 0 z m 95.3185
-2.03454 c 1.37807 -1.40146 -2.96724 1.30994 0 0 z M 14.1763 12.0988
c -6.00378 -4.60256 2.42612 3.50648 0 0 z M 90.5007 282.105 c 1.70797
-1.5898 -0.552378 1.88089 0 0 z m 8.63757 0.0749 c 0.343019 -1.22494
2.16621 0.4298 0 0 z m 1.72345 -0.29895 c 0.91954 -1.32816 0.4509 1.36316
0 0 z m -0.53864 -1.08516 c 1.03585 -1.15842 3.23478 0.45244 0 0 z
m -13.3702 -1.65615 c 0.344601 -3.45314 2.62159 0.11235 0 0 z m 0.300144
-2.47845 c 0.450903 -1.36317 0.919536 1.32815 0 0 z M 59.1036 118.149
c 0.877805 -7.43184 7.33372 -17.597 9.27976 -26.3933 c 5.29001 -10.5134
-1.1689 9.9751 -2.63855 12.724 c -2.18769 3.57852 0.302478 15.7064
-6.64121 13.6693 z M 132.18 93.1302 c 1.58556 -0.880772 7.73664 -1.90987
0 0 z M 74.8218 83.9024 c 0.326276 -1.68054 0.326276 1.68054 0 0 z
m 3.11027 -16.405 c 0.463016 -1.46987 1.33785 1.41947 0 0 z M 26.158
30.0248 c 0.163867 -1.88574 1.48969 1.35515 0 0 z m 71.3776 -2.63881
c 0.239836 -1.43691 0.378215 1.69701 0 0 z m -0.372844 -2.23704 c 0.239842
-1.43691 0.378221 1.69701 0 0 z;
#X restore 68 134 draw g bruno;
#X obj 68 81 loadbang;
#X msg 68 108 transform scale 0.4 translate x;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X restore 286 35 pd drawtut-array-element;
#X obj 8 35 struct drawtut-array float x float y array a drawtut-array-element
;
#X obj 8 83 draw array a;
#X scalar drawtut-array 145 117 \; 0 \; 150 \; 300 \; 450 \; 600 \;
750 \; \;;
#X obj 177 283 pointer;
#X floatatom 23 154 5 0 0 0 - - -, f 5;
#X obj 42 305 setsize drawtut-array a;
#X obj 183 448 element drawtut-array a;
#X obj 24 473 set drawtut-array-element x;
#X obj 24 355 until;
#X obj 24 377 f;
#X obj 54 377 + 1;
#X obj 24 333 t a 0;
#X obj 24 399 t a a;
#X obj 23 175 t a a b;
#X obj 177 239 canvasinfo;
#X msg 62 201 pointer;
#X msg 177 261 list \$1 \, next;
#X obj 24 429 * 150;
#X text 91 82 draw an array;
#X text 15 130 setting size is slow;
#X connect 7 0 9 1;
#X connect 7 0 10 1;
#X connect 8 0 17 0;
#X connect 10 0 11 1;
#X connect 12 0 13 0;
#X connect 13 0 14 0;
#X connect 13 0 16 0;
#X connect 14 0 13 1;
#X connect 15 0 12 0;
#X connect 15 1 13 1;
#X connect 16 0 21 0;
#X connect 16 1 10 0;
#X connect 17 0 15 0;
#X connect 17 1 9 0;
#X connect 17 2 19 0;
#X connect 18 0 20 0;
#X connect 19 0 18 0;
#X connect 20 0 7 0;
#X connect 21 0 11 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment