Last 10 changes peermore peermore peermore aboutchris augury socialtext pictures socialtext socialtext aboutchris 122 words 253 defs | springalgoRevision: Backlinks: | A decode of the spring algorithm, potentially incorrect, awaiting input. This is a part of Project4 ---------- Forwarded message ---------- Date: Mon, 25 Mar 2002 21:17:21 -0500 (EST) From: cdent@burningchrome.com Subject: the algorithm What follows are my notes from my intepretation, at an abstract level, of the existing code. I've marked parts that are especially notable/i doubt/include questions with a * in the left margin. Main loop is endless after 50 iterations fix the center node to keep the image centered from drifting relax() foreach edge get the distance between attached nodes compare that with the length/strength of edge to create a change factor of attraction between the nodes * Is that (or can that) factor controllable from elsewhere? foreach node see how far away every other node is adjust delta x and y for repulsion if less than 100 units if overlap, change dx and dy by a random amount * how is the factor of repulsion controlled, can it be * controlled, what does it represent? foreach node adjust the x and y position by the dx, but not too much contrain by window Dimension Decelerate the dx and dy change factors redraw the screen via plotSpring() create an offscreen buffere if it doesn't already exist clear offscreen foreach edge get x and y of attached nodes draw line in a color as defined by length attach optional stress text foreach node paintNode() get color from node object draw configurable shape set the label text draw offscreen onscreen * Is that basically correct? | [ Contact ] [ Old Blog ] [ New Blog ] [ Write ] [ AboutWarp ] [ Resume ] [ Search ] [ List Words ] [ Login ] |