<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-652678132162639880</id><updated>2011-11-27T17:05:20.831-08:00</updated><title type='text'>Not so fast</title><subtitle type='html'>A workbook of an embedded software engineer who yearn for functional programming.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://spacesheriff.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://spacesheriff.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Nameless Shura</name><uri>http://www.blogger.com/profile/16396650233099220953</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-652678132162639880.post-8866538907541500785</id><published>2011-03-02T23:23:00.000-08:00</published><updated>2011-03-02T23:23:25.000-08:00</updated><title type='text'>SVG Fractal with Scala 3 : The Koch snowflakes</title><content type='html'>&lt;span class="Apple-style-span" style="font-size: large;"&gt;Result&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-RVKMIOzljbw/TW8u8yWHukI/AAAAAAAAAH0/fk4VeW1isMA/s1600/koch.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="https://lh6.googleusercontent.com/-RVKMIOzljbw/TW8u8yWHukI/AAAAAAAAAH0/fk4VeW1isMA/s320/koch.png" width="246" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Source Code&lt;/span&gt;&lt;br /&gt;Following is a straight forward&amp;nbsp;implementation&amp;nbsp;pop up my mind. &amp;nbsp;I first, build a list of "angles" which defines direction from current point to the next point. &amp;nbsp;When it goes&amp;nbsp;horizontally&amp;nbsp;to the right, angle is 0, 90 for vertically up, 180 for horizontally left, 270 for vertically down and so on. &amp;nbsp;Start point is the peak of the triangle. &amp;nbsp;First 2 cases go like this.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Level 0 =&amp;gt; List ( 300, 180, &amp;nbsp;60)&lt;/li&gt;&lt;/ul&gt;&lt;a href="https://lh4.googleusercontent.com/-Or3_xcj_E8I/TW82_295tRI/AAAAAAAAAH4/LnAQmb6wH4c/s1600/koch0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh4.googleusercontent.com/-Or3_xcj_E8I/TW82_295tRI/AAAAAAAAAH4/LnAQmb6wH4c/s1600/koch0.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Level 1 =&amp;gt; List ( 300, 0, 240, 300, 180, 240, 120, 180, 60, 120, 0, 60)&lt;/li&gt;&lt;/ul&gt;&lt;a href="https://lh3.googleusercontent.com/-gW85pMitpOI/TW83B8b87XI/AAAAAAAAAH8/0UkTzMBZJ_I/s1600/koch1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://lh3.googleusercontent.com/-gW85pMitpOI/TW83B8b87XI/AAAAAAAAAH8/0UkTzMBZJ_I/s1600/koch1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To get the list for level n form level n-1, we can do the following.&lt;br /&gt;&lt;pre class="prettyprint lang-scala"&gt;(level n-1 list).flatMap(x =&amp;gt; List(x,x+60,x+300,x)).map(_%360)&lt;/pre&gt;Rest of the things I need to is to generate a list of (x,y) points, translate it into a string and put the string in &amp;nbsp;&amp;lt;pack&amp;gt;&amp;lt;path d="M ... z"/&amp;gt;&amp;lt;/pack&amp;gt; statements.&lt;br /&gt;&lt;path d=""&gt; &lt;br /&gt;&lt;/path&gt;&lt;br /&gt;&lt;pre class="prettyprint linenums lang-scala"&gt;class Koch (width: Double, level:Int) extends Fractal(width,(width*3*1.732/4+1).toInt) { &lt;br /&gt; &lt;br /&gt; val scale = (width-20)/(2*math.pow(3,level))&lt;br /&gt; val level_0 = List(300,180,60)&lt;br /&gt; def recursive(current:List[Int], currlevel:Int): List[Int] = {&lt;br /&gt;  if(currlevel == level)&lt;br /&gt;  {&lt;br /&gt;   current&lt;br /&gt;  } else {&lt;br /&gt;   recursive(current.flatMap(x =&amp;gt; List(x,x+60,x+300,x)).map(_%360), currlevel+1)&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; def angles2points(alist:List[Int]): List[(Double,Double)] = &lt;br /&gt;  (width/2,20.0) :: iter((width/2,20.0), alist, List())&lt;br /&gt;  &lt;br /&gt; def iter(org:(Double,Double), alist:List[Int], plist:List[(Double,Double)])&lt;br /&gt; : List[(Double,Double)] = org match {&lt;br /&gt;  case (x,y) =&amp;gt; alist match {&lt;br /&gt;   case a::as =&amp;gt; &lt;br /&gt;    val next = a match {&lt;br /&gt;     case 0 =&amp;gt; (x+2*scale, y)&lt;br /&gt;     case 60 =&amp;gt; (x+scale, y-1.732*scale)&lt;br /&gt;     case 120 =&amp;gt; (x-scale, y-1.732*scale)&lt;br /&gt;     case 180 =&amp;gt; (x-2*scale, y)&lt;br /&gt;     case 240 =&amp;gt; (x-scale, y+1.732*scale)&lt;br /&gt;     case 300 =&amp;gt; (x+scale, y+1.732*scale)&lt;br /&gt;    }&lt;br /&gt;    iter(next, as, plist ++ List((next)))&lt;br /&gt;   case _ =&amp;gt; plist&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; def points2string(plist:List[(Double,Double)]) : String = plist match {&lt;br /&gt;  case (x,y)::ps =&amp;gt; x.toString + "," + y.toString + " " + points2string(ps)&lt;br /&gt;  case _ =&amp;gt; ""&lt;br /&gt; }&lt;br /&gt; override def body = &lt;br /&gt;  &amp;lt;pack&amp;gt;&lt;br /&gt;   &amp;lt;path stroke="blue" fill ="none"&lt;br /&gt;    d= {"M"+ points2string(angles2points(recursive(level_0,0))) + "z"} /&amp;gt;&lt;br /&gt;  &amp;lt;/pack&amp;gt;&amp;gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;My concern with this code, from the&amp;nbsp;beginning, was I might be using too much memories. &amp;nbsp;No wonder, I got OutOfMemoryError for level 6.&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;scala&amp;gt; val k = new Koch(400,6)&lt;br /&gt;k: Koch = Koch@28fd3fba&lt;br /&gt;&lt;br /&gt;scala&amp;gt; k.draw("koch.svg")     &lt;br /&gt;java.lang.OutOfMemoryError: Java heap space&lt;br /&gt;at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:119)&lt;br /&gt;at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:42)&lt;br /&gt;at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:48)&lt;br /&gt;at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:48)&lt;br /&gt;at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)&lt;br /&gt;at scala.collection.immutable.List.foreach(List.scala:45)&lt;br /&gt;at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)&lt;br /&gt;at scala.collection.immutable.List.$colon$colon$colon(List.scala:78)&lt;br /&gt;at scala.collection.immutable.List.$plus$plus(List.scala:139)&lt;br /&gt;at Koch.iter(&lt;console&gt;:39)&lt;br /&gt;at Koch.iter(&lt;console&gt;:39)&lt;br /&gt;at Koch.iter(&lt;console&gt;:39)&lt;br /&gt;...&lt;br /&gt;scala&amp;gt; &lt;br /&gt;&lt;/console&gt;&lt;/console&gt;&lt;/console&gt;&lt;/pre&gt;&lt;br /&gt;I guess I can write a point to file one by one as it being generated instead of preparing all the points in a list before writing them to the file all at once. &amp;nbsp;That way, I think, I can reduce the memory space and potentially generate any level of snowflakes. &amp;nbsp;But, doing that in obvious way, manually, normal way, whatever, does not sound so exciting. &amp;nbsp;I wonder if I could use lazy evaluation to achieve that, somehow.&lt;br /&gt;That might be a next topic. &amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/652678132162639880-8866538907541500785?l=spacesheriff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://spacesheriff.blogspot.com/feeds/8866538907541500785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://spacesheriff.blogspot.com/2011/03/svg-fractal-with-scala-3-koch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default/8866538907541500785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default/8866538907541500785'/><link rel='alternate' type='text/html' href='http://spacesheriff.blogspot.com/2011/03/svg-fractal-with-scala-3-koch.html' title='SVG Fractal with Scala 3 : The Koch snowflakes'/><author><name>Nameless Shura</name><uri>http://www.blogger.com/profile/16396650233099220953</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh6.googleusercontent.com/-RVKMIOzljbw/TW8u8yWHukI/AAAAAAAAAH0/fk4VeW1isMA/s72-c/koch.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-652678132162639880.post-7353970182055402436</id><published>2011-02-28T22:43:00.000-08:00</published><updated>2011-02-28T22:43:08.529-08:00</updated><title type='text'>SVG Fractal with Scala 2 : The Sierpinski gasket</title><content type='html'>&lt;span class="Apple-style-span" style="font-size: large;"&gt;Result&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-Z5cc7hdYatw/TWx1oyYs8EI/AAAAAAAAAHs/A-_WdnAJ7bs/s1600/tri10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="277" src="https://lh4.googleusercontent.com/-Z5cc7hdYatw/TWx1oyYs8EI/AAAAAAAAAHs/A-_WdnAJ7bs/s320/tri10.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Source Code - first part&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint linenums lang-scala"&gt;import java.io.FileWriter&lt;br /&gt;import java.io.BufferedWriter&lt;br /&gt;&lt;br /&gt;abstract class Fractal(width: Double, height: Double) {&lt;br /&gt;&lt;br /&gt; val head = """&amp;lt;?xml version="1.0" standalone="no" ?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"&lt;br /&gt;"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&amp;gt;"""&lt;br /&gt;&lt;br /&gt; def body: xml.Elem &lt;br /&gt;&lt;br /&gt; def root = body match {&lt;br /&gt;  case &amp;lt;pack&amp;gt;{inner @ _*}&amp;lt;/pack&amp;gt; =&amp;gt;&lt;br /&gt;  &amp;lt;svg width={width.toString} height={height.toString}&lt;br /&gt;   xmlns="http://www.w3.org/2000/svg"&lt;br /&gt;   xmlns:xlink="http://www.w3.org/1999/xlink"&amp;gt;&lt;br /&gt;   {inner}&lt;br /&gt;  &amp;lt;/svg&amp;gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; def draw(filename: String): Unit = {&lt;br /&gt;  val fw = new BufferedWriter(new FileWriter(filename))&lt;br /&gt;  fw.write(head)&lt;br /&gt;  fw.newLine()&lt;br /&gt;  fw.write(root.toString)&lt;br /&gt;  fw.close()&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is an abstract class which provides draw() function to its descendants. &amp;nbsp;body() should generate&amp;nbsp;&amp;lt;pack&amp;gt; figure &amp;lt;/pack&amp;gt; form of XML code and root() changes it to &amp;lt;svn&amp;gt; figure &amp;lt;/svn&amp;gt;. &amp;nbsp;And, then, draw() write it to a file.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Things I am so sure&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Is this the best way to writing to the file? &amp;nbsp;Doesn't Scala really have its own write functions?&lt;/li&gt;&lt;li&gt;Maybe I should use Traits, whatever it is, rather than abstract class. &amp;nbsp;That might be more Scala way?&lt;/li&gt;&lt;li&gt;I defined &lt;b&gt;head&lt;/b&gt; as a &lt;b&gt;String&lt;/b&gt; because defining it as a &lt;b&gt;xml.Elem&lt;/b&gt; gave me an error at &amp;lt;!DOCTYPE. &amp;nbsp;Compiler said it did not expected ! after &amp;lt;. &amp;nbsp;But, is this really? &amp;nbsp;Isn't &amp;lt;! kind a common in XML? &amp;nbsp;&lt;/li&gt;&lt;li&gt;I use following to substitute &lt;b&gt;&amp;lt;body&amp;gt;&lt;/b&gt; with &lt;b&gt;&amp;lt;scala&amp;gt;&lt;/b&gt;. &amp;nbsp;Is this, again, a best practice?&lt;br /&gt;&lt;pre class="prettyprint linenums lang-scala"&gt;def root = body match {&lt;br /&gt;    case &amp;lt;pack&amp;gt;{inner @ _*}&amp;lt;/pack&amp;gt; =&amp;gt;&lt;br /&gt;    &amp;lt;svg&amp;gt;{inner} &amp;lt;/svg&amp;gt;&lt;br /&gt;    }&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Source Code - second part&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint linenums lang-scala"&gt;class Triangle(width: Double, level:Int) extends &lt;br /&gt;      Fractal(width,(width*1.732/2+1).toInt) {&lt;br /&gt; &lt;br /&gt;    val scale = width/2 - 20&lt;br /&gt;    val base = &amp;lt;pack&amp;gt;&amp;lt;path id="level_0" fill="blue" &lt;br /&gt;                          d="M0,0 2,0 1,1.732 z"/&amp;gt;&amp;lt;/pack&amp;gt;&lt;br /&gt; &lt;br /&gt;    def recursive(current:xml.Elem, currlevel:Int): xml.Elem = {&lt;br /&gt;  if(currlevel == level)&lt;br /&gt;  {&lt;br /&gt;   current match {&lt;br /&gt;    case &amp;lt;pack&amp;gt;{in @ _*}&amp;lt;/pack&amp;gt; =&amp;gt;&lt;br /&gt;    &amp;lt;pack&amp;gt;&lt;br /&gt;    &amp;lt;g transform={"translate(20,20) scale("+scale+")"}&amp;gt;&lt;br /&gt;     {in}&lt;br /&gt;    &amp;lt;/g&amp;gt;&lt;br /&gt;    &amp;lt;/pack&amp;gt;&lt;br /&gt;   }&lt;br /&gt;  } else {&lt;br /&gt;   val next = current match {&lt;br /&gt;    case &amp;lt;pack&amp;gt;{in @ _*}&amp;lt;/pack&amp;gt; =&amp;gt;&lt;br /&gt;    &amp;lt;pack&amp;gt;&lt;br /&gt;    &amp;lt;g transform="translate(0,0) scale(0.5)"&amp;gt;&lt;br /&gt;     {in}&lt;br /&gt;    &amp;lt;/g&amp;gt;&lt;br /&gt;    &amp;lt;g transform="translate(1,0) scale(0.5)"&amp;gt;&lt;br /&gt;     {in}&lt;br /&gt;    &amp;lt;/g&amp;gt;&lt;br /&gt;    &amp;lt;g transform="translate(0.5,0.866) scale(0.5)"&amp;gt;&lt;br /&gt;     {in}&lt;br /&gt;    &amp;lt;/g&amp;gt;&lt;br /&gt;    &amp;lt;/pack&amp;gt;&lt;br /&gt;   }&lt;br /&gt;   recursive(next, currlevel+1)&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; override def body = recursive(base, 0)&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is the real generator class of the Sierpinski gasket. &amp;nbsp;Take figure width and recursive level as parameters and draw() output a SVG file. &amp;nbsp;Basic idea is that at every recursive process, current level of figure is copied 3 times, shrink 50%, and then located to the position so that 3 of them combined form a big triangle.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Observations&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;My Macbook Pro runs this script up to level 11. &amp;nbsp;Level 12 gives me a stack over flow (Scala 2.8.1.final Interpreter).&lt;/li&gt;&lt;li&gt;I first wrote a code which generates SVG code just like&amp;nbsp;&lt;a href="http://www.mecxpert.de/svg/fractals.html"&gt;this web page&lt;/a&gt;&amp;nbsp;. &amp;nbsp;But, obviously, these style requires more processing power when drawing. &amp;nbsp;My Chrome gave up at level 8 and showed this.&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-CGPNfCZSFGI/TWyVKftLybI/AAAAAAAAAHw/Pfmq5ss1-6Y/s1600/snap.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="119" src="https://lh5.googleusercontent.com/-CGPNfCZSFGI/TWyVKftLybI/AAAAAAAAAHw/Pfmq5ss1-6Y/s320/snap.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/652678132162639880-7353970182055402436?l=spacesheriff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://spacesheriff.blogspot.com/feeds/7353970182055402436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://spacesheriff.blogspot.com/2011/02/svg-fractal-with-scala-2-sierpinski.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default/7353970182055402436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default/7353970182055402436'/><link rel='alternate' type='text/html' href='http://spacesheriff.blogspot.com/2011/02/svg-fractal-with-scala-2-sierpinski.html' title='SVG Fractal with Scala 2 : The Sierpinski gasket'/><author><name>Nameless Shura</name><uri>http://www.blogger.com/profile/16396650233099220953</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh4.googleusercontent.com/-Z5cc7hdYatw/TWx1oyYs8EI/AAAAAAAAAHs/A-_WdnAJ7bs/s72-c/tri10.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-652678132162639880.post-1546005390385559345</id><published>2011-02-27T16:26:00.000-08:00</published><updated>2011-02-27T18:52:37.545-08:00</updated><title type='text'>SVG Fractals with Scara</title><content type='html'>This is my first blogging ever. &amp;nbsp;I started learning a programming language called Scala a couple of weeks ago. &amp;nbsp;I thought it was a good timing for me to start blogging to keep track of my progress on learning and give some motivations at the same time. &amp;nbsp; But, gee, I even do not know how to put my source code here, not to mention about SVG. &amp;nbsp;Well, basically, I am learning two things at once, please be patient.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;References&lt;/span&gt;&lt;br /&gt;Following great URLs helped me a lot.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.mecxpert.de/svg/fractals.html"&gt;The Beauty of SVG&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://tutorial.jp/graph/index.html"&gt;Free tutorials for graphics&lt;/a&gt;&amp;nbsp;&amp;nbsp;Great tutorials for Postscript and SVG (in Japanese)&lt;/li&gt;&lt;li&gt;&lt;a href="http://itpro.nikkeibp.co.jp/article/COLUMN/20060915/248215/"&gt;NikkeiBP article on Scala&lt;/a&gt;&amp;nbsp;Great introduction to Scala (in Japanese)&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Although my native&amp;nbsp;tang is Japanese, I usually find tutorials in English better to understand. &amp;nbsp; I went through Haskell and Schema before, and they have very good English tutorials. &amp;nbsp;Somehow, however, it worked differently for me with Scala...&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Goal&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Write a scala program, or script?, which outputs a SVG file of a fractal diagam such as Koch snowflake, or this.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-Ejsuhl6kO7I/TWrnWi1v18I/AAAAAAAAAHk/msgb5rCKdWs/s1600/triangle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="277" src="https://lh4.googleusercontent.com/-Ejsuhl6kO7I/TWrnWi1v18I/AAAAAAAAAHk/msgb5rCKdWs/s320/triangle.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I wrote this triangle as SVG and&amp;nbsp;converted it into PNG with Incscape. &amp;nbsp;I fond&amp;nbsp;&lt;a href="http://plindenbaum.blogspot.com/2009/11/tool-converting-svg-to-canvas_22.html"&gt;this post&lt;/a&gt;&amp;nbsp;and tried, but did not work with my file. &amp;nbsp;I am pretty sure that that is my SVG file that is not following the convention strictly enough that his program works. &amp;nbsp;But, since Chrome and Firefox can show the picture, at least in my environment, I am satisfied with my SVG, at least for now...&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Well, that it for today. &amp;nbsp;I wil post my source code next time (tomorrow, or next weekend, or might be tonight).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/652678132162639880-1546005390385559345?l=spacesheriff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://spacesheriff.blogspot.com/feeds/1546005390385559345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://spacesheriff.blogspot.com/2011/02/svg-fractals-with-scara.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default/1546005390385559345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/652678132162639880/posts/default/1546005390385559345'/><link rel='alternate' type='text/html' href='http://spacesheriff.blogspot.com/2011/02/svg-fractals-with-scara.html' title='SVG Fractals with Scara'/><author><name>Nameless Shura</name><uri>http://www.blogger.com/profile/16396650233099220953</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh4.googleusercontent.com/-Ejsuhl6kO7I/TWrnWi1v18I/AAAAAAAAAHk/msgb5rCKdWs/s72-c/triangle.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
