#N canvas 574 271 717 365 10;
#N canvas 0 50 450 250 (subpatch) 0;
#X array semi_circle 512 float 0;
#X coords 0 128 511 -128 200 110 1 0 0;
#X restore 488 -72 graph;
#X obj 22 13 until;
#X obj 22 49 f 0;
#X obj 62 48 + 1;
#X obj 21 -15 t f b;
#X msg 85 14 0;
#X obj 22 79 t f f;
#X msg 21 -42 512;
#X obj 22 117 - 128;
#X obj 23 160 expr if($f1 < 128 \, sqrt(16384 - (pow($f1 \, 2))) \,
-1 * sqrt(16384 - (pow($f1-256 \, 2))) );
#X text 127 79 this is actually only the firts semi-circle \; negative
semicircle is just * -1 (x shifted of -256 to do it all in one go..
;
#X text 165 -73 In this example the array is 512 points \; diameter
= 256 \; r = 128 \; r^2 = 16384 \; \; y = sqrt ( r^2 - x^2);
#X obj 23 204 tabwrite semi_circle;
#X text 56 -43 <- click;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 0 6 0;
#X connect 3 0 2 1;
#X connect 4 0 1 0;
#X connect 4 1 5 0;
#X connect 5 0 2 1;
#X connect 6 0 8 0;
#X connect 6 1 12 1;
#X connect 7 0 4 0;
#X connect 8 0 9 0;
#X connect 9 0 12 0;
