JSON ... it's the intersection of all modern programming languages. All languages have some sense of data, and structures of data. They all have simple values like number strings, and booleans. They all have some sense of a sequence of values. ... Every language has some sense of a collection of named values; it might be an object, or a record, or a struct, or a hash, or a property list, or something. All languages have these, these are universal ideas.
... But they all have the same idea about what the data looks like, and JSON has the thing that's common to everything. By being at the intersection, it turns out to be the thing that everybody can agree on, so it's really easy to pass data back and forth.
Prior data interchange formats tended to try to be the union of all the languages, and that turns out to be horrendously complex, and very difficult to deal with. JSON, by being so simple, actually became really easy to use.
Features: * Multiple Data Representations: Treemaps, Radial Layouts, HyperTrees/Graphs, SpaceTree-like Layouts, and more... * Major Browsers Support: IE6+, Firefox2+, Safari3+, Opera9.5+ * Open Source: Licensed under the BSD License * Library Agnostic: You may use the JIT with your favorite DOM manipulation framework * Extensible: All visualization classes are mutable, so you can easily add/override any method you want. * Composable: Visualizations can be combined in order to create new visualization methods.
void branch(float h) {
h *= (float) $('#val_size_1').val();
// All recursive functions must have an exit condition!!!!
// Here, ours is when the length of the branch is 2 pixels or less
if (h > 5) {
pushMatrix(); // Save the current state of transformation (i.e. where are we now)
rotate(theta); // Rotate by theta
line(0,0,0,-h); // Draw the branch
translate(0,-h); // Move to the end of the branch
//ellipse(0, 0, 40, 40);
branch(h); // Ok, now call myself to draw two new branches!!
popMatrix(); // Whenever we get back here, we "pop" in order to restore the previous matrix state
// Repeat the same thing, only branch off to the "left" this time!
pushMatrix();
rotate(-theta);
line(0,0,0,-h);
translate(0,-h);
branch(h);
popMatrix();
}
}