Sunday, April 29, 2007

My Current Status


Don't quite know whats going on ... suddenly lost it. Just ..... lost it. Been really busy, but all of a sudden I feel that I'm behind in my studies. Maybe its because I never studied this semester, I skipped a few classes, a lot really. But I always find myself occupied in Uni work, so why feel this way ??

Maya, slalu aku ponteng. Sbb yg datang pn budak senior yg pernah amik subject tu. To be honest he didn't know much at all. So ... why go ?? I go to the intensive classes and to me thats enough.

Object Oriented Sware Engineering... As cool as the name sounds, I hate this subject. Mainly because theres not much engineering to begin with. They come up with all this conceptual stuff to 'help' you write code... but its all just so unimportant to me. To draw a UML, Domain Model, and extract pieces of code from it. I find it so .... boring. I never picked up the text book, let alone read it. I find myself dragging my ass through this one. I went to the test, just wrote what I know and submit it in just 5 minutes. Couldn't be bothered putting any effort into it. Maybe its because it was only worth 5%. But honestly I didn't give a $hiT. Could have been 10% and still I won't touch my book.

I find it hard to except that we need to do all this stuff ... I want to learn what I want and I'll do things my way. May sound arrogant but its the only way to get myself motivated.

I'll be back on the field in a few weeks. Hope that does more good to me than damage. Wish me luck....

Monday, April 09, 2007

Organic Graph Layout

Took me 4 days of work, but finally it's done. 4 hari hidup kelawar. It was a nightmare just to get it working correctly, and a lot of tweaking to get it just right. It solves the very thing we take for granted. Aesthetic values ... that make things look 'nice'. Ratios, determine how beautiful something really is. Who said the world isn't all math. Well, it isn't ... but most of it is anyway.

As to graphs, we look at a graph which the nodes have been randomly spread across a canvas, and rearrange it. But sub consciously we place nodes at a roughly same distance from every other node. We cluster them so that the connected nodes are closer together.and we try to get rid of crossing edges.

This is found in nature. But natural approach is a bit different but the result is more or less the same. You have 2 forces. Attracting and repelling ...
This model is what keeps molecules together. Keeps the moon in orbit. Keeps the earth in orbit. For all we know, keeps life itself going.

So organic graph layouts simulate how molecules keep intact. Each node has a repelling force, but to the nodes it is connected to, it attracts to some extent.

This is the pseudocode ...
set up initial node velocities to (0,0)
set up initial node positions randomly // no 2 nodes are in exactly the same position
loop
total_kinetic_energy := 0 // total kinetic energy of all particles
for each node

net_force := (0, 0) // running sum of node's total force

for each other node
net_force := net_force + Coulomb_repulsion( this_node, other_node )
next node

for each spring connected to this node
net_force := net_force + Hooke_attraction( this_node, spring )
next spring

// without damping, it moves forever

this_node.velocity := (this_node.velocity + timestep * net_force) * damping
this_node.position := this_node.position + timestep * this_node.velocity
total_kinetic_energy := total_kinetic_energy + (this_node.velocity)^2
next node

until total_kinetic_energy is less than some small number //the simulation has stopped moving
The result :


The code doesn't really deal with crossing edges but naturally most of the crossings will resolve itself.

Labels: