{"id":12,"date":"2010-02-10T16:14:34","date_gmt":"2010-02-10T15:14:34","guid":{"rendered":"http:\/\/www.aymericlamboley.fr\/blog\/?p=12"},"modified":"2010-02-13T17:49:00","modified_gmt":"2010-02-13T16:49:00","slug":"mathematicals-and-as3-biomorphs","status":"publish","type":"post","link":"http:\/\/www.aymericlamboley.fr\/blog\/mathematicals-and-as3-biomorphs\/","title":{"rendered":"Mathematicals and AS3 = Biomorphs"},"content":{"rendered":"<p>A biomorph is a shape resembling that of a living organism (such as bacteria), though not necessarily of biotic origin. It is created with Mathematicals functions, such as fractal.<br \/>\nBased on the work of C. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Clifford_A._Pickover\" target=\"_blank\">Pickover<\/a>, I have made a computer program with AS3 that you can try below. I used the as3mathlib because of Complex Numbers.<\/p>\n<p><code><a title=\"Biomorphs\" rel=\"lightbox[flash 600 600]\" href=\"http:\/\/www.aymericlamboley.fr\/blog\/wp-content\/uploads\/2010\/02\/Biomorphes.swf\">Biomorphs<\/a><\/code> &#8211; the computing time could be long, wait a moment.<\/p>\n<p>Here is a part of the code. All comments are welcome \ud83d\ude42<\/p>\n<pre lang=\"actionscript3\" line=\"1\">private function calculate():void {\r\n\r\n  var r:Number = 0;\r\n  var n:uint;\r\n\r\n  for (var abs:Number = -3; abs < 3; abs += 0.01) {\r\n\r\n    for (var ord:Number = -2.5; ord < 2.5; ord += 0.01) {\r\n\r\n    n = 0;\r\n    r = 0;\r\n\r\n    z\u00a0 = new Complex(abs, ord);\r\n\r\n      while ((n < 11) &#038;&#038; (r < 10)) {\r\n\r\n      z = f(z, A, B, C, D, E, F, G);\r\n      r = Complex.modulo(z);\r\n\r\n      if ((n == 10) || (r > 10)) {\r\n\r\n        putPixels(Complex.abs(z), abs, ord);\r\n      }\r\n      n++;\r\n      }\r\n    }\r\n  }\r\n  showBitmap();\r\n}\r\n\r\nprivate function f(z:Complex, A:Complex, B:Complex, C:Complex, D:Complex, E:Complex, F:Complex, G:Complex):Complex {\r\n\r\n  var i:Complex = new Complex(0, 1);\r\n\r\n  var inter1:Complex = Complex.adds(Complex.power(z, A), B);\r\n  var inter2:Complex = Complex.adds(Complex.mult(C, i), Complex.mult(D, Complex.cos(z)));\r\n  var inter3:Complex = Complex.adds(Complex.mult(E, Complex.sin(z)), Complex.mult(F, Complex.exp(z)));\r\n  var inter4:Complex = Complex.mult(G, Complex.exp(z));\r\n\r\n  return Complex.adds(Complex.adds(inter1, inter2), Complex.adds(inter3, inter4));\r\n}\r\n\r\nprivate function putPixels(h:Complex, abs:Number, ord:Number):void {\r\n\r\n  abs = Math.round((abs + 3) * 100);\r\n  ord = Math.round((ord + 2.5) * 100);\r\n\r\n  var biomorphe:Number = Complex.norm(h) \/ 2;\r\n\r\n  if (biomorphe > 1500000) {\r\n    monBitmap.setPixel(abs, ord, 0xFFFFFF);\r\n  } else if (biomorphe > 15000) {\r\n  monBitmap.setPixel(abs, ord, 0x0099CC);\r\n  } else if (biomorphe > 150) {\r\n  monBitmap.setPixel(abs, ord, 0x993333);\r\n  } else {\r\n  monBitmap.setPixel(abs, ord, 0xFFFF00);\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A biomorph is a shape resembling that of a living organism (such as bacteria), though not necessarily of biotic origin. It is created with Mathematicals functions, such as fractal. Based on the work of C. Pickover, I have made a computer program with AS3 that you can try below. I used the as3mathlib because of &hellip; <a href=\"http:\/\/www.aymericlamboley.fr\/blog\/mathematicals-and-as3-biomorphs\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Mathematicals and AS3 = Biomorphs<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/posts\/12"}],"collection":[{"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":19,"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":15,"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions\/15"}],"wp:attachment":[{"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.aymericlamboley.fr\/blog\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}