{"id":2950,"date":"2016-09-10T12:55:21","date_gmt":"2016-09-10T11:55:21","guid":{"rendered":"http:\/\/www.lyceelecorbusier.eu\/p5js\/?p=2950"},"modified":"2016-09-10T12:57:56","modified_gmt":"2016-09-10T11:57:56","slug":"p5-re-code-11","status":"publish","type":"post","link":"https:\/\/www.lyceelecorbusier.eu\/p5js\/?p=2950","title":{"rendered":"\/ p5 \/ re-code 11"},"content":{"rendered":"<p>Inspir\u00e9 par &#8220;Research and Teaching in Art and Science&#8221; by <a href=\"http:\/\/darkofritz.net\/text\/bonacic.html\" target=\"_blank\">Vladimir Bona\u010di\u0107<\/a>\u00a0\/\/ Computer Graphics and Art Vol. 2, No. 3 pp. 4-8<\/p>\n\n<!-- iframe plugin v.5.1 wordpress.org\/plugins\/iframe\/ -->\n<iframe src=\"http:\/\/lyceelecorbusier.eu\/p5\/recode\/011-recode\" width=\"780\" height=\"780\" style=\"border: 1px solid #ddd;\" scrolling=\"yes\" class=\"iframe-class\" frameborder=\"0\"><\/iframe>\n\n<pre>\/\/ This sketch is part of the ReCode Project - http:\/\/recodeproject.com\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\/\/ \/\/\r\n\/\/ \"Orbits of Galois Fields\" by Vladimir Bona\u010di\u0107 \/\/\r\n\/\/ \/\/\r\n\/\/ ( vareractive version ) \/\/\r\n\/\/ \/\/\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\n\/\/ (c) Martin Schneider 2012\r\n\r\n\/\/ Creative Commons license CC BY-SA 3.0\r\n\r\n\/\/ These patterns are displayed using 32 x 32 dots.\r\n\/\/ They visualize objects from abstract algebra, \r\n\/\/ which are known as orbits of galois fields.\r\n\r\n\/\/ Source:\r\n\/\/ \"Research and Teaching in Art and Science\" by Vladimir Bona\u010di\u0107\r\n\/\/ Computer Graphics and Art Vol. 2, No. 3 pp. 4-8\r\n\r\n\/\/ See also:\r\n\/\/ \"Kinetic Art: Application of Abstract Algebra to Objects with Computer-\r\n\/\/ Controlled Flashing Lights and Sound Combinations\" by Vladimir Bona\u010di\u0107\r\n\/\/ Leonardo, Vol. 7, No. 3\r\n\/\/ Note: This paper is quite mathematical at times.\r\n\/\/ The implementation however is actually really simple.\r\n\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ varERACTIVE VERSION \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\n\/\/ - Use space to flip through the presets\r\n\/\/ - Use the mouse to explore the orbits\r\n\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\nvar n = 5; \/\/ bits per dimension\r\nvar d = 1&lt;&lt;n; \/\/ cells per dimension\r\nvar led = 20; \/\/ size of the dot\r\nvar w = led * d + 1; \/\/ screen size\r\n\r\nvar preset = [1087, 1157];\r\nvar pick = 0;\r\nvar p = preset[pick];\r\n\r\nvar debug = true;\r\nvar i0;\r\nvar bg=10;\r\n\r\n\r\nfunction setup() {\r\n createCanvas(w, w);\r\n ellipseMode(CORNER); \r\n noStroke();\r\n}\r\n\r\n\r\nfunction draw() {\r\n \r\n \/\/ adding some afterglow\r\n fill(bg, 30); \r\n rect(0, 0, w, w); \r\n fill(255 - bg);\r\n\r\n \/\/ use mouse coordinates to get initial cell\r\n var x = mouseX\/led &amp; (d-1);\r\n var y = mouseY\/led &amp; (d-1);\r\n var i = y * d + x;\r\n\r\n \/\/ create empty field\r\n \/\/boolean[] field = new boolean[d*d];\r\n \r\n var field = [d*d];\r\n\r\n \/\/ find all cells in the orbit\r\n i0 = d*d;\r\n while (!field[i]) {\r\n i0 = min(i, i0);\r\n field[i] = true;\r\n i *= 2; \r\n if (i &gt;= d*d ) i ^= p;\r\n } \r\n\r\n \/\/ draw display\r\n for (i = 0; i &lt; d*d; i++) {\r\n if (field[i]) {\r\n ellipse(led * (i % d), led * floor(i \/ d), led, led);\r\n }\r\n }\r\n}\r\n\r\n\r\nfunction keyPressed() {\r\n switch(key) {\r\n \/\/ switch between presets\r\n case ' ': pick = (pick + 1) % preset.length; p = preset[pick]; break;\r\n \/\/ next pattern\r\n case '+': p = (p + 1) | d; break; \r\n \/\/ previous pattern\r\n case '-': p = (p - 1) | d; break;\r\n \/\/ toggle debugging\r\n case 'd': debug = !debug; break;\r\n \/\/ switch background color\r\n case 'b': bg = 255 - bg; break;\r\n default: return;\r\n }\r\n}\r\n\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Inspir\u00e9 par &#8220;Research and Teaching in Art and Science&#8221; by Vladimir Bona\u010di\u0107\u00a0\/\/ Computer Graphics and Art Vol. 2, No. 3 pp. 4-8 \/\/ This sketch is part of the ReCode Project &#8211; http:\/\/recodeproject.com \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \/\/ \/\/ \/\/ &#8220;Orbits&#8230; <a class=\"read-more\" href=\"https:\/\/www.lyceelecorbusier.eu\/p5js\/?p=2950\">Lire la suite&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":2953,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9,6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts\/2950"}],"collection":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2950"}],"version-history":[{"count":2,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts\/2950\/revisions"}],"predecessor-version":[{"id":2952,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts\/2950\/revisions\/2952"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/media\/2953"}],"wp:attachment":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}