<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Nicolas Garcia Belmonte</title>
 <link href="http://philogb.github.com/blog/feed.xml" rel="self"/>
 <link href="http://philogb.github.com/blog/"/>
 <updated>2014-12-20T18:28:07+00:00</updated>
 <id>http://blog.thejit.org/</id>
 <author>
   <name>Nicolas Garcia Belmonte</name>
   <email>philogb@gmail.com</email>
 </author>

 
 <entry>
   <title>Behind the scenes: Visualizing the conversation around the #WorldCup</title>
   <link href="http://philogb.github.com/blog/2014/07/10/behind-the-scenes-visualizing-the-global-conversation-around-the-wc"/>
   <updated>2014-07-10T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2014/07/10/behind-the-scenes-visualizing-the-global-conversation-around-the-wc</id>
   <content type="html">
    
      &lt;p&gt;Yesterday &lt;a href=&quot;https://blog.twitter.com/2014/the-global-conversation-about-the-worldcup&quot;&gt;we released an article&lt;/a&gt; showing Twitter data about the
global conversation around the World Cup. The main piece consisted on a &lt;a href=&quot;https://interactive.twitter.com/wcmentions/&quot;&gt;data visualization&lt;/a&gt; showing
how each country mentioned the national teams.&lt;/p&gt;

&lt;p&gt;This is a behind the scenes on this work. I will show how we got to
design the visualizations and interactions we came up with for the project
and also I’ll cover some interesting insights taken from the data
visualization.&lt;/p&gt;

&lt;p&gt;So first things first, if you haven’t yet please go on, &lt;a href=&quot;https://interactive.twitter.com/wcmentions/&quot;&gt;have a look&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/main.png&quot; alt=&quot;Screenshot of Visualization&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The visualization has two main parts. The top one lets you select a
country that participated in the World Cup and for that country one can
see things such as:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;What were the top countries mentioning the selected country, also
called &lt;em&gt;mentions of&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;What other countries were mentioned by the selected country, also
called &lt;em&gt;mentions by&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was done by analyzing hashflag mentions in Tweets.&lt;/p&gt;

&lt;p&gt;We went through a few iterations for the top visualization:&lt;/p&gt;

&lt;h2 id=&quot;first-iteration&quot;&gt;First iteration&lt;/h2&gt;

&lt;p&gt;The first take
we had on it merged both the menu and the graph in one single graphic:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/first.png&quot; alt=&quot;first iteration&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The above row shows “mentions by”. The bottom row shows “mentions of”.
The above image shows the results for Brazil. This image
shows for example that people in Brazil also mention Argentina and Germany (cropped).
It also shows that most of the other countries in the World Cup mention
Brazil constantly.&lt;/p&gt;

&lt;p&gt;To enforce the notion of directionality we implemented the tapered
representation recommended in &lt;a href=&quot;http://www.win.tue.nl/~dholten/papers/directed_edges_chi.pdf&quot;&gt;Holten and van Wijk paper&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, after some user testing we found out that although the
visualization combined both the menu interaction and the mentions data
in a compact way, it was confusing for people.
The directionality was not clear and also it wasn’t clear that the labels were also used as
controls to select a country.&lt;/p&gt;

&lt;h2 id=&quot;second-iteration&quot;&gt;Second iteration&lt;/h2&gt;

&lt;p&gt;The second iteration then focused on simplifying the graph. The simplest
encoding we came up with to represent the information were two sets
of bar charts, one showing a list of top countries mentioning the selected
country or &lt;em&gt;mentions of&lt;/em&gt;; and another bar chart mentioning the list of top hashflags
mentioned by the selected country or &lt;em&gt;mentions by&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/second2.png&quot; alt=&quot;second iteration2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/second1.png&quot; alt=&quot;second iteration1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;These two bar charts convey almost the same information than the first
design. The main differences are that we only select the top 4 countries on each
side of the list, and also that we decide to add percentages to show
how often &lt;em&gt;mentions of&lt;/em&gt; and &lt;em&gt;mentions by&lt;/em&gt; happened.&lt;/p&gt;

&lt;p&gt;This design also forced us to separate the interaction part from the
visualization. We created a separate menu listing all hashflags:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/menu.png&quot; alt=&quot;menu&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Paradoxically we found that this design was in a way worse: although it
looked simple, it now consisted of two disconnected parts and it was
hard to visualize the flow of &lt;em&gt;mentions by/of&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;third-iteration&quot;&gt;Third iteration&lt;/h2&gt;

&lt;p&gt;After more user testing and gathering feedback from our team we came up
with the third design. This one still focused on “low entropy” but also
included the notion of directionality we had on the first design. It shows almost
the same information than the first one, but needed less text and less
explanation time to be understood by our test users.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/BRA.png&quot; alt=&quot;third iteration&quot; /&gt;&lt;/p&gt;

&lt;p&gt;A few interesting insights emerge from this visualization:&lt;/p&gt;

&lt;p&gt;For Brazil, its team was widely discussed among football fans in Chile and
Mexico, while Brazilians were paying a lot of attention to semifinal opponent
Germany, archrivals Argentina, and fellow semifinalists Netherlands:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/BRA.png&quot; alt=&quot;third iteration brazil&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For France it’s interesting to see some of the immigration patterns.
The most mentioned hashflag from France is #ALG. Top countries
mentioning #FRA are french speaking countries and ex-colonies:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/FRA.png&quot; alt=&quot;third iteration FRA&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For the US the most mentioned hashflag is #MEX (for Mexico).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/USA.png&quot; alt=&quot;third iteration US&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Some other connections can be geographical, like Bosnia and Herzegovina
and Croatia mentioning each other:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/BIH.png&quot; alt=&quot;third iteration BIH&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For Argentina, it’s interesting to see that besides Brazil the main
mentioned country is Colombia. The Argentine coach Pekerman was the
coach for the Colombian team this year.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/ARG.png&quot; alt=&quot;third iteration ARG&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;bottom-visualization&quot;&gt;Bottom visualization&lt;/h2&gt;

&lt;p&gt;The bottom visualization was actually the first visualization we worked
on. It is mostly an exploratory visualization and shows with finer
detail all the hashflag mentions for the selected country day by day.&lt;/p&gt;

&lt;p&gt;The viz is a bit harder to read, but there is a rationale behind the
design choices for it.&lt;/p&gt;

&lt;p&gt;Each column represents a day, and the width of each column is sized
according to the volume of Tweets with hashflags sent from that country
on the given day. Inside each column we have the relative distribution of hashflag mentions
during that day. Here’s an example for Argentina:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/treemap1.png&quot; alt=&quot;bottom1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The most challenging feature to grasp might be the width encoding for each day.
Why not just create a stacked bar chart and use the (cumulative) height of each bar
to represent the amount of Tweets for each day? This would be the result
for Argentina:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/treemap3.png&quot; alt=&quot;bar chart&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As you can see (or not see), some days are readable, but most of them
aren’t. This happens because we’re encoding two things with height: the
number of Tweets for each hashflag on a given day and the &lt;em&gt;cumulative&lt;/em&gt;
number of Tweets on a given day. Yes one adds up to the
other, but these are different metrics and can be encoded differently.&lt;/p&gt;

&lt;p&gt;To get our visualization the first step is to get rid of the height encoding for the Tweets per
day value. We now have a percentage based area chart:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/treemap2.png&quot; alt=&quot;area chart&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Second step is to encode total Tweets per day on the x-axis.&lt;/p&gt;

&lt;p&gt;This is not a novel design: you can find this in slice and dice treemaps. As
opposed to squarified treemaps, the slice and dice treemap algorithm
maintains order and stability for nodes, but its nodes usually suffer from
having high aspect ratio. You can explore squarified, slice and dice and
strip treemap layout algorithms in this &lt;a href=&quot;http://philogb.github.io/jit/static/v20/Jit/Examples/Treemap/example1.html&quot;&gt;implementation I made with the
JavaScript InfoVis Toolkit a long time ago&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The treemap layout also has some interactions. By clicking on a
day one can zoom in and see the relative mentions for each hashflag with
more detail:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wcmentions/treemap4.png&quot; alt=&quot;slide and dice zoom&quot; /&gt;&lt;/p&gt;

&lt;p&gt;All in all it proved to be a nice exploratory tool to infer some of the
findings I mentioned for the top visualization.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Data visualization is an iterative process. Moreover, you cannot do data
visualization by yourself and expect it to be optimal. Do not
underestimate user testing and most of all, don’t underestimate peer
feedback. With that I’d like to thank the communications and analytics team at Twitter for their feedback and testing of the
visualization.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Multilevel Agglomerative Edge Bundling in JS</title>
   <link href="http://philogb.github.com/blog/2013/12/16/mingle"/>
   <updated>2013-12-16T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2013/12/16/mingle</id>
   <content type="html">
    
      &lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;fr&quot;&gt;
&lt;p&gt;Hello data visualizers! I just released a JS version of the MINGLE edge bundling technique:
&lt;a href=&quot;https://t.co/Gvm29H6gf2&quot;&gt;https://t.co/Gvm29H6gf2&lt;/a&gt;
&lt;a href=&quot;http://t.co/SJadXUK2nW&quot;&gt;pic.twitter.com/SJadXUK2nW&lt;/a&gt;
&lt;/p&gt;
&amp;mdash; nico (@philogb)
&lt;a href=&quot;https://twitter.com/philogb/statuses/411543867037478912&quot;&gt;13 Décembre 2013&lt;/a&gt;
&lt;/blockquote&gt;

&lt;script async=&quot;true&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;
&lt;/script&gt;

&lt;p&gt;This is a JavaScript implementation of the paper &lt;a href=&quot;http://www2.research.att.com/~yifanhu/PUB/edge_bundling.pdf&quot;&gt;Multilevel Agglomerative Edge Bundling
for Visualizing Large Graphs&lt;/a&gt;
 (Emden R. Gansner, Yifan Hu, Stephen North, Carlos Scheidegger).&lt;/p&gt;

&lt;p&gt;The edge bundling algorithm groups edges together to minimize the amount of
ink used to render a graph. This particular paper introduces a fast
technique to perform edge bundling.&lt;/p&gt;

&lt;p&gt;Take for example this map connecting locations between the east coast in
the US and western Europe:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.github.com/philogb/mingle/master/img/easteurope1.png&quot; alt=&quot;easteurope image 1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The algorithm creates a proximity graph for the edges where each of the
edges is represented by a node. Then the algorithm bundles edges as long
as we’re saving some ink in the final rendering. Here’s an intermediate
step on the bundling animation:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.github.com/philogb/mingle/master/img/easteurope2.png&quot; alt=&quot;easteurope image 1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And here’s the final result:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.github.com/philogb/mingle/master/img/easteurope3.png&quot; alt=&quot;easteurope image 1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This implementation is solely based on the paper. The license for the code is MIT.&lt;/p&gt;

&lt;h2 id=&quot;examples&quot;&gt;Examples&lt;/h2&gt;

&lt;p&gt;This simple example shows links connecting locations in the Bay Area.
The rendering uses 2D Canvas but
could use any other rendering API.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://philogb.github.io/mingle/example&quot;&gt;You can see an example here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.github.com/philogb/mingle/master/img/sfcommute.png&quot; alt=&quot;Image of Edge bundling example&quot; /&gt;&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>DotJS</title>
   <link href="http://philogb.github.com/blog/2013/12/04/dotjs"/>
   <updated>2013-12-04T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2013/12/04/dotjs</id>
   <content type="html">
    
      &lt;p&gt;Last Monday I was in Paris for &lt;a href=&quot;http://twitter.com/dotjseu&quot;&gt;DotJS&lt;/a&gt;,
organized by Sylvain Zimmer and &lt;a href=&quot;http://www.dotconferences.eu/&quot;&gt;dotConferences&lt;/a&gt;,
arguably the biggest JavaScript conference in Europe, with more than 900
JavaScript “savants”.&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;fr&quot;&gt;
&lt;p&gt;
&lt;a href=&quot;#&quot;&gt;#dotjs&lt;/a&gt; from the front. Thems be a lot of people &lt;a href=&quot;http://t.co/RqEXbrbJEl&quot;&gt;http://t.co/RqEXbrbJEl&lt;/a&gt;
&lt;/p&gt;
&amp;mdash; Remy Sharp (@rem)
&lt;a href=&quot;https://twitter.com/rem/statuses/407985485324505089&quot;&gt;3 Décembre 2013&lt;/a&gt;
&lt;/blockquote&gt;

&lt;script async=&quot;true&quot; src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;
&lt;/script&gt;

&lt;p&gt;My talk was titled “Growing a Language for Graphics”, which was about
JavaScript as seen from the eyes of a data visualization / graphics person.
By having a look at GLSL - a domain specific language (DSL) for graphics used in WebGL
- I talk about what language features would help graphic developers on the Web and I show the
long history of trying to standardize operator overloading into JavaScript.&lt;/p&gt;

&lt;script async=&quot;true&quot; class=&quot;speakerdeck-embed&quot; data-id=&quot;51077b503f180131c51876c2ec7c4e6f&quot; data-ratio=&quot;1.77777777777778&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;
&lt;/script&gt;

&lt;p&gt;I’ve been wanting to a give a talk about this topic for a long time,
having witnessed most of the discussions around operator overloading in
JavaScript and it’s different proposals since early 2007. Going from
&lt;a href=&quot;http://www.ecmascript.org/es4/spec/overview.pdf&quot;&gt;generic functions&lt;/a&gt; to a &lt;a href=&quot;https://mail.mozilla.org/pipermail/es-discuss/2009-January/008535.html&quot;&gt;double-dispatch approach&lt;/a&gt; to &lt;a href=&quot;https://mail.mozilla.org/pipermail/es-discuss/2009-June/009603.html&quot;&gt;multimethods&lt;/a&gt;, to
&lt;a href=&quot;http://wiki.ecmascript.org/doku.php?id=strawman:value_proxies&quot;&gt;value proxies&lt;/a&gt; and finally
&lt;a href=&quot;http://wiki.ecmascript.org/doku.php?id=strawman:value_objects&quot;&gt;value objects&lt;/a&gt;, I must say that my interest in having this feature into JavaScript never faded.&lt;/p&gt;

&lt;p&gt;My talk is inpired on a great talk by Guy Steele Jr. titled
“Growing a Language” and that I definitely recommend you to watch:&lt;/p&gt;

&lt;iframe width=&quot;500&quot; height=&quot;375&quot; src=&quot;//www.youtube.com/embed/_ahvzDzKdB0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;
&lt;/iframe&gt;

&lt;p&gt;In case you’re interested in knowing more about operator overloading
proposals in JavaScript I’m pasting a dump of the bibliography here:&lt;/p&gt;

&lt;h2 id=&quot;why-operator-overloading&quot;&gt;Why operator overloading&lt;/h2&gt;

&lt;p&gt;http://www.jroller.com/cpurdy/entry/the_seven_habits_of_highly1&lt;/p&gt;

&lt;h2 id=&quot;es4-overview&quot;&gt;ES4 overview&lt;/h2&gt;

&lt;p&gt;http://www.ecmascript.org/es4/spec/overview.pdf&lt;/p&gt;

&lt;h2 id=&quot;generic-functions&quot;&gt;Generic functions&lt;/h2&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2007-November/005043.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2007-November/005049.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2007-November/005052.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2007-November/005053.html&lt;/p&gt;

&lt;h2 id=&quot;operator-overloading-proposal&quot;&gt;2009 Operator Overloading proposal&lt;/h2&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2009-January/008535.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2009-January/008541.html&lt;/p&gt;

&lt;p&gt;http://wiki.ecmascript.org/doku.php?id=strawman:operator_overloading_with_double_dispatch&lt;/p&gt;

&lt;h2 id=&quot;extendscript-oo&quot;&gt;ExtendScript OO&lt;/h2&gt;

&lt;p&gt;http://forums.adobe.com/thread/646268&lt;/p&gt;

&lt;p&gt;http://www.indiscripts.com/post/2010/05/operator-overloading-with-extendscript&lt;/p&gt;

&lt;h2 id=&quot;operator-overloading-revisited&quot;&gt;Operator Overloading revisited&lt;/h2&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2009-June/009603.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2009-June/009604.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2009-June/&lt;/p&gt;

&lt;h2 id=&quot;value-types&quot;&gt;Value types&lt;/h2&gt;

&lt;p&gt;http://wiki.ecmascript.org/doku.php?id=strawman:value_types&lt;/p&gt;

&lt;p&gt;Decimal type:&lt;/p&gt;

&lt;p&gt;http://intertwingly.net/stories/2008/09/20/estest.html&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2009-January/008646.html&lt;/p&gt;

&lt;p&gt;Value types page started:&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2010-January/010677.html&lt;/p&gt;

&lt;h2 id=&quot;value-objects&quot;&gt;Value objects&lt;/h2&gt;

&lt;p&gt;http://wiki.ecmascript.org/doku.php?id=strawman:value_objects&lt;/p&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2012-March/021411.html&lt;/p&gt;

&lt;p&gt;http://www.slideshare.net/BrendanEich/value-objects&lt;/p&gt;

&lt;p&gt;https://bugzilla.mozilla.org/show_bug.cgi?id=749786&lt;/p&gt;

&lt;h2 id=&quot;value-proxies&quot;&gt;Value proxies&lt;/h2&gt;

&lt;p&gt;http://wiki.ecmascript.org/doku.php?id=strawman:value_proxies&lt;/p&gt;

&lt;h2 id=&quot;es-next&quot;&gt;ES next&lt;/h2&gt;

&lt;p&gt;https://mail.mozilla.org/pipermail/es-discuss/2013-April/029949.html&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Laika</title>
   <link href="http://philogb.github.com/blog/2013/10/16/laika"/>
   <updated>2013-10-16T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2013/10/16/laika</id>
   <content type="html">
    
      &lt;p&gt;Last night I presented at the &lt;a href=&quot;http://www.meetup.com/visualizemydata/events/141900982/&quot;&gt;data visualization meetup at Twitter HQs&lt;/a&gt;.
It was really awesome to meet the people there and nerd-out about visualization related things.&lt;/p&gt;

&lt;p&gt;You can find the slids for my presentation &lt;a href=&quot;http://www.slideshare.net/philogb/interactives-at-twitter-27259565&quot;&gt;here&lt;/a&gt;. Also the video is here:&lt;/p&gt;

&lt;iframe width=&quot;500&quot; height=&quot;375&quot; src=&quot;//www.youtube.com/embed/Bgu_OsA7qNQ&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;
&lt;/iframe&gt;

&lt;p&gt;The presentation was mostly about the process of releasing public-facing
data visualizations at Twitter, and also some analysis on one project
we’re currently working on called Laika.&lt;/p&gt;

&lt;h2 id=&quot;interactive&quot;&gt;#interactive&lt;/h2&gt;

&lt;p&gt;Some of the examples I’ve shown are interactives that complement a
story. For example I presented about &lt;a href=&quot;https://blog.twitter.com/2013/behind-the-numbers-how-to-understand-big-moments-on-twitter&quot;&gt;Twitter’s biggest moments&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/laika/tpms.png&quot; alt=&quot;Twitter biggest moments image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;and also about our last &lt;a href=&quot;https://blog.twitter.com/2013/visualizing-tweets-around-emmy-nominated-shows&quot;&gt;Emmys visualization&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/laika/emmys.png&quot; alt=&quot;Emmys visualization image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In the presentation I explained that these projects are generally done
within the week (sometimes even in less time). The ratio of time invested vs. amount of engagement is
high, so it’s a strategy that currently works for us.&lt;/p&gt;

&lt;h2 id=&quot;laika&quot;&gt;Laika&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/laika/globe1.png&quot; alt=&quot;Laika picture&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Laika is a data visualization showing geolocated activity on Twitter
around the world. The first iteration of the project was done during
hackweek. We had great feedback from people in the office so per
request the project turned into a live visual that is currently shown in the
displays around the Twitter HQs.&lt;/p&gt;

&lt;p&gt;The main view shows a globe view, with day and night textures,
displaying geolocated Tweets and relevant Tweets around news (in the top
part). Click play to watch the short video.&lt;/p&gt;

&lt;video src=&quot;/blog/assets/laika/l1.webmhd.webm&quot; controls=&quot;true&quot;&gt;
&lt;/video&gt;

&lt;p&gt;Within this globe view we can focus on a particular city and fetch a
timeline of relevant Tweets happening there. Click below to watch the
short transition.&lt;/p&gt;

&lt;video src=&quot;/blog/assets/laika/l22.webmhd.webm&quot; controls=&quot;true&quot;&gt;
&lt;/video&gt;

&lt;p&gt;Although people like the globe view, this view hides 50%
of what’s happening in the world at each moment. We added an unfolding
of the globe into a plane for this. Click play below to watch the short
video.&lt;/p&gt;

&lt;video src=&quot;/blog/assets/laika/l3.webmhd.webm&quot; controls=&quot;true&quot;&gt;
&lt;/video&gt;

&lt;p&gt;Following the “Overview, zoom and filter” mantra you can focus in a city
to get relevant Tweets of what’s happening there along with news of that
city.&lt;/p&gt;

&lt;video src=&quot;/blog/assets/laika/l5.webmhd.webm&quot; controls=&quot;true&quot; poster=&quot;/blog/assets/laika/poster.png&quot;&gt;
&lt;/video&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Mobility Flow of France</title>
   <link href="http://philogb.github.com/blog/2013/06/09/france-mobility-flow"/>
   <updated>2013-06-09T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2013/06/09/france-mobility-flow</id>
   <content type="html">
    
      &lt;p&gt;&lt;a href=&quot;http://philogb.github.io/france/&quot;&gt;Click here to access the map&lt;/a&gt; (A WebGL capable browser and computer
is required).&lt;/p&gt;

&lt;p&gt;A few months ago I spoke at Strata in Santa Clara, CA. My
presentation was about &lt;a href=&quot;http://strata.oreilly.com/2013/01/exploring-web-standards-for-high-data-density-visualizations.html&quot;&gt;Exploring Web Standards for Data
Visualization&lt;/a&gt; and in the presentation I showed some examples of
visualizations done at Twitter with HTML/SVG, 2d Canvas and WebGL.&lt;/p&gt;

&lt;p&gt;I also showed a custom visualization of the mobility flow in France
(i.e. how people moved from state to state in the past five years) and
an attempt at visualizing this pretty rich dataset (&amp;gt; 45,000 entries) with
different standards. &lt;a href=&quot;http://philogb.github.io/france&quot;&gt;You can find the result of the visualization
here&lt;/a&gt;. Please make sure you have a WebGL capable browser (and machine)
to view it.&lt;/p&gt;

&lt;p&gt;Although this is a pretty classical map, the work was inpired by Jacques
Bertin’s &lt;em&gt;Semiology of Graphics&lt;/em&gt;. Since he was a french cartographer his
book is filled with maps and cartograms of France for different
datasets.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/france/bertin.png&quot; alt=&quot;Jacques Bertin&#39;s maps&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The visualization has two types of maps. The first one is an aggregated
map by state and county, where states are reddish if the overall state
population increased in the past five years, and a more blueish color if
the population decreased. Clicking on a state will show this information
at a county level.&lt;/p&gt;

&lt;p&gt;The other map shows mobility flow for a selected state. It gets triggered when a state is hovered more than 2 seconds. In that map reddish states are the ones getting people from the current hovered state and blueish states are states where people moved to the hovered state.&lt;/p&gt;

&lt;p&gt;Following the second map there are some interesting insights. For
example, if you hover on Paris you’ll note that most people move from
the city centre to the suburbs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/france/1.png&quot; alt=&quot;map1&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you hover the suburbs, you’ll see
people going even further away from Paris. If you follow this pattern
you’ll find that a lot of people are moving from Paris to Bretagne:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/france/3.png&quot; alt=&quot;map3&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Another interesting fact is that if you hover some state in the south of
France you’ll see a lot of people from everywhere else going there,
except for Paris: in that case there are lots of people going from the
south of France to Paris.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/france/4.png&quot; alt=&quot;map4&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There are other interesting patterns too.
I think this does a better job than the &lt;a href=&quot;http://www.forbes.com/special-report/2011/migration.html&quot;&gt;US mobility map&lt;/a&gt;. The US map
does not show information when there’s no interaction, and when there is
the edges added to the viz occlude the actual color of the states and
things become hard to read.&lt;/p&gt;

&lt;h3 id=&quot;standards-used&quot;&gt;Standards Used&lt;/h3&gt;

&lt;p&gt;One of the challenges for the visualization was to display data at the county level:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/france/county.png&quot; alt=&quot;counties&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I first tried to just simply load the SVG county map of France, but this
just took too long:&lt;/p&gt;

&lt;video controls=&quot;true&quot; width=&quot;480&quot;&gt;
  &lt;source src=&quot;/blog/assets/france/france-svg.mp4&quot; type=&quot;video/mp4; codecs=&amp;quot;avc1.42E01E, mp4a.40.2&amp;quot;&quot; /&gt;
  &lt;source src=&quot;/blog/assets/france/france-svg.webm&quot; /&gt;
&lt;/video&gt;

&lt;p&gt;I know it looks like a neat animation, but this is actually the result
of loading the county svg map (without caching) in chrome. It takes more
than 30 seconds to load!&lt;/p&gt;

&lt;p&gt;Instead I tried a layered approach, in which different layers for maps
of France where loaded. One for the contours, another for the data
itself and a last one for the picking / interactions.&lt;/p&gt;

&lt;p&gt;For picking we used a map in which each state has a different color,
same for the counties.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/france/counties.png&quot; alt=&quot;maps with counties colored&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When a user hovers a state or county, we can retrieve the color of
the pixel under the cursor in the picking maps, and so we get an id for
the state to retrieve information from. I explained this technique of
color picking before in examples like the &lt;a href=&quot;/blog/2012/02/27/wind-motion-patterns/&quot;&gt;wind map&lt;/a&gt; and
the &lt;a href=&quot;http://www.senchalabs.org/philogl/PhiloGL/examples/worldFlights/&quot;&gt;flight patterns visualization&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The result is a smooth interactive visualization that fully uses the
GPU to render.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Crazy Idea for Web Worker Extension</title>
   <link href="http://philogb.github.com/blog/2012/11/04/web-workers-extension"/>
   <updated>2012-11-04T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/11/04/web-workers-extension</id>
   <content type="html">
    
      &lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;This article describes an extension to &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html&quot;&gt;Web Workers&lt;/a&gt;
by enabling the use of a subset of the &lt;a href=&quot;www.khronos.org/files/opengles_shading_language.pdf&quot;&gt;Shading Language 1.0&lt;/a&gt; – as defined by the
&lt;a href=&quot;http://www.khronos.org/registry/webgl/specs/latest/&quot;&gt;WebGL&lt;/a&gt; and &lt;a href=&quot;http://www.khronos.org/opengles/&quot;&gt;OpenGL ES&lt;/a&gt; specifications –
on a Web Worker.&lt;/p&gt;

&lt;p&gt;The Shading Language is already present in web applications that use
WebGL or &lt;a href=&quot;https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html&quot;&gt;CSS Shaders&lt;/a&gt;. Web Workers are
implemented and exposed by the major browsers Opera
Software, Google Chrome, Apple Safari and Mozilla
Firefox. The idea is to combine these two things to enable Web
Workers to execute Shading Language code.&lt;/p&gt;

&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;/h2&gt;

&lt;p&gt;This would enable (depending on the inner implementation) faster code
execution, but more important graphics programmers or developers in
need for more clever idioms for mathematics or computational geometry operations
could use this language to perform these operations easily. Much of the
Web today depends on graphics, as can be seen by the numerous languages
and APIs designed to render content on the screen (HTML/CSS, WebGL, 2D
Canvas and SVG) and although JavaScript is suitable for prototyping, it
doesn’t provide features that are friendly to graphic developers
such as operator overloading, static typing, advanced built-int math and
geometry functions and matrix and vector classes.&lt;/p&gt;

&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;/h2&gt;

&lt;p&gt;The main idea of the api extension would be to define an extra &lt;code&gt;option&lt;/code&gt;
argument to the Web Worker constructor that would specify the type of
the file to be executed. By default the file type would be JavaScript:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;worker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;myworker.glsl&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;glsl&amp;#39;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then the &lt;code&gt;worker&lt;/code&gt; api would remain the same, with &lt;code&gt;onmessage&lt;/code&gt; and
&lt;code&gt;postMessage&lt;/code&gt; operations. If used with GLSL, the &lt;code&gt;postMessage&lt;/code&gt; operation would be
restricted to send &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#transferable-objects&quot;&gt;transferable objects&lt;/a&gt;, in particular &lt;a href=&quot;http://www.khronos.org/registry/typedarray/specs/latest/&quot;&gt;ArrayBuffers or TypedArrays&lt;/a&gt;. Continuing the
example we would have:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//create array of floats&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;floats&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Float32Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//send this data over transferable objects to the worker&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;floats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//add a listener to get back the data&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//print the resulting typed array&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The shader file would require a &lt;code&gt;main&lt;/code&gt; function which can have an &lt;code&gt;in&lt;/code&gt;
transferable object argument and &lt;code&gt;out&lt;/code&gt; transferable object argument. For
example, we could have inside &lt;code&gt;myworker.glsl&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;void main(in float numbersIn[3], out float numbersOut[3]) {
    numbersOut[0] = numbersIn[0] * numbersIn[0];
    numbersOut[1] = numbersIn[1] * numbersIn[1];
    numbersOut[2] = numbersIn[2] * numbersIn[2];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once &lt;code&gt;main&lt;/code&gt; returns, the &lt;code&gt;out&lt;/code&gt; parameter will be set as the &lt;code&gt;data&lt;/code&gt;
property of the event object and sent in the &lt;code&gt;onmessage&lt;/code&gt; callback.&lt;/p&gt;

&lt;h2 id=&quot;implementation-notes&quot;&gt;Implementation notes&lt;/h2&gt;

&lt;p&gt;I don’t think that in this case GLSL would be run in the GPU (that would be crazy!), but I do think that
GLSL is a language that could be safely executed or safely transpiled into any language in the ANSI C family.
As opposed to the WebCL/OpenCL 1.0 language, GLSL does not have pointers and seems safer enough that it’s
currently being used in CSS Shaders and WebGL.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Twitter's Political Engagement Map</title>
   <link href="http://philogb.github.com/blog/2012/11/01/political-engagement-map"/>
   <updated>2012-11-01T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/11/01/political-engagement-map</id>
   <content type="html">
    
      &lt;p&gt;I worked on an &lt;a href=&quot;https://election.twitter.com/map&quot;&gt;exploratory data
visualization&lt;/a&gt; at Twitter that tracks
engagement in the US for tweets from the candidates. &lt;a href=&quot;http://blog.twitter.com/2012/11/visualizing-2012-election.html&quot;&gt;You can see the
article on the Twitter blog here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/pem/1.png&quot; alt=&quot;Political Engagement Map&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There are some interesting insights from the visualization summarized in
the blog post too. For example, searching for tweets with the “coal”
keyword shows more engagement on the states that are leading producers
of coal:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/pem/2.png&quot; alt=&quot;Political Engagement Map - Coal&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Other interesting searches ares ones for &lt;a href=&quot;https://election.twitter.com/map/#t240972218933329922&amp;amp;kpell%20grant&quot;&gt;Pell Grant&lt;/a&gt; or
&lt;a href=&quot;https://election.twitter.com/map/#t245509634897633281&amp;amp;kgod&amp;amp;m4&quot;&gt;God&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also take a look at the topics that interest more a given state
by clicking on it. For example, &lt;a href=&quot;https://election.twitter.com/map/#t258345565794992128&amp;amp;sNY&amp;amp;m4&quot;&gt;here’s what we get about New York&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/pem/3.png&quot; alt=&quot;Political Engagement Map - Topics NY&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can find more insights &lt;a href=&quot;http://blog.twitter.com/2012/11/visualizing-2012-election.html&quot;&gt;on the Twitter blog&lt;/a&gt;.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Group Theory for Fun and Profit</title>
   <link href="http://philogb.github.com/blog/2012/09/20/wallpaper-groups"/>
   <updated>2012-09-20T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/09/20/wallpaper-groups</id>
   <content type="html">
    
      &lt;p&gt;&lt;img src=&quot;/blog/assets/wallpaper/wallpaper.png&quot; alt=&quot;Wallpaper group example&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Sometime earlier this year I started reading (for the third time) &lt;a href=&quot;http://www.amazon.com/Quaternions-Octonions-John-Horton-Conway/dp/1568811349&quot;&gt;Conway’s book on
quaternions and octonions&lt;/a&gt;.
I never finished reading this book the previous times because I would
get hooked with a specific topic mentioned there, do more research on
that and never actually finish the book itself.&lt;/p&gt;

&lt;p&gt;So that happened to me this time also. I started reading on symmetry
groups, or &lt;a href=&quot;http://en.wikipedia.org/wiki/Wallpaper_groups&quot;&gt;wallpaper groups&lt;/a&gt;.
Wallpaper groups are two dimensional repetitive patterns obtained by translations, rotations,
reflections and glide reflections. As shown in Conway’s book, there are
17 different possible groups:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/wallpaper/groups.png&quot; alt=&quot;Groups&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With the help of my collegue &lt;a href=&quot;http://zhangbei.github.com/&quot;&gt;Bei&lt;/a&gt; we
built a WebGL application that lets you create your own motifs and then
apply the transformations of these 17 symmetry groups on your drawing. &lt;a href=&quot;http://www.senchalabs.org/philogl/PhiloGL/examples/groups/&quot;&gt;You can access
the app here!&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here’s a quick video that shows how to use it:&lt;/p&gt;

&lt;iframe width=&quot;500&quot; height=&quot;375&quot; src=&quot;http://www.youtube.com/embed/uNbKqv2kO-Y?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;1&quot;&gt;
&lt;/iframe&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Neil Armstrong Video</title>
   <link href="http://philogb.github.com/blog/2012/08/31/neil-armstrong-video"/>
   <updated>2012-08-31T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/08/31/neil-armstrong-video</id>
   <content type="html">
    
      &lt;p&gt;&lt;img src=&quot;/blog/assets/armstrong/1.png&quot; alt=&quot;Tweets in planet&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I created a data visualization that shows the reaction on
Twitter after NASA announced that Neil Armstrong passed away on August 25th 2012.&lt;/p&gt;

&lt;p&gt;There were more than 1.6 million tweets mentioning Neil Armstrong
on a 48 hour period. Each tweet is represented by a yellow dot in this video:&lt;/p&gt;

&lt;iframe width=&quot;500&quot; height=&quot;281&quot; src=&quot;http://www.youtube.com/embed/lfND_hBL0aY?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;
&lt;/iframe&gt;

&lt;p&gt;The video team worked on this idea to create a more polished video for the
visualization that you can find in &lt;a href=&quot;http://blog.twitter.com/2012/08/remembering-first-man-on-moon_31.html&quot;&gt;Twitter’s blog&lt;/a&gt;.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Line integral convolutions</title>
   <link href="http://philogb.github.com/blog/2012/08/14/playing-with-line-integral-convolutions"/>
   <updated>2012-08-14T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/08/14/playing-with-line-integral-convolutions</id>
   <content type="html">
    
      &lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: &lt;em&gt;I implemented a nice technique to animate fluids in WebGL with
floating point textures &lt;a href=&quot;http://philogb.github.com/LIC/fluid.html&quot;&gt;that you can try here&lt;/a&gt;. The technique is
based on a very interesting paper that I describe below.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When I was a kid my physics teacher showed us this amazing
experiment where he would put a magnetic dipole inside of a box with
some sort of “iron sand” and one could see the sand taking the
shape of the vector field:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/lic/magnet.png&quot; alt=&quot;streamline magnetic field&quot; /&gt;&lt;/p&gt;

&lt;p&gt;which I always thought was similar to the curves in the sand that one
may find in a Japanese garden:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/lic/japanese-garden.jpg&quot; alt=&quot;streamline japanese garden&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There’s an interesting technique in which a vector field can be
rendered to look just like the above pictures. This technique is called
line integral convolution. I’ve been working on this and implemented a couple
of papers related to this technique in JavaScript, 2D Canvas and WebGL.&lt;/p&gt;

&lt;h2 id=&quot;lics-in-the-cpu&quot;&gt;LICs in the CPU&lt;/h2&gt;

&lt;p&gt;The first implementation I worked on is from the paper &lt;a href=&quot;http://www8.cs.umu.se/kurser/TDBD13/VT00/extra/p263-cabral.pdf&quot;&gt;Imaging Vector Fields Using Line Integral Convolution&lt;/a&gt;
by &lt;em&gt;Brian Cabral&lt;/em&gt; and &lt;em&gt;Leith (Casey) Leedom&lt;/em&gt;. This technique takes a
vector field and a white noise image, and convolves them in order to
get something very similar to the images above. For example, here’s a
rendering of a (-y, x) field with this technique.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/lic/FastLIC.png&quot; alt=&quot;rendering LIC on the CPU&quot; /&gt;&lt;/p&gt;

&lt;p&gt;One drawback is that the algorithm’s complexity is relative to the
number of pixels in the image, since for a given subset of those pixels
a line integral convolution has to be calculated on the streamline where
this pixel is included.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/lic/stream1.png&quot; alt=&quot;streamline&quot; /&gt;&lt;/p&gt;

&lt;p&gt;While the rendering shows the streamlines of the vector field, it
doesn’t really show the direction of the vectors themselves. I worked on
another technique based on the paper &lt;a href=&quot;http://graphics.cs.ucdavis.edu/~lfeng/sig/tensor/papers/Animating%20Flow%20Fields%20Rendering%20of%20Oriented%20Line%20Integral%20Convolution.pdf&quot;&gt;Animating Flowfields: Rendering of Oriented Line Integral Convolution&lt;/a&gt; that uses a filter to create
oriented line integral convolutions. This is combined with other type of
textures (not white noise) and creates something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/lic/OLIC.png&quot; alt=&quot;rendering OLIC on the CPU&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Both techniques use the CPU and due to their complexity they are pretty slow to render.
You can find my 2D Canvas implementations &lt;a href=&quot;http://philogb.github.com/LIC/lic.html&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://philogb.github.com/LIC/olic.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While IMO these techniques don’t make much sense on the CPU (a few
particles and a blend operation would suffice to create the OLIC effect), there are
really interesting variations of these techniques that can be used on
the GPU and allow for many more interesting effects and animations.&lt;/p&gt;

&lt;h2 id=&quot;lics-on-the-gpu&quot;&gt;LICs on the GPU&lt;/h2&gt;

&lt;p&gt;While looking for more techniques to render LICs I came across this mind
blowing paper called &lt;a href=&quot;http://www.cs.ucdavis.edu/~ma/ECS276/readings/Jobard_TVCG02.pdf&quot;&gt;Lagrangian-Eulerian Advection of Noise and Dye Textures
for Unsteady Flow Visualization&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Instead of calculating for each pixel the line integral convolution,
this technique takes the background image (white noise image) and
advects it with some control points. This advected image is then blended
with the original image to create a third image that has a very similar
result to the techniques mentioned above.&lt;/p&gt;

&lt;p&gt;There are many considerations to take into account when implementing
LICs via texture advection like coordinate and noise initialization,
coordinate integration, noise advection, edge treatment, noise
injection, coordinate reinitialization, noise blending, post-processing,
etc. but the algorithm is performed in the GPU and thus is much much
faster than the previous ones. I created a small example of an animated
rendering of the same vector field with PhiloGL &lt;a href=&quot;http://philogb.github.com/LIC/vortex.html&quot;&gt;that you can find
here&lt;/a&gt;. The demo uses WebGL and floating point textures. I add a video
below in case your browser doesn’t support this:&lt;/p&gt;

&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/hx2mzR6cf5s?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;
&lt;/iframe&gt;

&lt;p&gt;Another good thing is that I was finally able to simulate the magnetic
field experiment I mentioned at the beginning of this article. &lt;a href=&quot;http://philogb.github.com/LIC/dipole.html&quot;&gt;You can
find the example here&lt;/a&gt;. I also add the video in case your browser
doesn’t support the features:&lt;/p&gt;

&lt;iframe width=&quot;480&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/gNkoerEpods?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;
&lt;/iframe&gt;

&lt;h2 id=&quot;fluid-simulation&quot;&gt;Fluid simulation&lt;/h2&gt;

&lt;p&gt;The paper also describes a technique to do dye texture advection. This
is pretty neat to simulate fluids. I created a cool demo showing this.
&lt;a href=&quot;http://philogb.github.com/LIC/fluid.html&quot;&gt;You can find the demo here&lt;/a&gt;. I also add a video of the demo below:&lt;/p&gt;

&lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/v83CrHQHK70?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;
&lt;/iframe&gt;

&lt;p&gt;All three papers have been implemented in 2D Canvas and WebGL and &lt;a href=&quot;http://github.com/philogb/LIC/&quot;&gt;you
can find the code here&lt;/a&gt;. These techniques are pretty neat to render and
animate vector fields. I hope you find them useful!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Euro 2012 Streamgraph B-sides</title>
   <link href="http://philogb.github.com/blog/2012/07/02/euro2012-streamgraph-bsides"/>
   <updated>2012-07-02T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/07/02/euro2012-streamgraph-bsides</id>
   <content type="html">
    
      &lt;p&gt;I worked on a data visualization for the 2012 European football
champioship at Twitter that you can find
&lt;a href=&quot;https://euro2012.twitter.com&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/euro2012/stream1.png&quot; alt=&quot;streamgraph&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The visualization shows day-by-day data aggregated by country but also
shows tweets per minute for each match of the tournament.&lt;/p&gt;

&lt;p&gt;I made some tweaks to the &lt;a href=&quot;http://thejit.org/&quot;&gt;JavaScript InfoVis
Toolkit&lt;/a&gt; to create the StreamGraph visualization.
During the process I made some mistakes that ended up in curious
pseudo-visualizations like this ScribbleGraph:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/euro2012/stream2.png&quot; alt=&quot;scribblegraph&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Or like this ScatteredFeatherGraph:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/euro2012/stream3.png&quot; alt=&quot;feathergraph&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Or even this Windows solitaire tribute graph:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/euro2012/stream4.png&quot; alt=&quot;solitairegraph&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’m thinking on writing a paper about these (not).&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Next Talks</title>
   <link href="http://philogb.github.com/blog/2012/04/16/talks"/>
   <updated>2012-04-16T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/04/16/talks</id>
   <content type="html">
    
      &lt;p&gt;I’ll be giving a couple of talks related to data visualization,
JavaScript and Web standards in the next couple of weeks:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Apr. 20 - Tech Talk on Data Visualization and Web Standards at
&lt;a href=&quot;http://stanfordacm.com/&quot;&gt;Stanford ACM&lt;/a&gt;. It’s free and open to the
public so if you’re around please come and say hi!&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;May 19  - I’ll be at &lt;a href=&quot;http://jsconf.com.ar&quot;&gt;JSConf Argentina&lt;/a&gt; with a
more WebGL / JavaScript focused talk. I’m really excited to be
presenting in my country again, last time I presented it was at
Microsoft for &lt;a href=&quot;http://barcamp.com.ar/&quot;&gt;BarCamp BA&lt;/a&gt; like six years ago!&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope to see you there!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Wind Motion Patterns</title>
   <link href="http://philogb.github.com/blog/2012/02/27/wind-motion-patterns"/>
   <updated>2012-02-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2012/02/27/wind-motion-patterns</id>
   <content type="html">
    
      &lt;p&gt;I’ve been working on &lt;a href=&quot;http://www.senchalabs.org/philogl/PhiloGL/examples/winds/&quot;&gt;a WebGL data visualization of wind motion
patterns&lt;/a&gt; 
for a 72 hour period in the United States.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/winds/1.png&quot; alt=&quot;PhiloGL Wind Motion Patterns&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Gathering the data from the &lt;a href=&quot;http://www.nws.noaa.gov/climate/&quot;&gt;National Weather Service&lt;/a&gt; 
was pretty interesting, I didn’t know USA had &lt;a href=&quot;http://weather.rap.ucar.edu/surface/stations.txt&quot;&gt;so many
weather stations&lt;/a&gt;! The
visualization shows wind direction encoded in line angles, wind speed encoded
in line lengths and disk radius, and temperature encoded in hue. All
this for about 1200 weather stations across the country.&lt;/p&gt;

&lt;p&gt;You can switch between different visual markers from the top menu, also
play the wind motion for the 72 hours or select a specific time from the
timeline below the graphic.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/winds/3.png&quot; alt=&quot;Markers&quot; /&gt;&lt;/p&gt;

&lt;p&gt;One interesting thing I found with this visualization is what appeared
to be an outlier in the data, around mount Washington:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/winds/2.png&quot; alt=&quot;Mount Washington&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The data is seems actually correct after I took a look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mount_Washington_(New_Hampshire)&quot;&gt;Wikipedia
article for Mount Washington&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For 76 years, a weather observatory on the summit held the record for the highest wind gust directly measured at the Earth’s surface, 231 mph (372 km/h) (or 103 m/s)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;With this example I also released a new version &lt;a href=&quot;http://senchalabs.org/philogl&quot;&gt;of the
framework&lt;/a&gt;.&lt;/p&gt;

    
   </content>
 </entry>
 
 <entry>
   <title>WebGL Camp</title>
   <link href="http://philogb.github.com/blog/2011/12/09/webglcamp"/>
   <updated>2011-12-09T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/12/09/webglcamp</id>
   <content type="html">
    
      &lt;p&gt;I generally don’t do write-ups of events I go to (now that I actually
check my blog I’ve never made one) but I had such a great time at &lt;a href=&quot;http://www.webglcamp.com/wiki/index.php?title=Main_Page&quot;&gt;WebGL
Camp&lt;/a&gt; 
today and learnt so many new things that I think that (especially
for the sake of my bad long term memory) I’ll do a write-up about my
experience at WebGL Camp #4 at Mozilla HQs.&lt;/p&gt;

&lt;p&gt;This is not going to be a chronological review but more like stuff I
learnt about state-of-the-art WebGL, and the incredible community
that we have here in the Bay Area around this technology.&lt;/p&gt;

&lt;p&gt;On the things I learnt there’s that WebGLCamp this year gathered people
that make great products and apps using WebGL; it also
gathers people who like to write great WebGL frameworks either for games, art or data
visualization and it also gathers people who define and participate directly on the
making of the actual WebGL API. All of these people are together in the same
place, discussing about these three things, and since this is a
small group of very knowledgeable people, the outcome of this event is
extremely valuable for the people there.&lt;/p&gt;

&lt;p&gt;Just take a look at the &lt;a href=&quot;http://www.webglcamp.com/wiki/index.php?title=Agenda4&quot;&gt;agenda&lt;/a&gt;. In one day you will see how a
&lt;a href=&quot;http://www.myrobotnation.com/&quot;&gt;profitable business like My Robot Nation&lt;/a&gt; uses WebGL as a core
component of their product, you will also find out the technical
aspects of &lt;a href=&quot;http://www.chromeexperiments.com/detail/mapsgl/&quot;&gt;implementing MapsGL&lt;/a&gt; in one
of the most visited applications on the Web; you will also hear about
how WebGL is an integral part for &lt;a href=&quot;http://www.scer.rpi.edu/cemsim/&quot;&gt;modeling and simulation&lt;/a&gt; in
medical training applications and finally how the Department of
Defense uses WebGL in their real time graphic simulation
applications. Oh and yes, &lt;a href=&quot;http://usa.autodesk.com/&quot;&gt;Autodesk&lt;/a&gt; also showcased their new WebGL
applications.&lt;/p&gt;

&lt;p&gt;So much changed since last year at WebGL Camp. While WebGL was still “alpha” and people
built ideas on top of the thought that in the future it’ll become
a solid and robust foundation, WebGL is now massively used in products/businesses that span to
any possible field you could imagine!&lt;/p&gt;

&lt;p&gt;Another very interesting aspect on this is that not only cool ideas
around businesses show up, there’s a lot of discussion on technical
stuff, on three different levels I would say: the standards body, the
framework API designer/developer group and finally the consumers of
these frameworks/APIs that create compelling demos, products and apps.&lt;/p&gt;

&lt;p&gt;Just to name a few frameworks, &lt;a href=&quot;http://aerotwist.com/&quot;&gt;Paul Lewis&lt;/a&gt;
presented about &lt;a href=&quot;http://aerotwist.com/a3/&quot;&gt;A3&lt;/a&gt; and &lt;a href=&quot;http://www.everyday3d.com/&quot;&gt;Bartek Drozdz&lt;/a&gt; 
presented about &lt;a href=&quot;http://www.everyday3d.com/j3d/&quot;&gt;J3D&lt;/a&gt;. Oh, and the
Department of Defense said they were using &lt;a href=&quot;http://www.glge.org/&quot;&gt;GLGE&lt;/a&gt; for their
applications. There was also a very interesting presentation of an Audio/Kinect/WebGL
mashup that used &lt;a href=&quot;http://www.cubicvr.org/&quot;&gt;CubicVR.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://glslunit.appspot.com/&quot;&gt;GLSLUnit&lt;/a&gt; 
was also presented by Google devs and a very interesting idea of using
it to feature detect that a visitor to your site has an adecuate graphics
card to run your WebGL application was suggested.&lt;/p&gt;

&lt;p&gt;Another very interesting idea from the J3D framework was to design a
special templating language that would render to proper glsl code to
reuse shaders properly. Although J3D’s glsl language is pretty simple (only has a few
special annotations), I would love to see something more like the &lt;a href=&quot;https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs&quot;&gt;Django
templates&lt;/a&gt; 
in which inheritance, filters and include statements could be added
in an easy way to reuse shaders.&lt;/p&gt;

&lt;p&gt;Also, I really enjoyed &lt;a href=&quot;http://blog.tojicode.com/&quot;&gt;Brandon Jones&lt;/a&gt; talk
on texture (up and down)loading performance.&lt;/p&gt;

&lt;p&gt;But what about me? I presented about &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; last year at &lt;a href=&quot;http://www.youtube.com/watch?v=aWTVbS8ruzw&quot;&gt;Google HQ’s for
WebGLCamp #3&lt;/a&gt;, so this time it was all about meeting the people and not having 
any pressure on presenting anything :)&lt;/p&gt;

&lt;p&gt;I also met today a couple of developers for &lt;a href=&quot;http://one.laptop.org/&quot;&gt;OLPC&lt;/a&gt; that have 
been using and contributing code back to &lt;a href=&quot;https://github.com/philogb/v8-gl&quot;&gt;V8-GL&lt;/a&gt; for OpenGL/WebGL integration in 
the OLPC project. Can you believe it? V8-GL helps OLPC devs!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/webglcamp/1.png&quot; alt=&quot;WebGL Camp image get involved&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Finally there’s also the people who will talk to you about the future of the
APIs you’re using. People working on the standard, who will actually listen to your
experiences using the WebGL API and probably at the
next iteration of WebGL Camp they will present some standard improvement that will include
at least part of your ideas in it. And I’m not lying about this. You can
witness that in &lt;a href=&quot;http://www.youtube.com/watch?v=aWTVbS8ruzw#t=19m40s&quot;&gt;the WebGLCamp #3 video&lt;/a&gt; (right towards the end) I was
complaining about the fact that simple JSON was not enough as an
interprocess/worker format, that it would be nice to be able to move
&lt;a href=&quot;http://www.khronos.org/registry/typedarray/specs/latest/&quot;&gt;typed arrays&lt;/a&gt; from one place to the other. 
This change was being added as I spoke and this year happened the exact same thing again. I
talked two minutes to &lt;a href=&quot;http://www.linkedin.com/profile/view?id=5648748&quot;&gt;Ken Russell&lt;/a&gt; from Google about 
the &lt;a href=&quot;http://www.w3.org/TR/html5/common-dom-interfaces.html#safe-passing-of-structured-data&quot;&gt;structured cloning algorithm&lt;/a&gt; used for worker communication and
how typed arrays still had to be cloned from here to there and he told
me that &lt;a href=&quot;http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast&quot;&gt;transferable objects&lt;/a&gt; were 
just added to Chrome. Yay!&lt;/p&gt;

&lt;p&gt;I really enjoyed this event and hope to see the community again for the
next WebGL Camp. I had a great time and I think that there aren’t so
many ocasions in which you can gather a group of people like this 
that have so many different backgrounds and ideas on such different
topics related to WebGL like standards, products and frameworks.&lt;/p&gt;

&lt;p&gt;A big props to &lt;a href=&quot;http://mozilla.org/&quot;&gt;Mozilla&lt;/a&gt; and Henrik Bennetsen from &lt;a href=&quot;http://www.katalabs.com/&quot;&gt;Katalabs&lt;/a&gt; for
organising the event! Until the next WebGL Camp!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/webglcamp/2.png&quot; alt=&quot;WebGL Camp image&quot; /&gt;&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>PhiloGL 1.4.0</title>
   <link href="http://philogb.github.com/blog/2011/10/14/philogl-1.4.0"/>
   <updated>2011-10-14T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/10/14/philogl-1.4.0</id>
   <content type="html">
    
      &lt;p&gt;I’m very excited to announce that &lt;a href=&quot;http://senchalabs.github.com/philogl&quot;&gt;PhiloGL&lt;/a&gt; version 1.4.0 has been
released!&lt;/p&gt;

&lt;p&gt;This release focuses on two main things: a better picking algorithm
that caches scene rendering and a simple image post-processing chain to add some nice fragment
shader effects when rendering a scene.&lt;/p&gt;

&lt;p&gt;Both these features are implemented in a revamped &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights2/&quot;&gt;World Flights&lt;/a&gt;
example I just released, so let’s take a look at how these things are
implemented in the example.&lt;/p&gt;

&lt;h3 id=&quot;world-flights-revisited&quot;&gt;World Flights (revisited)&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/worldflights2.png&quot; alt=&quot;World Flights Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights2/&quot;&gt;World Flights&lt;/a&gt;
 is a data visualization that shows flying routes information for various airlines 
around the world. For 200 airlines, more than 57.000 flights and 6.000 destinations are displayed. 
You can find more information on the example &lt;a href=&quot;http://philogb.github.com/world-flights/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights2/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;image-post-processing&quot;&gt;Image post processing&lt;/h3&gt;

&lt;p&gt;There’s a nice neon effect in the airline routes as well as in the
cities displayed in this example. This is done by rendering two
different scenes; one with a “black” planet:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/worldflights/1.png&quot; alt=&quot;World Flights Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;…and another one with the current texture for the planet:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/worldflights/2.png&quot; alt=&quot;World Flights Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here’s the code that renders them to a &lt;code&gt;world&lt;/code&gt; and &lt;code&gt;world2&lt;/code&gt; FBOs 
and their associated &lt;code&gt;world-texture&lt;/code&gt; and &lt;code&gt;world2-texture&lt;/code&gt; textures:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setFrameBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;earth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;gl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clearOpt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;gl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//do not use a texture but paint it black&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;earth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setUniform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;renderType&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;scene&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;renderToTexture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setFrameBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setFrameBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world2&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;earth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;gl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clear&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;clearOpt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;gl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;viewport&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//use a regular planet texture&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;earth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setUniform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;renderType&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;scene&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;renderToTexture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world2&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setFrameBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world2&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;These two textures are then combined to generate the screen image:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;Media&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fromTexture&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world-texture&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;world2-texture&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;toScreen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;glow&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;glow&lt;/code&gt; fragment shader will take these two generated textures,
create a bloom filter for the one with the black planet, and add it to the
one that has the regular textured planet and provide a result for that:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ifdef&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;GL_ES&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;precision&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;highp&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;endif&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; 
&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT_SQ&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;64.0&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;varying&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vec2&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vTexCoord1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;uniform&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasTexture1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;uniform&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sampler2D&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sampler1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;uniform&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasTexture2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;uniform&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sampler2D&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sampler2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;vec4&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fragmentColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vec4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kr&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kr&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hasTexture1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasTexture2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//Add glow&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;dx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;512.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;dy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;512.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;fragmentColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;texture2D&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sampler1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vTexCoord1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vTexCoord1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;BLUR_LIMIT_SQ&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//Add real image&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fragmentColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;texture2D&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sampler2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vec2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vTexCoord1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vTexCoord1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;gl_FragColor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;vec4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fragmentColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rgb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is not the best way to make a bloom filter since it’s &lt;code&gt;O(N * N)&lt;/code&gt;, but
it could be easily transformed into a two-pass bloom filter with the
&lt;code&gt;postProcess&lt;/code&gt; chaining API:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//Make a horizontal pass&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;Media&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fromTexture&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;world2-texture&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;toFrameBuffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;bloom1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;bloom&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;uniforms&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s1&quot;&gt;&amp;#39;orientation&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//Make a vertical pass on the result&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fromTexture&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;bloom1-texture&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;toFrameBuffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;bloom2&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;bloom&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;uniforms&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;s1&quot;&gt;&amp;#39;orientation&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//Combine the result to the original texture&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postProcess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fromTexture&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;world-texture&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;bloom2-texture&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;toScreen&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;glow&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The result is:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/worldflights/3.png&quot; alt=&quot;World Flights Image&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;lazy-picking&quot;&gt;Lazy Picking&lt;/h3&gt;

&lt;p&gt;The World Flights example displays around 6.000 cities served by the
airlines. If you hover those cities a tooltip will display showing
information about the city:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://philogb.github.com/blog/assets/img/worldflights.picking.png&quot; alt=&quot;World Flights Picking&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As mentioned in older posts, I implemented the color picking algorithm
which assigns a different “picking color” to each city, then renders all
6000 cities to a texture with those picking colors and retrieves the
color of the pixel pointed by the mouse. From that color it’s easy to
identify which city has been hovered.&lt;/p&gt;

&lt;p&gt;The current algorithm though renders this alternate scene each time the
mouse moves over the canvas. A better approach would be to only take a snapshot of
the scene when it’s updated in some way (the planet is dragged and
dropped, a new airline is selected and the earth moves, etc.).&lt;/p&gt;

&lt;p&gt;This can now be done by setting &lt;code&gt;lazyPicking&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; and then using a
&lt;code&gt;scene.resetPicking()&lt;/code&gt; method when the time is right to take a new
snapshot. For all other cases a cache of the capture stored in a typed
array will be used improving the performance of the algorithm:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//enable picking and lazy picking&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;picking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;lazyPicking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//remove the center origin option for picking&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;centerOrigin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;onDragStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//do stuff...&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;onDragMove&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//do stuff to rotate the earth...&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;onDragEnd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//reset the picking by removing the cached image capture&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;scene&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resetPicking&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//more code here...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can find more information on both these features in the &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/media.html&quot;&gt;Media&lt;/a&gt; and
&lt;a href=&quot;http://senchalabs.github.com/philogl/doc/scene.html#Scene:resetPicking&quot;&gt;Scene&lt;/a&gt; APIs.&lt;/p&gt;

&lt;h3 id=&quot;thanks&quot;&gt;Thanks&lt;/h3&gt;

&lt;p&gt;Thanks to &lt;a href=&quot;http://uxnerd.com/&quot;&gt;Luz Caballero&lt;/a&gt; for helping me out with the
design of World Flights!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Upcoming Talks</title>
   <link href="http://philogb.github.com/blog/2011/09/06/upcoming-talks"/>
   <updated>2011-09-06T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/09/06/upcoming-talks</id>
   <content type="html">
    
      &lt;p&gt;I thought I’d put my schedule for the upcoming talks here so I can
convince whoever is reading this blog to come and meet me at some of
these events! :)&lt;/p&gt;

&lt;p&gt;I’ll be speaking at:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.meetup.com/VisualizeMyData/events/32382432/&quot;&gt;Data Visualization Group in Bay Area&lt;/a&gt; 
on New Tools for Visualization in JavaScript.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.meetup.com/The-Visual-ly-Data-Visualization-Meetup/events/30601541/&quot;&gt;Visual.ly Data Visualization Meetup&lt;/a&gt; 
on The Ingredients of a Great Data Visualization.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://functionsource.com/post/next-tech-talks-october-19-at-mozilla&quot;&gt;Tech Talks at Mozilla&lt;/a&gt; 
on PhiloGL and its API.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://secure.lenos.com/lenos/sencha/SenchaCon2011/sessions.htm&quot;&gt;SenchaCon 2011 in Austin, TX&lt;/a&gt; 
on WebGL fundamentals.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope to see you there!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>PhiloGL 1.3.0 released</title>
   <link href="http://philogb.github.com/blog/2011/08/07/philogl-1.3.0-released"/>
   <updated>2011-08-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/08/07/philogl-1.3.0-released</id>
   <content type="html">
    
      &lt;p&gt;Just a quick post to announce that &lt;a href=&quot;http://senchalabs.github.com/philogl&quot;&gt;PhiloGL&lt;/a&gt; version 1.3.0 has been
released!&lt;/p&gt;

&lt;p&gt;I’ve been working hard on this new release, which is mainly focused on
many performance improvements and the ability to have reflection and
refraction available in the default shaders.&lt;/p&gt;

&lt;h3 id=&quot;performance-improvements&quot;&gt;Performance Improvements&lt;/h3&gt;

&lt;p&gt;Performance improvements happened on three different places of the
framework:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Math functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Math functions for Vector and Matrix operations are faster than ever. I
changed the inner implementation of the math methods to use typed arrays
whenever possible. The result is an amazing performance improvement that
can be seen on the WebGL Matrix Benchmarks for
&lt;a href=&quot;/blog/assets/matrix-bench/safari.png&quot;&gt;Safari&lt;/a&gt;,
&lt;a href=&quot;/blog/assets/matrix-bench/firefox.png&quot;&gt;Firefox&lt;/a&gt;
and &lt;a href=&quot;/blog/assets/matrix-bench/chrome.png&quot;&gt;Chrome&lt;/a&gt; (these tests were made on a 13-inch MacBook Pro Core 2
Duo).&lt;/p&gt;

&lt;p&gt;The API for the math module has changed a little bit. I explain most
of the API changes &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/math.html&quot;&gt;in the documentation&lt;/a&gt; (look for &lt;em&gt;new from version 1.3&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deep typed array integration in O3D.Models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I changed how attributes where handled by models in the &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/o3d.html&quot;&gt;O3D module&lt;/a&gt;,
integrating typed arrays very deep and reusing them whenever possible.
In order to do this I created getters and setters for most of the model
attributes like &lt;code&gt;vertices&lt;/code&gt;, &lt;code&gt;normals&lt;/code&gt;, &lt;code&gt;color&lt;/code&gt;, etc. so you can feed to 
those properties either a typed array or a simple array of values and
they will be converted internally into a typed array. The typed array will
be reused whenever possible. When accessing some of these properties,
you will always get a typed array too; even if you didn’t assign one to
that property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Micro Optimizations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Did you know that using &lt;code&gt;forEach&lt;/code&gt; instead of a for-loop can be up to
&lt;a href=&quot;http://jsperf.com/for-vs-foreach/9&quot;&gt;50% slower in most browsers?&lt;/a&gt;. Some
micro-optimizations take care of changing &lt;code&gt;forEach&lt;/code&gt; calls into regular
for-loops in the main rendering loop code.&lt;/p&gt;

&lt;h3 id=&quot;reflection--refraction&quot;&gt;Reflection / Refraction&lt;/h3&gt;

&lt;p&gt;I added the ability to have reflection and refraction in O3D. There are
two new properties in &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/o3d.html#O3D:Model:constructor&quot;&gt;O3D.Model&lt;/a&gt;: 
&lt;code&gt;reflection&lt;/code&gt; and &lt;code&gt;refraction&lt;/code&gt; which indicate the reflection and
refraction index correspondingly.&lt;/p&gt;

&lt;p&gt;I created two simple demos to demonstrate some of the new features in the
framework.&lt;/p&gt;

&lt;p&gt;The first one uses the marching cubes algorithm and web-workers as a
divide and conquer technique to render reflective metaballs. I also use
cube map textures and the new reflection index. You can access the
example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/metaballs/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/metaballs.png&quot; alt=&quot;Reflective Metaballs image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The second example displays an interesting technique to render
quaternion julia sets. Quaternion julia sets are four dimensional fractals that are
created by using the same formula than the one used with two dimensional
fractals, &lt;code&gt;Zn+1 = Zn + C&lt;/code&gt;, but instead of using complex numbers as &lt;code&gt;Z&lt;/code&gt; we
use hyper-complex numbers called &lt;a href=&quot;http://en.wikipedia.org/wiki/Quaternion&quot;&gt;quaternions&lt;/a&gt;. 
Once we obtain the four-dimensional shape, what we do is project
it into a three dimensional space to get “the shadow” of the four
dimensional object. A very interesting article into how this works and
also how this can be fully calculated via a fragment shader can be found
&lt;a href=&quot;http://www.devmaster.net/forums/showthread.php?t=4448&quot;&gt;here&lt;/a&gt;. I really
enjoyed reading that article and recommend it to anyone interested in
math :)&lt;/p&gt;

&lt;p&gt;Anyway, you can access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/quaternion/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/quaternion.png&quot; alt=&quot;Quaternion Julia Set image&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;siggraph-2011-webgl-bof&quot;&gt;SIGGRAPH 2011 WebGL BOF&lt;/h3&gt;

&lt;p&gt;Last but not least, I’ll be making a presentation on PhiloGL at &lt;a href=&quot;http://www.siggraph.org/s2011/&quot;&gt;SIGGRAPH
2011&lt;/a&gt; in Vancouver on August 10th. If you’re there, come say hello!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>PhiloGL 1.2.0 released</title>
   <link href="http://philogb.github.com/blog/2011/06/06/philogl-1.2.0-released"/>
   <updated>2011-06-06T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/06/06/philogl-1.2.0-released</id>
   <content type="html">
    
      &lt;p&gt;I’m very excited to announce that &lt;a href=&quot;http://senchalabs.github.com/philogl&quot;&gt;PhiloGL&lt;/a&gt; version 1.2.0 has been
released!&lt;/p&gt;

&lt;p&gt;This release adds a lot of goodies to the Framework, like a much better
design for multiple program management, a better design for picking
enabling us to have finer grain picking, a brand new &lt;code&gt;Quat&lt;/code&gt;
class for quaternions and a couple of new primitives and improvements in O3D. All this
with some &lt;a href=&quot;http://senchalabs.github.com/philogl/docs.html&quot;&gt;updated documentation&lt;/a&gt; and 
a new &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights/&quot;&gt;demo&lt;/a&gt;!&lt;/p&gt;

&lt;h3 id=&quot;multiple-program-management&quot;&gt;Multiple program management&lt;/h3&gt;

&lt;p&gt;We always had the possibility to create multiple programs and use them
in a PhiloGL application (see &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/lessons/13/&quot;&gt;lesson 13&lt;/a&gt;), but in
a more object-oriented model of applications we might want to assign
programs to objects themselves than manually managing programs here and
there.&lt;/p&gt;

&lt;p&gt;You can define multiple programs right in the main &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/index.html#PhiloGL:constructor&quot;&gt;PhiloGL constructor
function&lt;/a&gt; as an array of program 
configurations with a specified id:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;PhiloGL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;program1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;uris&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;vs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;./vertex1.vs.glsl&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;./fragment1.fs.glsl&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;program2&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;uris&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;vs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;./vertex2.vs.glsl&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;fs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;./fragment2.fs.glsl&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}]&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//other options here...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then you can set a program id to any model you like by instanciating a
model with:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;O3D&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;program&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;program1&amp;#39;&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//other options here...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;and then each model will have a program assigned and used before being
rendered. Easy!&lt;/p&gt;

&lt;h3 id=&quot;finer-grain-picking&quot;&gt;Finer grain picking&lt;/h3&gt;

&lt;p&gt;The picking algorithm used in PhiloGL is a color picking
algorithm. Each model is assigned a different color and the scene is 
rendered to a texture. Then, the pixel pointed by the mouse
position is retrieved from the texture and the color of that pixel is 
used to identify the model.&lt;/p&gt;

&lt;p&gt;Sometimes we want to know more than just which object has been picked. For
example, we might want to know which face of that object has been
picked. In that case the [O3D]((http://senchalabs.github.com/philogl/doc/o3d.html) constructor options
&lt;code&gt;pickingColors&lt;/code&gt; and &lt;code&gt;pick&lt;/code&gt; are useful. By defining your own set of per
vertex colors and a method that given a pixel returns special
information on what part of the object has been retrieved, then it is
possible to have finer grain picking. For more information about how to 
use this you can take a look at the World Flights example or go to the
&lt;a href=&quot;http://groups.google.com/group/philogl&quot;&gt;Google group of the framework&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;more-stuff&quot;&gt;More stuff&lt;/h3&gt;

&lt;p&gt;A [Quat]((http://senchalabs.github.com/philogl/doc/math.html#Quat) class has been added and also other interesting 
options in &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/o3d.html#O3D:Model:constructor&quot;&gt;O3D.Model&lt;/a&gt; constructors have been included, 
like an &lt;code&gt;attributes&lt;/code&gt; object to define buffers and attributes per model.&lt;/p&gt;

&lt;h3 id=&quot;world-flights&quot;&gt;World Flights&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights/&quot;&gt;World Flights&lt;/a&gt; is a data visualization powered by PhiloGL that 
displays the routes of all major airlines in the globe. Red markers
indicate cities served by airports, and blue curves show the routes each
airline makes and their destinations. You can drag and drop the globe,
and also select new airlines from the controls on the right. 
The link to the application is &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/worldFlights/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/worldflights.png&quot; alt=&quot;World Flights image&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;webgl-camp-3-at-google-hq&quot;&gt;WebGL camp #3 at Google HQ&lt;/h3&gt;

&lt;p&gt;Last but not least, I’ll be making a presentation on
PhiloGL at &lt;a href=&quot;http://webglcamp.com/&quot;&gt;WebGL camp&lt;/a&gt; this Friday. Regirstration is still open, so I hope to see
you there!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>PhiloGL 1.1.1 and JavaScript InfoVis Toolkit 2.0.1 released</title>
   <link href="http://philogb.github.com/blog/2011/05/05/philogl-1.1.1-javascript-infovis-toolkit-2.0.1"/>
   <updated>2011-05-05T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/05/05/philogl-1.1.1-javascript-infovis-toolkit-2.0.1</id>
   <content type="html">
    
      &lt;p&gt;Just a quick post to let you know about two patch releases for the
&lt;a href=&quot;http://thejit.org/&quot;&gt;JavaScript InfoVis Toolkit&lt;/a&gt; and &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt;
respectively.&lt;/p&gt;

&lt;h3 id=&quot;javascript-infovis-toolkit-201&quot;&gt;JavaScript InfoVis Toolkit 2.0.1&lt;/h3&gt;

&lt;p&gt;The new patch release for the &lt;a href=&quot;http://thejit.org/&quot;&gt;JavaScript InfoVis Toolkit&lt;/a&gt; includes many
bug fixes (that you can find &lt;a href=&quot;https://github.com/philogb/jit/commits/master&quot;&gt;here&lt;/a&gt;) and new 
configuration options for Area, Pie and Bar charts.&lt;/p&gt;

&lt;p&gt;As I mentioned before I’m very excited that the project has been selected for the &lt;a href=&quot;http://code.google.com/soc/&quot;&gt;Google Summer of
Code 2011 program&lt;/a&gt;, and that two student applications have been already accepted. 
The selected students will work on 
making the toolkit better by implementing new visualizations like
Voronoi TreeMaps, Scatter Charts, Line Charts and other work related to code design and refactoring. Expect some 
interesting updates on the project in the next few months!&lt;/p&gt;

&lt;h3 id=&quot;philogl-111&quot;&gt;PhiloGL 1.1.1&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; version 1.1.1 has been
released with a bunch of bug fixes and improvements. Multiple point
lights (up to 50) are supported now. You can check a complete 
changelog &lt;a href=&quot;https://github.com/senchalabs/philogl/commit/b74faf71a663f4be14618ff4721a66d8ca8b7af3&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Our entry for Google's Data Visualization Challenge</title>
   <link href="http://philogb.github.com/blog/2011/03/27/our-entry-for-the-google-dataviz-challenge"/>
   <updated>2011-03-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/03/27/our-entry-for-the-google-dataviz-challenge</id>
   <content type="html">
    
      &lt;p&gt;&lt;em&gt;Launch the Visualization by clicking &lt;a href=&quot;/blog/assets/dataviz/index.html&quot;&gt;here&lt;/a&gt;!&lt;/em&gt;
(browsers supported are the latest of Google Chrome, Firefox, Opera and
Safari -not IE).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://uxnerd.com/&quot;&gt;Luz Caballero&lt;/a&gt; and I have been working together 
for a couple of weeks to create an interesting visualization for 
&lt;a href=&quot;http://datavizchallenge.org/&quot;&gt;Google’s Data Visualization Challenge&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Every year, Americans fill out income tax forms and make a payment to the IRS. 
Where does it all go? Using data provided by WhatWePayFor.com, we created a data visualization 
that will make it easier to understand how the government spends our tax money.&lt;/p&gt;

&lt;h2 id=&quot;the-visualization&quot;&gt;The Visualization&lt;/h2&gt;

&lt;p&gt;We want to help people grasp what these millions and billions mean…
43.03M on Federal aid to highways… is that too much or too little?
The Federal Budget is traditionally divided in 20 
&lt;a href=&quot;http://en.wikipedia.org/wiki/United_States_budget_process#Structure_of_the_budget&quot;&gt;“functions”&lt;/a&gt;
that, under names like “National Defense” or “Energy,” show the purposes to which money is 
allocated. Our goal is to show not only &lt;strong&gt;how much money is spent for each function on a given 
year&lt;/strong&gt;, but also &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;How does that compare to other functions?&lt;/strong&gt; What are our priorities? 
Would cutting &lt;em&gt;this&lt;/em&gt; give us money enough to fund &lt;em&gt;that&lt;/em&gt;?&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;How has the amount spent on each function changed over the years?&lt;/strong&gt; Hopefully this should give 
us all an idea on what has traditionally been considered normal highway spending ;)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Where does the money allocated to each function finally go?&lt;/strong&gt; (Because we would never have 
guessed that we would find a USD 150M bailout under “Other advancement of commerce”!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This visualization is made of two components. First, a tree layout shows, for each given year,
how the budget (blue) is divided on each function (green), subfunction (yellow), and “account” 
(the most granular subdivision accounted for in the budget, which gives an idea of the 
use to which the money is put) (red):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/dataviz/icicle.png&quot; alt=&quot;Icicle Layout&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The hegiht of each node/section in the tree is proportional to the amount of the
budget spent on that function, subfunction or “account”. &lt;strong&gt;You can click on the nodes
to navigate and filter functions and subfunctions&lt;/strong&gt;. To go back you can right-click or 
click in the back arrow on the left of the visualization.&lt;/p&gt;

&lt;p&gt;The second component of the application is a timeline that puts the amounts you are 
visualizing in the tree in a temporal context, showing the evolution of that particular 
spending category through time. &lt;strong&gt;Click on the bars representing the different years to navigate 
through time&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/dataviz/timeline.png&quot; alt=&quot;Timeline&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We wanted to allow our users to compare today’s 
spending to the 80s’ without artifacts caused by inflation, and changes in population and GDP.
This is why our visualization shows inflation-adjusted USD, gives you the the option to see 
spending in USD, in USD per capita, or as a percentage of the time’s GDP. Plus, we wanted to give 
our users a good shot at pinpointing if/when spending changes are a 
consequence of government policy or of the economic climate. This is why you can overlay 
indicators like debt, GDP, inflation and yr/yr population change, to give you an idea of how they 
affect and are influenced by spending trends.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/dataviz/timeline-debt.png&quot; alt=&quot;Timeline&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;interaction&quot;&gt;Interaction&lt;/h2&gt;

&lt;p&gt;What makes this application most interesting is the interaction between the components, which 
are tightly coupled.&lt;/p&gt;

&lt;p&gt;When a function is selected, the timeline will adapt to show the budget
spending trend for that particular function over the years.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/dataviz/timeline2.png&quot; alt=&quot;Interacting with the Icicle tree&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When clicking on a timeline element, the tree will animate to show
how the budget is spent on each function, subfunction and account, for the
selected year. &lt;/p&gt;

&lt;p&gt;If you are interested in comparing how the budget changed between two different
moments in time, there is an option to transition between years using colors, red and green,
to highlight a decrease or increase of total budget spending for each item.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/dataviz/icicle2.png&quot; alt=&quot;Interacting with the Icicle tree&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;demo-video&quot;&gt;Demo Video&lt;/h2&gt;

&lt;p&gt;We created a video that shows how to navigate and filter data and some interesting finds we made
using our visualization. &lt;a href=&quot;http://www.youtube.com/watch?v=WUtwn7wB9Hs&amp;amp;hd=1&quot;&gt;Click here&lt;/a&gt; to see the video in HD.&lt;/p&gt;

&lt;object width=&quot;480&quot; height=&quot;390&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/WUtwn7wB9Hs?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;embed src=&quot;http://www.youtube.com/v/WUtwn7wB9Hs?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;390&quot; /&gt;&lt;/object&gt;

&lt;h2 id=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;/h2&gt;

&lt;p&gt;We would like to thank the people who gave us feedback on this
visualization and helped us to improve it. Thanks for your help!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/blog/assets/dataviz/&quot;&gt;Click here&lt;/a&gt; to access the visualization!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Google Summer of Code and NASA</title>
   <link href="http://philogb.github.com/blog/2011/03/22/google-summer-of-code-and-nasa"/>
   <updated>2011-03-22T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/03/22/google-summer-of-code-and-nasa</id>
   <content type="html">
    
      &lt;h2 id=&quot;the-javascript-infovis-toolkit-selected-for-google-soc-2011&quot;&gt;The JavaScript InfoVis Toolkit selected for Google SoC 2011&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;http://thejit.org/&quot;&gt;JavaScript InfoVis Toolkit&lt;/a&gt; has been accepted for the &lt;a href=&quot;http://www.google-melange.com/gsoc/homepage/google/gsoc2011&quot;&gt;Google Summer of Code 2011&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;An &lt;a href=&quot;http://thejit.org/ideas/&quot;&gt;ideas page&lt;/a&gt; with some interesting tasks to complete for the project has been posted, and also we already got some awesome feedback from highly motivated students wanting to participate. The feedback has been great so far!&lt;/p&gt;

&lt;p&gt;Being part of the Google Summer of Code 2011 is great not only for the JavaScript InfoVis Toolkit as a project, but also for our mentoring organization, &lt;a href=&quot;http://sencha.com/company/&quot;&gt;Sencha Labs&lt;/a&gt;, to connect with students to promote Open Source activities and help build a new generation of JavaScript developers.&lt;/p&gt;

&lt;p&gt;If you like interesting challenges with JavaScript and visualization don’t hesitate to contact me at nicolas at sencha dot com.&lt;/p&gt;

&lt;h2 id=&quot;nasa&quot;&gt;NASA&lt;/h2&gt;

&lt;p&gt;I have more exciting news: I’ve been invited by &lt;a href=&quot;http://www.nasa.gov/&quot;&gt;NASA&lt;/a&gt; to the first NASA Open Source Summit!&lt;/p&gt;

&lt;p&gt;The summit will bring together 60 leaders from the open source community, NASA developers, and NASA policymakers to lay the foundation for improving how NASA develops, releases, and uses open source software.&lt;/p&gt;

&lt;p&gt;I’m really looking forward to meet everyone there!&lt;/p&gt;

    
   </content>
 </entry>
 
 <entry>
   <title>PhiloGL version 1.1.0</title>
   <link href="http://philogb.github.com/blog/2011/03/11/philogl-1.1.0"/>
   <updated>2011-03-11T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/03/11/philogl-1.1.0</id>
   <content type="html">
    
      &lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; version 1.1.0 has been
released! This version includes a couple of new features like improved
WebGL detection, linear fog, picking, added primitives like
Cylinder and Cone and some bug fixes with directional lighting.&lt;/p&gt;

&lt;h2 id=&quot;better-haswebgl&quot;&gt;Better hasWebGL&lt;/h2&gt;

&lt;p&gt;Until now WebGL was currently detected via the existence of the
&lt;code&gt;WebGLRenderingContext&lt;/code&gt; object in the &lt;code&gt;window&lt;/code&gt; object. This check is good to
see if the browser we’re using provides access to the WebGL API, but
doesn’t really check whether the hardware is capable to render WebGL - or
at least create a WebGL rendering context.&lt;/p&gt;

&lt;p&gt;In other words, we could have Firefox 4 installed on a ventilation system
and get &lt;code&gt;true&lt;/code&gt; for the check of &lt;code&gt;!!window.WebGLRenderingContext&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In order to go a little further on the check I transformed &lt;code&gt;hasWebGL&lt;/code&gt; into a static
method that checks whether the &lt;code&gt;WebGLRenderingContext&lt;/code&gt; exists but also
checks whether the 3D context can be created. This is a noticeable
step forward to check for WebGL capable machines. 
It’s worth a small API change (from static property to static
method). You can check the documentation for this method
&lt;a href=&quot;http://senchalabs.github.com/philogl/doc/core.html#PhiloGL:hasWebGL&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;picking&quot;&gt;Picking&lt;/h2&gt;

&lt;p&gt;Picking is the ability to interact with 3D objects in
the scene via events like &lt;em&gt;mouseenter&lt;/em&gt; or &lt;em&gt;click&lt;/em&gt;. Picking can be used by setting &lt;code&gt;pick&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; 
in the events configuration for the &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/core.html#PhiloGL:constructor&quot;&gt;PhiloGL constructor&lt;/a&gt;. 
Internally the &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/event.html&quot;&gt;Event&lt;/a&gt; object uses
the &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/scene.html#Scene:pick&quot;&gt;Scene pick method&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//Create App&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;PhiloGL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;surface-explorer-canvas&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;events&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//enable picking&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;picking&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//now the model is returned as the target of&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//the event.&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;onMouseEnter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;uniforms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;colorUfm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;onMouseLeave&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;uniforms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;colorUfm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;onError&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;There was an error while creating the WebGL application&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;onLoad&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;cm&quot;&gt;/* do stuff with app */&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id=&quot;fog&quot;&gt;Fog&lt;/h2&gt;

&lt;p&gt;Linear fog was added in version 1.0.2, but only now it’s official. Fog
can be selected as a scene &lt;em&gt;effect&lt;/em&gt; in the configuration object. You can find
more information about how to configure linear fog &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/scene.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;primitives&quot;&gt;Primitives&lt;/h2&gt;

&lt;p&gt;I added Cone and Cylinder as new primitives. You can find documentation
about them &lt;a href=&quot;http://senchalabs.github.com/philogl/doc/o3d.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;mini-demo&quot;&gt;Mini Demo&lt;/h2&gt;

&lt;p&gt;I made a video featuring fog, picking and our new primitives. In this particular example I only set cones and spheres as
pickable objects.&lt;/p&gt;

&lt;object width=&quot;480&quot; height=&quot;390&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/_7Aeo70AEMU?fs=1&amp;amp;hl=en_US&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;embed src=&quot;http://www.youtube.com/v/_7Aeo70AEMU?fs=1&amp;amp;hl=en_US&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;390&quot; /&gt;&lt;/object&gt;

&lt;p&gt;I hope you enjoy the new features :) You can &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;download the library
here&lt;/a&gt;.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>The White House uses the JavaScript InfoVis Toolkit</title>
   <link href="http://philogb.github.com/blog/2011/03/03/javascript-infovis-toolkit-featured-white-house"/>
   <updated>2011-03-03T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/03/03/javascript-infovis-toolkit-featured-white-house</id>
   <content type="html">
    
      &lt;p&gt;I was surprised when I entered the main &lt;a href=&quot;http://whitehouse.gov/&quot;&gt;White House website&lt;/a&gt; the other day to find out 
that this logo was showing a very familiar treemap.
&lt;img src=&quot;/blog/assets/WhiteHouse/budget1.jpg&quot; alt=&quot;White House treemap logo&quot; /&gt; &lt;/p&gt;

&lt;p&gt;Clicking on the logo took me to another page where this treemap was featured. The application / visualization showing the 2012 budget 
is made with a TreeMap, in JavaScript, using the &lt;a href=&quot;http://thejit.org/&quot;&gt;JavaScript InfoVis Toolkit&lt;/a&gt;. Click &lt;a href=&quot;http://www.whitehouse.gov/winning-the-future/interactive-budget&quot;&gt;on this link&lt;/a&gt; to go to the White House page that features the visualization.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/WhiteHouse/budget2.jpg&quot; alt=&quot;White House treemap logo&quot; /&gt; &lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>PhiloGL</title>
   <link href="http://philogb.github.com/blog/2011/02/22/philogl-webgl-framework-data-visualization-creative-coding-game-development"/>
   <updated>2011-02-22T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2011/02/22/philogl-webgl-framework-data-visualization-creative-coding-game-development</id>
   <content type="html">
    
      &lt;p&gt;For some time now I’ve been working on a new project built around WebGL that today I’m very proud to release: &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; is a WebGL Framework for advanced Data Visualization, Creative Coding and Game Development.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; uses cutting edge technology and JavaScript idioms and good practices to deliver elegantly 
coded WebGL applications that are focused on performance. &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; also provides a rich module system 
covering Program and Shader management, IO, XHR, JSONP, Web Worker management, Effects and Tweening, and much more.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; is Open Source Software, licensed under the MIT license and owned by the &lt;a href=&quot;http://senchalabs.org/&quot;&gt;SenchaLabs&lt;/a&gt; foundation.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; has a complete &lt;a href=&quot;http://senchalabs.github.com/philogl/docs.html&quot;&gt;API documentation&lt;/a&gt; with a detailed description 
of all the modules and class methods. Another very cool thing is that all &lt;a href=&quot;http://learningwebgl.com/blog/?page_id=1217&quot;&gt;Learning WebGL lessons&lt;/a&gt; have 
been ported into &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; code so that you can easily 
learn &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt;, WebGL or both at the same time. 
You can find a list of the ported Learning WebGL lessons &lt;a href=&quot;http://senchalabs.github.com/philogl/lessons.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In order to show how &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; applications are made I created three featured projects that deal with Data Visualization 
in different aspects. In order to see these examples you’ll need the latest &lt;a href=&quot;http://google.com/chrome/&quot;&gt;Google Chrome&lt;/a&gt; and/or 
&lt;a href=&quot;http://www.mozilla.com/en-US/firefox/beta/&quot;&gt;Firefox 4&lt;/a&gt;. If you don’t have a WebGL capable browser then you’ll see a video showcasing the application.&lt;/p&gt;

&lt;h2 id=&quot;visualizing-temperature-anomalies&quot;&gt;Visualizing Temperature Anomalies&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/temperatureAnomalies/&quot;&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/tanomalies.png&quot; alt=&quot;Temperature Anomalies&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;&quot;&gt;NASA&lt;/a&gt; collects year by year data about temperature changes around the globe. This information has been collected since 1880 and tracks temperature anomalies (changes) 
in different points of the earth as a 2D heatmap. By loading these images into textures and then mapping them into a 3D histogram we are able to track the temperature 
changes around the globe interactively. Smooth animations between date ranges enable us to spot the overall differences in temperature across the years. Can you guess 
what the temperature changes will be for the next decade? Access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/temperatureAnomalies/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;real-time-3d-color-histogram-analysis&quot;&gt;Real time 3D color Histogram Analysis&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/histogram/&quot;&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/histogram.png&quot; alt=&quot;3D color Histogram Analysis&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Color decomposition on &lt;a href=&quot;http://en.wikipedia.org/wiki/RGB_color_model#Geometric_representation&quot;&gt;RGB&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot;&gt;other color schemes&lt;/a&gt; takes a 
3D form. In order to show the color decomposition of an image each dot on a 3D color histogram is assigned a different diameter. The following example renders fine grain 
and precise color decomposition schemes of each frame of a video in real time. Notice how color varies on each take, and feel free to change the color scheme or pause the 
video to have a closer look at the color decomposition. You can interact with the visualization by using drag and drop and zooming in/out with your mouse wheel. 
Access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/histogram/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;explore-3d-parametric-surfaces&quot;&gt;Explore 3D Parametric Surfaces&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/explorer/&quot;&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://senchalabs.github.com/philogl/img/marquee/explorer.png&quot; alt=&quot;3D Parametric Surfaces&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Exploring 3D surfaces is a fun way to learn about geometry, physical phenomena or even terrain modeling. Parametric surfaces are surfaces that also change their shape 
with an extra variable: &lt;em&gt;time&lt;/em&gt;. Explore 3D surfaces by using drag and drop and the mouse wheel to zoom in/out. You can enable the &lt;em&gt;t&lt;/em&gt; parameter (by clicking on the 
checkbox) and hit play to see it move. There are three predefined surfaces for you to explore or modify. 
Access the example &lt;a href=&quot;http://senchalabs.github.com/philogl/PhiloGL/examples/explorer/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;go-get-it&quot;&gt;Go get it!&lt;/h2&gt;

&lt;p&gt;I hope these examples show what you can do with the framework and interest you enough to explore the code. 
I’ve had a lot of fun building and using &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;PhiloGL&lt;/a&gt; and I can’t wait to see what you’re capable of doing with it, &lt;a href=&quot;http://senchalabs.github.com/philogl/&quot;&gt;you can download it here&lt;/a&gt;!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Our entry for the Mozilla Open Data Visualization Challenge</title>
   <link href="http://philogb.github.com/blog/2010/12/14/our-entry-for-the-mozilla-open-data-visualization-challenge"/>
   <updated>2010-12-14T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/12/14/our-entry-for-the-mozilla-open-data-visualization-challenge</id>
   <content type="html">
    
      &lt;p&gt;&lt;em&gt;Launch the Visualization by clicking &lt;a href=&quot;/blog/assets/modvc/pilot/pilot.html&quot;&gt;here&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://uxnerd.com/&quot;&gt;Maria Luz Caballero&lt;/a&gt; and me have been working together for a couple of weeks to create an interesting visualization for the &lt;a href=&quot;http://design-challenge.mozillalabs.com/open-data/OpenDataCompetition/&quot;&gt;Mozilla Open Data Visualization Challenge&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Mozilla is releasing a new version of Firefox, version 4. This new version introduces a new UI and they have been monitoring how users interact with 
the different UI components of Firefox 4. They gathered some interesting information about how UI components are accessed and other elements taken by a survey to the Firefox users describe their expertise level, age, place where Firefox is used, etc.&lt;/p&gt;

&lt;p&gt;We decided that this information could be visualized as a TreeMap in which the area of each node is proportional to the number of times a UI component has been accessed. For example in this 
image we can see that around 20% of UI interactions happen in the Navigation Toolbar, and it’s possible to compare the area of this rectangle to others to give us a clue of the overall interactions:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/modvc/tm1.png&quot; alt=&quot;Navigation Toolbar access tooltip image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Each node also has a color that spans from red to blue, indicating an average of the expertise level of the user interacting with this component.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/modvc/tm2.png&quot; alt=&quot;Color span gradient&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It’s interesting to note how some components are more often accessed by expert users than by beginners and viceversa. However since we provide an &lt;em&gt;average&lt;/em&gt; we lack 
the information about the &lt;em&gt;real distribution&lt;/em&gt; of user skills accessing the component. In order to avoid misleading results, when drilling down the TreeMap 
PieCharts indicate the real user skill distribution for each UI component interaction.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/modvc/tm3.png&quot; alt=&quot;PieCharts as nodes for skill distribution&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What I believe is by far the most interesting aspect of this visualization is the fact of using the ordinal and nominal information provided by the user survey 
to provide dynamic filtering for the TreeMap. Dynamic filtering (or morphing) enables an easy comparison between different categories of users on how they interact with 
these components. The filter panel we provide is shown below:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/modvc/tm4.png&quot; alt=&quot;Dynamic Filtering Panel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you’re interested in taking a look at the visualization and playing with it please go to our &lt;a href=&quot;/blog/assets/modvc/pilot/pilot.html&quot;&gt;entry&lt;/a&gt;. Browsers supported are Firefox 4, Opera 10.6+ and the latest of the Webkit family.&lt;/p&gt;

    
   </content>
 </entry>
 
 <entry>
   <title>Animating Isosurfaces with WebGL and Workers</title>
   <link href="http://philogb.github.com/blog/2010/12/10/animating-isosurfaces-with-webgl-and-workers"/>
   <updated>2010-12-10T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/12/10/animating-isosurfaces-with-webgl-and-workers</id>
   <content type="html">
    
      &lt;p&gt;&lt;em&gt;If you just want to take a look at the JavaScript demos with WebGL and Workers you can &lt;a href=&quot;#result&quot;&gt;click here&lt;/a&gt; or just go towards the bottom of the page&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For some time now I’ve been considering rendering isosurfaces with JavaScript. Isosurfaces are 3D surfaces that can be defined with implicit 3D equations.&lt;/p&gt;

&lt;p&gt;While “regular” 3D surfaces are defined as:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;isosurfaces can also be represented as:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Some shapes that can be represented as implicit equations and that can’t be rendered just as “regular” 3D surfaces include the Sphere. While with regular surfaces we can
have either the top or bottom part of a Sphere:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// -&amp;gt;&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+|-&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//either + or -&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Implicit 3D equations can define the &lt;em&gt;whole&lt;/em&gt; shape:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// -&amp;gt;&lt;/span&gt;

  &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Implicit 3D equations can be used to &lt;a href=&quot;http://en.wikipedia.org/wiki/Isosurface&quot;&gt;model organs after taking a computed tomography&lt;/a&gt;, or to model other physical phenomena (like fluids),
or even to do old-style OpenGL animated demos like &lt;a href=&quot;http://en.wikipedia.org/wiki/Metaballs&quot;&gt;Metaballs&lt;/a&gt; :P&lt;/p&gt;

&lt;h2 id=&quot;how-do-i-render-an-isosurface&quot;&gt;How do I render an Isosurface?&lt;/h2&gt;

&lt;p&gt;There’s this very interesting &lt;a href=&quot;http://en.wikipedia.org/wiki/Marching_cubes&quot;&gt;Marching Cubes&lt;/a&gt; algorithm that describes how to create primitives that can be later sent to
an OpenGL renderer in order to plot Isosurfaces (the primitives are triangles in this case). The main principle of the algorithm is to create some sort of differentials by
dividing the space in which the surface is defined into “very small” cubes within the main volume where the visualization is contained and study how the surface intersects
these small cubes (when it does). We can identify in this way 256 different cases in which the surface can “cut” these small cubes:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/marching-cubes2.png&quot; alt=&quot;Marching Cubes Intersections&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For each of these cases we can obtain the group of triangles corresponding to the part of the surface that intersected the small cube. That way we can recreate the surface to be rendered.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/marching-cubes.gif&quot; alt=&quot;Marching Cubes Example&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;approaching-the-problem-with-webgl&quot;&gt;Approaching the Problem with WebGL&lt;/h2&gt;

&lt;p&gt;The power of WebGL lies in being able to compute these algorithms in some shader language. In the WebGL programable pipeline we
can write shader code at two different stages: when processing a vertex (vertex shader) or when doing per pixel manipulation (fragment shader). Unfortunately this means that
we are forced to send to the vertex shader an array of predefined vertices to render the surface before computing anything on the GPU. There is no way to send any other type of
information through the shader that once arrived to the vertex shader would allow it to “emit” new vertices.&lt;/p&gt;

&lt;p&gt;For example, one approach I would have enjoyed doing is to send the grid details to the shaders and then calculate the triangles and emit new vertices to render the scene
from the shader. However I haven’t found a way to do this with WebGL because there’s no &lt;a href=&quot;http://en.wikipedia.org/wiki/Geometry_shader&quot;&gt;geometry shader&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So we’re stuck on the client-side to calculate all vertices and then send the information to the vertex shader with WebGL. This proves to be a little bit slow.&lt;/p&gt;

&lt;h2 id=&quot;web-workers-to-the-rescue&quot;&gt;Web Workers to the rescue!&lt;/h2&gt;

&lt;p&gt;The divide &amp;amp; conquer nature of the algorithm made me think that I could divide the computing space into an &lt;a href=&quot;http://en.wikipedia.org/wiki/Octree&quot;&gt;octree&lt;/a&gt;
and parallelize each octant with a &lt;a href=&quot;https://developer.mozilla.org/En/Using_web_workers&quot;&gt;Worker&lt;/a&gt;. A worker is a JavaScript API that provides asynchronous threads of execution.
One can post messages to the workers and add &lt;em&gt;onmessage&lt;/em&gt; listeners to them to do something in particular when they finish the computation or they send us some message. Workers can call
other workers and also one can create multiple workers out of the same code. For more information about Workers read the link above ;).&lt;/p&gt;

&lt;p&gt;So now what I needed is something like a &lt;em&gt;WorkerGroup&lt;/em&gt; that would create a certain number of workers and map different configurations for each of them, and then reduce all
workers responses into a single “merged” result of vertices to send to the shaders.&lt;/p&gt;

&lt;p&gt;A way to implement the WorkerGroup would be:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//Create an array of workers&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;WorkerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fileName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fileName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;WorkerGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//create a configuration array to post to each worker&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//when reduce is called&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;configs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;configs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//run all workers with their proper configuration and&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;//define a group-callback to merge the results&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;opt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;opt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reduceFn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;configs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;acum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;opt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;initialValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;nx&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
         &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;acum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;acum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
         &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;opt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onComplete&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
         &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ln&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ln&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;postMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;configs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The performance improvements of using Workers are very noticeable. The algorithm remains on the client-side though, so if you want fast performance
I’d recommend you to use some webkit nightly.&lt;/p&gt;

&lt;h2 id=&quot;the-result&quot;&gt;The Result&lt;/h2&gt;

&lt;p&gt;I made two demos, one is a Metaballs demo and the other one is an Isosurface visualizer. I really like the second example because you can specify your own
formulas. There are predefined formulas like a Torus or Gyroid. To see these demos you’ll need a WebGL enabled browser, I do encourage you to install a webkit
nightly for this.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/blog/assets/marching-cubes/1/index.html&quot;&gt;Click here&lt;/a&gt; to take a look at the Metaballs demo, or you can watch a video here:&lt;/p&gt;

&lt;object width=&quot;500&quot; height=&quot;463&quot;&gt;&lt;param name=&quot;allowfullscreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://vimeo.com/moogaloop.swf?clip_id=17422087&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=1&amp;amp;color=00ADEF&amp;amp;fullscreen=1&amp;amp;autoplay=0&amp;amp;loop=0&quot; /&gt;&lt;embed src=&quot;http://vimeo.com/moogaloop.swf?clip_id=17422087&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=1&amp;amp;color=00ADEF&amp;amp;fullscreen=1&amp;amp;autoplay=0&amp;amp;loop=0&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; allowscriptaccess=&quot;always&quot; width=&quot;500&quot; height=&quot;463&quot; /&gt;&lt;/object&gt;

&lt;p&gt;&lt;a href=&quot;http://vimeo.com/17422087&quot;&gt;Marching Cubes + WebGL + Workers = Fun&lt;/a&gt; from &lt;a href=&quot;http://vimeo.com/user3026195&quot;&gt;Nicolas&lt;/a&gt; on &lt;a href=&quot;http://vimeo.com&quot;&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the Isosurface generator you can &lt;a href=&quot;/blog/assets/marching-cubes/2/index.html&quot;&gt;click here&lt;/a&gt; or take a look at the video below:&lt;/p&gt;

&lt;object width=&quot;500&quot; height=&quot;300&quot;&gt;&lt;param name=&quot;allowfullscreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://vimeo.com/moogaloop.swf?clip_id=17514838&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=1&amp;amp;color=00ADEF&amp;amp;fullscreen=1&amp;amp;autoplay=0&amp;amp;loop=0&quot; /&gt;&lt;embed src=&quot;http://vimeo.com/moogaloop.swf?clip_id=17514838&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=1&amp;amp;color=00ADEF&amp;amp;fullscreen=1&amp;amp;autoplay=0&amp;amp;loop=0&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot; allowscriptaccess=&quot;always&quot; width=&quot;500&quot; height=&quot;300&quot; /&gt;&lt;/object&gt;

&lt;p&gt;&lt;a href=&quot;http://vimeo.com/17514838&quot;&gt;Awesome Equations&lt;/a&gt; from &lt;a href=&quot;http://vimeo.com/user3026195&quot;&gt;Nicolas&lt;/a&gt; on &lt;a href=&quot;http://vimeo.com&quot;&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;github&quot;&gt;GitHub&lt;/h2&gt;

&lt;p&gt;I’m pushing all experiments from now on to a &lt;a href=&quot;http://github.com/philogb/Playground&quot;&gt;Playground&lt;/a&gt; repo for you to check the code or improve. There’s also some 2D Canvas, WebGL and Scala code from
&lt;a href=&quot;/2010/09/04/three-ways-to-make-3d/&quot;&gt;Three ways to make 3D&lt;/a&gt; there.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>My Talk at YOW! Developer Conferences</title>
   <link href="http://philogb.github.com/blog/2010/12/09/my-talk-at-yow-developer-conferences"/>
   <updated>2010-12-09T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/12/09/my-talk-at-yow-developer-conferences</id>
   <content type="html">
    
      &lt;p&gt;Last week I was in Melbourne and Brisbane, Australia, to speak about interactive data visualizations with JavaScript at the &lt;a href=&quot;http://yowconference.com.au/&quot;&gt;YOW! Developer Conferences&lt;/a&gt;.
My presentation was a one hour talk in which I covered some InfoVis Theory basics (some ideas from Jacques Bertin’s Semiology of Graphics); also I spoke about
the main things the JavaScript InfoVis Toolkit has to offer and finally I presented some future work involving WebGL, web workers and some cool algorithms
I’ll be presenting in a future post.&lt;/p&gt;

&lt;p&gt;I want to thank Dave Thomas and the entire team for giving me the opportunity to speak in Brisbane and Melbourne. I had the honour
to speak right before Ben Fry’s &lt;em&gt;Computational Design&lt;/em&gt; talk and Dan Ingalls &lt;em&gt;40 years of fun with computers&lt;/em&gt; - both amazing presentations.&lt;/p&gt;

&lt;p&gt;You can find the slides for my presentation here, the audience went wild with my presentation in Brisbane!&lt;/p&gt;

&lt;div style=&quot;width:425px&quot; id=&quot;__ss_6094862&quot;&gt;&lt;strong style=&quot;display:block;margin:12px 0 4px&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/philogb/creating-interactive-data-visualizations-for-the-web-yow-developer-conferences-australia&quot; title=&quot;Creating Interactive Data Visualizations for the Web - YOW! Developer Conferences Australia&quot;&gt;Creating Interactive Data Visualizations for the Web - YOW! Developer Conferences Australia&lt;/a&gt;&lt;/strong&gt;&lt;object id=&quot;__sse6094862&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=yow-key-101209163254-phpapp02&amp;amp;stripped_title=creating-interactive-data-visualizations-for-the-web-yow-developer-conferences-australia&amp;amp;userName=philogb&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot; /&gt;&lt;embed name=&quot;__sse6094862&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=yow-key-101209163254-phpapp02&amp;amp;stripped_title=creating-interactive-data-visualizations-for-the-web-yow-developer-conferences-australia&amp;amp;userName=philogb&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot; /&gt;&lt;/object&gt;&lt;div style=&quot;padding:5px 0 12px&quot;&gt;View more &lt;a href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a href=&quot;http://www.slideshare.net/philogb&quot;&gt;philogb&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;One of the highlights of YOW! for me was to see &lt;a href=&quot;http://en.wikipedia.org/wiki/Dan_Ingalls&quot;&gt;Dan Ingalls&lt;/a&gt;, father of five generations of Smalltalk, winner of two ACM awards and now working with cutting-edge
web technology as SAP fellow introduce bindings for the JavaScript InfoVis Toolkit in the &lt;a href=&quot;http://www.lively-kernel.org/&quot;&gt;lively-kernel&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/blog/assets/daningalls.png&quot; alt=&quot;Dan Ingalls answering questions about the lively kernel with an InfoVis page at the end of his talk&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Being at YOW! Developer Conferences was a great experience.&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Sencha Acquires the JavaScript InfoVis Toolkit</title>
   <link href="http://philogb.github.com/blog/2010/11/06/sencha-acquires-the-javascript-infovis-toolkit"/>
   <updated>2010-11-06T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/11/06/sencha-acquires-the-javascript-infovis-toolkit</id>
   <content type="html">
    
      &lt;p&gt;&lt;img alt=&quot;Sencha Logo&quot; src=&quot;/blog/assets/sencha-logo.png&quot; style=&quot;float: left;&quot; /&gt; 
&lt;a href=&quot;http://sencha.com&quot;&gt;Sencha Inc.&lt;/a&gt;, 
&lt;a href=&quot;http://www.crunchbase.com/company/sencha&quot;&gt;a company that focuses on client-side technologies&lt;/a&gt; 
 acquired this Friday the &lt;a href=&quot;http://thejit.org&quot;&gt;JavaScript InfoVis Toolkit&lt;/a&gt;!&lt;/p&gt;

&lt;h2 id=&quot;what-does-it-mean&quot;&gt;What does it mean?&lt;/h2&gt;

&lt;p&gt;Sencha now owns the toolkit. Following the &lt;a href=&quot;http://www.sencha.com/company/&quot;&gt;Sencha Labs&lt;/a&gt; philosophy, the project will remain with an 
Open Source license (BSD), and will be part of the Sencha Labs foundation. This means that someone from Sencha will take some time to maintain and still develop the toolkit 
from now on. That person can be me, but I also encourage the Sencha Team to take a closer look at &lt;a href=&quot;http://thejit.org/&quot;&gt;the project&lt;/a&gt;, there are many cool concepts in there that 
even trascend the fact that it’s done in JavaScript, and I would love to get some help on the development of the toolkit. Oh, and yes I’m looking at &lt;em&gt;you&lt;/em&gt; too reader, the 
project has been up for more than two years and you still haven’t contributed? &lt;em&gt;Now&lt;/em&gt; is the time!&lt;/p&gt;

&lt;h2 id=&quot;what-does-it-mean-for-me&quot;&gt;What does it mean… for me?&lt;/h2&gt;

&lt;p&gt;I started this project all by myself three years ago. I still remember I was playing around with Hyperbolic Geometry when 
&lt;a href=&quot;http://ajaxian.com/archives/the-javascript-hyperbolic-browser&quot;&gt;the experiment was featured for the first time in Ajaxian&lt;/a&gt;. 
My intention at first was far from building an Open Source project or gathering a small community of people interested in it, it 
was just about learning Data Visualization. After taking a look at &lt;a href=&quot;http://video.google.com/videoplay?docid=-6229232330597040086#&quot;&gt;Tamara Munzner’s Google Tech Talk&lt;/a&gt;, 
I was amazed by this field and tried to learn all I could about state of the art infovis. &lt;/p&gt;

&lt;p&gt;Then I moved to France to work for &lt;a href=&quot;http://exalead.com&quot;&gt;Exalead&lt;/a&gt;. I was primarily working with the Java stack on enterprise products (not related to infovis).
Then I would go home and spend more time learning infovis and putting into 
practice the things I learnt by hacking. &lt;/p&gt;

&lt;p&gt;One of the things I found interesting about infovis papers is that they generally provide an overview of some visualization technique, 
they provide a user study to show how the visual encodings presented are better in some situations, but there is little concrete talk about the implementation itself. Of course, 
the papers are about Data Visualization, not Computer Graphics. We’re not supposed to be reading pseudo-code, but instead how a visualization provides new insights on data. 
That “lack of information” about a concrete implementation was very interesting to me at first: each visualization became a technical challenge. 
With the time I got to learn something very interesting though. The &lt;em&gt;real challenge&lt;/em&gt; lies in the creativity required to invent a visualization that 
actually helps the user and increases his/her overall productivity when browsing some dataset.&lt;/p&gt;

&lt;p&gt;At first the toolkit was… WYSIWYG: I was just experimenting with infovis and since I was building everything from scratch design errors showed up. There 
were some early adopters though, like &lt;a href=&quot;http://www.opencrx.org/index.html&quot;&gt;OpenCRX&lt;/a&gt; that included the toolkit as part of their mobile application. With time the toolkit 
got much better, and people from &lt;a href=&quot;http://googlewavedev.blogspot.com/2010/07/wave-visualizer-turning-trees-into.html&quot;&gt;Google&lt;/a&gt;, &lt;a href=&quot;http://www.mozilla.org/community/&quot;&gt;Mozilla&lt;/a&gt;, 
&lt;a href=&quot;http://www.guardian.co.uk/news/datablog/2010/jun/14/coins-data-results-10-things#infovis&quot;&gt;The Guardian&lt;/a&gt;, &lt;a href=&quot;http://root.cern.ch/drupal/content/documentation&quot;&gt;CERN&lt;/a&gt;,
&lt;a href=&quot;http://www.ubs.com/&quot;&gt;UBS&lt;/a&gt;, &lt;a href=&quot;http://www.platform.com/&quot;&gt;Platform Computing&lt;/a&gt; and more started using it.&lt;/p&gt;

&lt;p&gt;Along with &lt;a href=&quot;http://vis.stanford.edu/protovis/&quot;&gt;Protovis&lt;/a&gt;, I believe that the &lt;a href=&quot;http://thejit.org/&quot;&gt;JavaScript InfoVis Toolkit&lt;/a&gt; became the most robust solution to provide Web based interactive Data Visualizations.&lt;/p&gt;

&lt;p&gt;Thanks to the toolkit I got the chance to meet the InfoVis community in Paris by speaking at the &lt;a href=&quot;http://www.lri.fr/~chevalie/seminarhcivisu/home.php?n=Main.SeminarNicoGarcia&quot;&gt;Parisian Seminar on InfoVis and HCI&lt;/a&gt;, and to present the toolkit 
 at &lt;a href=&quot;http://jsconf.eu/2010/speaker/creating_interactive_data_visu.html&quot;&gt;JSConf&lt;/a&gt; in Berlin. I also began working on building visualizations at &lt;a href=&quot;http://labs.exalead.com/&quot;&gt;Exalead Labs&lt;/a&gt;, and 
the toolkit was also one of the reasons I moved from France to California to work for &lt;a href=&quot;http://sencha.com/&quot;&gt;Sencha&lt;/a&gt;. 
Also I’ll be presenting the toolkit at the &lt;a href=&quot;http://www.yowconference.com.au/&quot;&gt;YOW! Developer Conferences&lt;/a&gt; in Australia this year.&lt;/p&gt;

&lt;p&gt;Within this three years I also learnt how to create, license, develop and maintain an Open Source project and its community by &lt;a href=&quot;http://thejit.org/&quot;&gt;hosting the project&lt;/a&gt;, 
accepting collaborations through &lt;a href=&quot;https://github.com/philogb/jit&quot;&gt;GitHub&lt;/a&gt;, answering questions at the &lt;a href=&quot;http://groups.google.com/group/javascript-information-visualization-toolkit&quot;&gt;Google Group&lt;/a&gt;, etc.
 This might seem silly to some of you, but maintaining an Open Source project requires some hard work and dedication.&lt;/p&gt;

&lt;p&gt;The project has reached a maturity I’m very proud of. And there are still much things to work on. Exploring new visualization techniques and robust WebGL support are just 
a few things that come to my mind. &lt;/p&gt;

    
   </content>
 </entry>
 
 <entry>
   <title>Analyzing JavaScript Class Patterns Performance</title>
   <link href="http://philogb.github.com/blog/2010/10/10/javascript-class-performance"/>
   <updated>2010-10-10T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/10/10/javascript-class-performance</id>
   <content type="html">
    
      &lt;p&gt;For a while now I’ve been considering different JavaScript class patterns and their performance when initializing and calling methods
from them. Depending on the use-case some class patterns can show considerable performance improvements over the typical pseudo-classical patterns.
In some cases, the use of closures and private member initializers in function constructors, as opposed to &lt;a href=&quot;https://developer.mozilla.org/en/JavaScript/Guide/Closures#Performance_considerations&quot;&gt;what’s stated by the MDC&lt;/a&gt;, can also show performance
improvements over classical approaches.&lt;/p&gt;

&lt;p&gt;JavaScript class performance can be analyzed by altering two variables: the &lt;em&gt;JavaScript class&lt;/em&gt; can have public/private properties and/or
public/private methods. On the other hand, &lt;em&gt;code performance&lt;/em&gt; can be measured on &lt;em&gt;class definition&lt;/em&gt;, &lt;em&gt;class constructors&lt;/em&gt;,
or &lt;em&gt;instance methods&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I’ll just state the conclusion before making the analysis: there’s not a unique class pattern that will make your code faster in all cases. Most of the time
it just depends on your use-case. In most cases people try to delegate all computations at &lt;em&gt;class definition&lt;/em&gt;, since this generally happens only once. When this is
not possible there’s a tradeoff between having computations in the &lt;em&gt;class constructor&lt;/em&gt; or performing these computations when a &lt;em&gt;method is called&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The premise for this analysis is that the extra-computations can’t be avoided, and their complexity can’t be simplified. In some sense, they’re just like a
black box.&lt;/p&gt;

&lt;p&gt;In the next section I’ll show how you can use &lt;em&gt;closures&lt;/em&gt;, &lt;em&gt;variable scope&lt;/em&gt; and a &lt;em&gt;class prototype&lt;/em&gt; to delegate computations at &lt;em&gt;class definition&lt;/em&gt;, &lt;em&gt;class constructor&lt;/em&gt;
or to just keep the computations when &lt;em&gt;calling a method&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;classprototype-101&quot;&gt;Class.prototype 101&lt;/h2&gt;

&lt;p&gt;Any JavaScript object, (String, Object, RegExp, etc), generally has two type of properties: the &lt;em&gt;own&lt;/em&gt; properties and the properties
found in the &lt;em&gt;prototype chain&lt;/em&gt;. Each object has a special property &lt;em&gt;proto&lt;/em&gt; that actually points to another object (or is null).&lt;/p&gt;

&lt;p&gt;When we try to access a property in an object:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;propertyValue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;myProperty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;it will first try to see if it’s an &lt;em&gt;own property&lt;/em&gt;, something that can be checked by doing:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hasOwnProperty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;myProperty&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;and use that property if it exists. If it doesn’t exist then it will try to find that property inside the object pointed by the &lt;em&gt;proto&lt;/em&gt; property:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__proto__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;myProperty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If the property isn’t found in the object pointed by &lt;em&gt;proto&lt;/em&gt; then it will try to find it recursively in the prototype chain
(object.proto.proto, etc) until it gets to the top of it.&lt;/p&gt;

&lt;p&gt;When we create a Class with a prototype:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//constructor&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sayHi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;hi&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sayHi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//&amp;quot;hi&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Internally JavaScript will assign to any Person instance &lt;em&gt;proto&lt;/em&gt; property the Person.prototype object we defined above.
This means that we actually define an object with methods only once, and any instance of Person will have a &lt;em&gt;proto&lt;/em&gt; property pointing to those methods.
Since all Person instances point to the same Person.prototype people usually say they share those methods, and so they’re shared properties across instances.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__proto__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//true&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sayHi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__proto__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sayHi&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The convenience about this is that we don’t have to execute an entire code that actually re-creates methods and assigns them to a newly created object in
the function constructor. Since each time new Person is called the Person function is executed, it would be better to just define the methods in the prototype object
for once and not execute code for augmenting an object with new methods each time we call Person.&lt;/p&gt;

&lt;p&gt;Let’s see how this could be used to increase the performance of certain class patterns.&lt;/p&gt;

&lt;h2 id=&quot;public-properties&quot;&gt;Public Properties&lt;/h2&gt;

&lt;p&gt;In the public properties class definition we just move all properties definitions from the &lt;em&gt;class constructor&lt;/em&gt; to the &lt;em&gt;prototype&lt;/em&gt; object. By moving these computations
we can see that there are some interesting performance improvements on constructor calls.&lt;/p&gt;

&lt;p&gt;The code preparations are:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPublicProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty6&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty7&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty9&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicProperty10&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePublicProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;PrototypePublicProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty9&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicProperty10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The code we actually compare is:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPublicProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;vs.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePublicProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As you can see by the &lt;a href=&quot;http://jsperf.com/constructor-public-properties2/2&quot;&gt;test case that you can run yourself&lt;/a&gt; moving computations
to the &lt;em&gt;prototype&lt;/em&gt; object can lead to considerable performance improvements in class constructors.&lt;/p&gt;

&lt;h2 id=&quot;public-methods&quot;&gt;Public Methods&lt;/h2&gt;

&lt;p&gt;For public methods the case is just the same than with public properties. Moving all definitions and initializations to the &lt;em&gt;prototype&lt;/em&gt; object
leads to performance improvements in class constructors.&lt;/p&gt;

&lt;p&gt;The preparation code for this is:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPublicMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicMethod2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePublicMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;PrototypePublicMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;publicMethod2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;a href=&quot;http://jsperf.com/constructor-public-methods&quot;&gt;test&lt;/a&gt; code is:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPublicMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;vs.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePublicMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As &lt;a href=&quot;http://jsperf.com/constructor-public-methods&quot;&gt;you can see&lt;/a&gt; constructors are also faster when public methods are defined inside the &lt;em&gt;prototype&lt;/em&gt; object.&lt;/p&gt;

&lt;h2 id=&quot;private-methods&quot;&gt;Private Methods&lt;/h2&gt;

&lt;p&gt;Private methods can be defined in JavaScript by using the class constructor as encapsulation for other function definitions. This is a pattern I’ve seen done
by Douglas Crockford and is used in many other places:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPrivateMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateMethod1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateMethod2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateMethod1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;privateMethod2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you’re only defining private methods (and not private properties) you can also augment the prototype object with public methods and use encapsulation for
defining private methods around the prototype object. I’ve seen this clever technique done by &lt;a href=&quot;http://twitter.com/webreflection&quot;&gt;WebReflection&lt;/a&gt; some time ago:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePrivateMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateMethod1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateMethod2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;PrototypePrivateMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateMethod1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;privateMethod2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

 &lt;span class=&quot;p&quot;&gt;})();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The code tested is the same as in the previous sections:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPrivateMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;vs.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePrivateMethods&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://jsperf.com/constructor-private-methods&quot;&gt;As you can see for yourself&lt;/a&gt; the prototype version has the fastest constructor. The performance improvements
are considerable with this pattern which is interesting in use-cases such as when defining some helper functions to be used with a class.&lt;/p&gt;

&lt;h2 id=&quot;private-properties&quot;&gt;Private Properties&lt;/h2&gt;

&lt;p&gt;The examples above are kind of simple to analyze: moving the computations from the class constructor to the prototype object can lead to faster constructors, and
more generally can increase performance since the code is computed once at the &lt;em&gt;class definition&lt;/em&gt; and not once per each &lt;em&gt;constructor call&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;With private properties there’s a tradeoff. Since private properties are generally accessed and/or modified by public methods, defining a private property inside
the &lt;em&gt;constructor&lt;/em&gt; forces the definition of the public method into the &lt;em&gt;class constructor&lt;/em&gt; too, decreasing the overall performance of the class constructor. Another
interesting technique could be to just use an underscore prefix for private members:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty6&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty7&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty9&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;privateProperty10&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty1&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty2&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty3&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty4&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty5&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty6&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty7&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty8&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty9&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;privateProperty10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

 &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

 &lt;span class=&quot;nx&quot;&gt;PrototypePrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prototype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty9&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;_privateProperty10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty1&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty2&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty3&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty4&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty5&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty6&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty7&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty8&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty9&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_privateProperty10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;a href=&quot;http://jsperf.com/constructor-and-method-private-vars&quot;&gt;code we’re testing is&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;vs.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://jsperf.com/constructor-and-method-private-vars&quot;&gt;As you can see for yourself&lt;/a&gt; using the prototype object yields faster constructors again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: The results for the next section seem to have been reverted
around Chrome 25. What this means is that now the execution of methods accessing properties in
the prototype object is faster than methods using private variables in
a closure. &lt;a href=&quot;http://jsperf.com/calling-public-methods-accessing-private-vars&quot;&gt;You can see this for yourself by testing this code:&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ConstructorPrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;vs.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PrototypePrivateProperties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;publicMethod1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The augmented prototype object version is the fastest now. There’s an
interesting jump in Chrome 25. You can follow the thread &lt;a href=&quot;https://twitter.com/philogb/status/546355637899128832&quot;&gt;here&lt;/a&gt;
to understand exactly how this works.&lt;/p&gt;

&lt;p&gt;So are you targeting faster constructors, class definitions or methods? The fact is that any of these three stages can be optimized, but generally with a tradeoff.&lt;/p&gt;

    
   </content>
 </entry>
 
 <entry>
   <title>JSConf</title>
   <link href="http://philogb.github.com/blog/2010/09/28/jsconf"/>
   <updated>2010-09-28T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/09/28/jsconf</id>
   <content type="html">
    
      &lt;p&gt;&lt;a href=&quot;http://jsconf.eu/&quot;&gt;JSConf&lt;/a&gt; just finished. It was a great experience: I got to meet a lot of interesting people and attend awesome talks,
and I even got the chance to &lt;a href=&quot;http://jsconf.eu/2010/speaker/creating_interactive_data_visu.html&quot;&gt;speak about the toolkit!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The slides from my talk are here:&lt;/p&gt;

&lt;div style=&quot;width:425px&quot; id=&quot;__ss_5284231&quot;&gt;
&lt;strong style=&quot;display:block;margin:12px 0 4px&quot;&gt;
&lt;a href=&quot;http://www.slideshare.net/philogb/javascript-infovis-toolkit-create-interactive-data-visualizations-for-the-web&quot; title=&quot;JavaScript InfoVis Toolkit - Create interactive data visualizations for the web&quot;&gt;JavaScript InfoVis Toolkit - Create interactive data visualizations for the web
&lt;/a&gt;
&lt;/strong&gt;
&lt;object id=&quot;__sse5284231&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;
&lt;param name=&quot;movie&quot; value=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=jsconfeushort-100925070735-phpapp01&amp;amp;stripped_title=javascript-infovis-toolkit-create-interactive-data-visualizations-for-the-web&amp;amp;userName=philogb&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;
&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot; /&gt;
&lt;embed name=&quot;__sse5284231&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=jsconfeushort-100925070735-phpapp01&amp;amp;stripped_title=javascript-infovis-toolkit-create-interactive-data-visualizations-for-the-web&amp;amp;userName=philogb&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot; /&gt;

&lt;/object&gt;
&lt;div style=&quot;padding:5px 0 12px&quot;&gt;View more
&lt;a href=&quot;http://www.slideshare.net/&quot;&gt;presentations
&lt;/a&gt; from
&lt;a href=&quot;http://www.slideshare.net/philogb&quot;&gt;philogb
&lt;/a&gt;.
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;All talks were great, some of the talks I really enjoyed were:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://jsconf.eu/2010/speaker/be_proxy_objects.html&quot;&gt;Proxy Objects by Brendan Eich&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jsconf.eu/2010/speaker/getting_functional_with_fab.html&quot;&gt;Getting functional with (fab) by Jed Schmidt&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://jsconf.eu/2010/speaker/loopage_by_douglas_crockford.html&quot;&gt;Loopage by Douglas Crockford&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…and &lt;a href=&quot;http://jsconf.eu/2010/speakers.html&quot;&gt;more&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can follow &lt;a href=&quot;http://twitter.com/jsconfeu&quot;&gt;JSConf&lt;/a&gt; for updates about when the videos will be released.&lt;/p&gt;

&lt;p&gt;Finally I want to thank &lt;a href=&quot;http://twitter.com/janl/&quot;&gt;janl&lt;/a&gt;, &lt;a href=&quot;http://twitter.com/cramforce/&quot;&gt;cramforce&lt;/a&gt; and &lt;a href=&quot;http://twitter.com/hblank&quot;&gt;hblank&lt;/a&gt;
for gathering all javascripters in Berlin, making an excellent event, and giving me the chance to introduce &lt;a href=&quot;http://thejit.org/&quot;&gt;the toolkit&lt;/a&gt; to the JS crowd.
You guys are awesome!&lt;/p&gt;


    
   </content>
 </entry>
 
 <entry>
   <title>Jekyll</title>
   <link href="http://philogb.github.com/blog/2010/09/20/jekyll"/>
   <updated>2010-09-20T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/09/20/jekyll</id>
   <content type="html">
    
      &lt;p&gt;So I just moved from WordPress to &lt;a href=&quot;http://github.com/mojombo/jekyll&quot;&gt;Jekyll&lt;/a&gt;, a Ruby based static site generator. 
Moving from WordPress wasn’t as pleasant as I thought, and the site might have some “bugs” (let me know if you find one!) 
but I’m much more happy to be writing this post in my favorite editor, and not having to rely on WordPress, PHP or MySQL to run the blog.&lt;/p&gt;

&lt;p&gt;While moving stuff from WordPress I found a few interesting old posts, I hope you find them interesting too:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2008/09/05/memoization-in-javascript/&quot;&gt;Memoization in JavaScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2009/02/08/generic-functions-and-javascript/&quot;&gt;Generic functions and JavaScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2009/03/24/sharp-variables/&quot;&gt;Sharp Variables&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2009/05/11/interactive-visualization-of-genealogical-graphs/&quot;&gt;Interactive Visualization of genealogical graphs video&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…oh well, there are more interesting posts, so I recommend you to go to the &lt;a href=&quot;/&quot;&gt;main page&lt;/a&gt; to see a list of them. &lt;/p&gt;

&lt;p&gt;If you find some bugs please let me know!&lt;/p&gt;

    
   </content>
 </entry>
 
 <entry>
   <title>JavaScript InfoVis Toolkit + WebGL</title>
   <link href="http://philogb.github.com/blog/2010/09/17/javascript-infovis-toolkit-webgl"/>
   <updated>2010-09-17T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/09/17/javascript-infovis-toolkit-webgl</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Three ways to make 3D</title>
   <link href="http://philogb.github.com/blog/2010/09/04/three-ways-to-make-3d"/>
   <updated>2010-09-04T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/09/04/three-ways-to-make-3d</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>JavaScript InfoVis Toolkit 2.0.0 beta released</title>
   <link href="http://philogb.github.com/blog/2010/08/10/javascript-infovis-toolkit-2-0-0-beta-released"/>
   <updated>2010-08-10T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/08/10/javascript-infovis-toolkit-2-0-0-beta-released</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Doctor Who villains from 1963 to 2010 visualized</title>
   <link href="http://philogb.github.com/blog/2010/07/17/doctor-who-villains-from-1963-to-2010-visualized"/>
   <updated>2010-07-17T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/07/17/doctor-who-villains-from-1963-to-2010-visualized</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Speaker at JSConf.eu 2010</title>
   <link href="http://philogb.github.com/blog/2010/07/08/speaker-at-jsconf-eu-2010"/>
   <updated>2010-07-08T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/07/08/speaker-at-jsconf-eu-2010</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>The JavaScript InfoVis Toolkit 2.0 is out!</title>
   <link href="http://philogb.github.com/blog/2010/06/28/the-javascript-infovis-toolkit-2-0-is-out"/>
   <updated>2010-06-28T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/06/28/the-javascript-infovis-toolkit-2-0-is-out</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>News from the JavaScript InfoVis Toolkit 2.0 World</title>
   <link href="http://philogb.github.com/blog/2010/05/30/news-from-the-javascript-infovis-toolkit-2-0-world"/>
   <updated>2010-05-30T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/05/30/news-from-the-javascript-infovis-toolkit-2-0-world</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Browser Photo Mosaics</title>
   <link href="http://philogb.github.com/blog/2010/05/20/browser-photo-mosaics"/>
   <updated>2010-05-20T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/05/20/browser-photo-mosaics</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Speaker at YOW! Australia 2010</title>
   <link href="http://philogb.github.com/blog/2010/05/03/speaker-at-yow-australia-2010"/>
   <updated>2010-05-03T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/05/03/speaker-at-yow-australia-2010</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>New JavaScript InfoVis Toolkit Visualizations</title>
   <link href="http://philogb.github.com/blog/2010/04/24/new-javascript-infovis-toolkit-visualizations"/>
   <updated>2010-04-24T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/04/24/new-javascript-infovis-toolkit-visualizations</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>JavaScript Animations</title>
   <link href="http://philogb.github.com/blog/2010/03/25/javascript-animations"/>
   <updated>2010-03-25T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/03/25/javascript-animations</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>JavaScript InfoVis Toolkit Customizations</title>
   <link href="http://philogb.github.com/blog/2010/02/24/javascript-infovis-toolkit-customizations"/>
   <updated>2010-02-24T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/02/24/javascript-infovis-toolkit-customizations</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Voronoi Tessellation</title>
   <link href="http://philogb.github.com/blog/2010/02/12/voronoi-tessellation"/>
   <updated>2010-02-12T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/02/12/voronoi-tessellation</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>DOM vs. Canvas TreeMaps</title>
   <link href="http://philogb.github.com/blog/2010/01/24/dom-vs-canvas-treemaps"/>
   <updated>2010-01-24T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2010/01/24/dom-vs-canvas-treemaps</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Past Talk(s)</title>
   <link href="http://philogb.github.com/blog/2009/12/07/past-talks"/>
   <updated>2009-12-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/12/07/past-talks</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Speaker at the Parisian Seminar on InfoVis and HCI</title>
   <link href="http://philogb.github.com/blog/2009/11/30/speaker-at-the-parisian-seminar-on-infovis-and-hci"/>
   <updated>2009-11-30T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/11/30/speaker-at-the-parisian-seminar-on-infovis-and-hci</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>ECMA Harmony and the Future of JavaScript</title>
   <link href="http://philogb.github.com/blog/2009/11/08/ecma-harmony-and-the-future-of-javascript"/>
   <updated>2009-11-08T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/11/08/ecma-harmony-and-the-future-of-javascript</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>1000 Messages, yay!</title>
   <link href="http://philogb.github.com/blog/2009/10/15/1000-messages-yay"/>
   <updated>2009-10-15T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/10/15/1000-messages-yay</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Sunburst Visualization</title>
   <link href="http://philogb.github.com/blog/2009/10/05/sunburst-visualization"/>
   <updated>2009-10-05T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/10/05/sunburst-visualization</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Force Directed Layouts</title>
   <link href="http://philogb.github.com/blog/2009/09/30/force-directed-layouts"/>
   <updated>2009-09-30T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/09/30/force-directed-layouts</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>HTML, SVG or Canvas Labels?</title>
   <link href="http://philogb.github.com/blog/2009/08/30/html-svg-or-canvas-labels"/>
   <updated>2009-08-30T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/08/30/html-svg-or-canvas-labels</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Version 1.1.3</title>
   <link href="http://philogb.github.com/blog/2009/08/24/version-113"/>
   <updated>2009-08-24T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/08/24/version-113</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Back to Basics</title>
   <link href="http://philogb.github.com/blog/2009/08/22/back-to-basics"/>
   <updated>2009-08-22T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/08/22/back-to-basics</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>MultiTrees (Part 1)</title>
   <link href="http://philogb.github.com/blog/2009/08/16/multitrees-part-1"/>
   <updated>2009-08-16T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/08/16/multitrees-part-1</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Outside In</title>
   <link href="http://philogb.github.com/blog/2009/08/07/outside-in"/>
   <updated>2009-08-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/08/07/outside-in</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Drawing Trees</title>
   <link href="http://philogb.github.com/blog/2009/08/05/drawing-trees"/>
   <updated>2009-08-05T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/08/05/drawing-trees</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>V8-GL Update</title>
   <link href="http://philogb.github.com/blog/2009/07/13/v8-gl-update"/>
   <updated>2009-07-13T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/07/13/v8-gl-update</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>V8-GL</title>
   <link href="http://philogb.github.com/blog/2009/06/21/v8-gl"/>
   <updated>2009-06-21T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/06/21/v8-gl</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>The JavaScript InfoVis Toolkit 1.1 is Out!</title>
   <link href="http://philogb.github.com/blog/2009/06/02/the-javascript-infovis-toolkit-11-is-out"/>
   <updated>2009-06-02T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/06/02/the-javascript-infovis-toolkit-11-is-out</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>More about the JavaScript InfoVis Toolkit 1.1</title>
   <link href="http://philogb.github.com/blog/2009/05/21/more-about-the-javascript-infovis-toolkit-11"/>
   <updated>2009-05-21T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/05/21/more-about-the-javascript-infovis-toolkit-11</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Interactive Visualization of Genealogical Graphs</title>
   <link href="http://philogb.github.com/blog/2009/05/11/interactive-visualization-of-genealogical-graphs"/>
   <updated>2009-05-11T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/05/11/interactive-visualization-of-genealogical-graphs</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Taking a look at Groovy</title>
   <link href="http://philogb.github.com/blog/2009/04/21/taking-a-look-at-groovy"/>
   <updated>2009-04-21T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/04/21/taking-a-look-at-groovy</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>JavaScript InfoVis Toolkit 1.1 Preview</title>
   <link href="http://philogb.github.com/blog/2009/03/31/javascript-infovis-toolkit-11-preview"/>
   <updated>2009-03-31T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/03/31/javascript-infovis-toolkit-11-preview</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Sharp Variables</title>
   <link href="http://philogb.github.com/blog/2009/03/24/sharp-variables"/>
   <updated>2009-03-24T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/03/24/sharp-variables</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Generic Functions and JavaScript</title>
   <link href="http://philogb.github.com/blog/2009/02/08/generic-functions-and-javascript"/>
   <updated>2009-02-08T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/02/08/generic-functions-and-javascript</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Cushion Treemaps</title>
   <link href="http://philogb.github.com/blog/2009/02/05/cushion-treemaps"/>
   <updated>2009-02-05T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/02/05/cushion-treemaps</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Why not Operator Overloading in JavaScript?</title>
   <link href="http://philogb.github.com/blog/2009/01/27/why-not-operator-overloading-in-javascript"/>
   <updated>2009-01-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/01/27/why-not-operator-overloading-in-javascript</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>A new Canvas Element</title>
   <link href="http://philogb.github.com/blog/2009/01/12/a-new-canvas-element"/>
   <updated>2009-01-12T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2009/01/12/a-new-canvas-element</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Anonymous Recursive Functions</title>
   <link href="http://philogb.github.com/blog/2008/12/27/anonymous-recursive-functions"/>
   <updated>2008-12-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/12/27/anonymous-recursive-functions</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Using OCaml to visualize Radiohead's HoC music video (part 3)</title>
   <link href="http://philogb.github.com/blog/2008/12/06/using-ocaml-to-visualize-radioheads-hoc-music-video-part-3"/>
   <updated>2008-12-06T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/12/06/using-ocaml-to-visualize-radioheads-hoc-music-video-part-3</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Using OCaml to visualize Radiohead's HoC music video (part 2)</title>
   <link href="http://philogb.github.com/blog/2008/12/02/using-ocaml-to-visualize-radioheads-hoc-music-video-part-2"/>
   <updated>2008-12-02T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/12/02/using-ocaml-to-visualize-radioheads-hoc-music-video-part-2</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Using OCaml to visualize Radiohead's HoC music video (part 1)</title>
   <link href="http://philogb.github.com/blog/2008/11/27/using-ocaml-to-visualize-radioheads-hoc-music-video-part-1"/>
   <updated>2008-11-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/11/27/using-ocaml-to-visualize-radioheads-hoc-music-video-part-1</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Thank you Platform Computing!</title>
   <link href="http://philogb.github.com/blog/2008/11/12/thank-you-platform-computing"/>
   <updated>2008-11-12T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/11/12/thank-you-platform-computing</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Visualizing Linux package dependencies</title>
   <link href="http://philogb.github.com/blog/2008/11/02/visualizing-linux-module-dependencies"/>
   <updated>2008-11-02T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/11/02/visualizing-linux-module-dependencies</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Graph Operations</title>
   <link href="http://philogb.github.com/blog/2008/10/31/graph-operations"/>
   <updated>2008-10-31T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/10/31/graph-operations</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>The Moebius Transformation</title>
   <link href="http://philogb.github.com/blog/2008/10/14/the-moebius-transformation"/>
   <updated>2008-10-14T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/10/14/the-moebius-transformation</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Memoization in JavaScript</title>
   <link href="http://philogb.github.com/blog/2008/09/05/memoization-in-javascript"/>
   <updated>2008-09-05T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/09/05/memoization-in-javascript</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Pattern matching in OCaml (and JavaScript?)</title>
   <link href="http://philogb.github.com/blog/2008/08/11/pattern-matching-in-ocaml-and-javascript"/>
   <updated>2008-08-11T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/08/11/pattern-matching-in-ocaml-and-javascript</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Weighted nodes, weighted edges</title>
   <link href="http://philogb.github.com/blog/2008/08/05/weighted-nodes-weighted-edges"/>
   <updated>2008-08-05T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/08/05/weighted-nodes-weighted-edges</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Feeding JSON graph structures to the JIT</title>
   <link href="http://philogb.github.com/blog/2008/07/02/feeding-json-graph-structures-to-the-jit"/>
   <updated>2008-07-02T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/07/02/feeding-json-graph-structures-to-the-jit</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>JIT version 1.0.2a</title>
   <link href="http://philogb.github.com/blog/2008/06/08/jit-version-102a"/>
   <updated>2008-06-08T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/06/08/jit-version-102a</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Animated exploration of Graphs with radial layout video</title>
   <link href="http://philogb.github.com/blog/2008/06/02/animated-exploration-of-graphs-with-radial-layout-video"/>
   <updated>2008-06-02T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/06/02/animated-exploration-of-graphs-with-radial-layout-video</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Further work on JIT</title>
   <link href="http://philogb.github.com/blog/2008/05/20/further-work-on-jit-10a"/>
   <updated>2008-05-20T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/05/20/further-work-on-jit-10a</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Treemap quick tutorial</title>
   <link href="http://philogb.github.com/blog/2008/05/07/treemap-quick-tutorial"/>
   <updated>2008-05-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/05/07/treemap-quick-tutorial</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>ST quick tutorial</title>
   <link href="http://philogb.github.com/blog/2008/05/07/st-quick-tutorial"/>
   <updated>2008-05-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/05/07/st-quick-tutorial</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>RGraph quick tutorial</title>
   <link href="http://philogb.github.com/blog/2008/05/07/rgraph-quick-tutorial"/>
   <updated>2008-05-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/05/07/rgraph-quick-tutorial</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Hypertree quick tutorial</title>
   <link href="http://philogb.github.com/blog/2008/05/07/hypertree-quick-tutorial"/>
   <updated>2008-05-07T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/05/07/hypertree-quick-tutorial</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>On controllers</title>
   <link href="http://philogb.github.com/blog/2008/04/27/on-controllers"/>
   <updated>2008-04-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/04/27/on-controllers</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 
 <entry>
   <title>Feeding JSON tree structures to the JIT</title>
   <link href="http://philogb.github.com/blog/2008/04/27/feeding-json-tree-structures-to-the-jit"/>
   <updated>2008-04-27T00:00:00+00:00</updated>
   <id>http://philogb.github.com/blog/2008/04/27/feeding-json-tree-structures-to-the-jit</id>
   <content type="html">
    
      Sorry, the contents of this post are not available in the RSS.
    
   </content>
 </entry>
 

</feed>
