[SCM] calf/master: + Big Bull: make layout algorithm a bit less horrible by adding "simulated annealing"-like randomization

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:37:40 UTC 2013


The following commit has been merged in the master branch:
commit 5e4e5cf9491d3c14ea615f07220a36611d4f0d19
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Sat Oct 4 00:31:21 2008 +0000

    + Big Bull: make layout algorithm a bit less horrible by adding "simulated annealing"-like randomization
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@316 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/bigbull/conndiagram.py b/bigbull/conndiagram.py
index 2c41d80..3d2030f 100644
--- a/bigbull/conndiagram.py
+++ b/bigbull/conndiagram.py
@@ -389,6 +389,7 @@ class ConnectionGraphEditor:
         step = 2.0
         cr = self.canvas.create_cairo_context()
         w, h = self.canvas.allocation.width, self.canvas.allocation.height
+        temperature = 100
         while True:
             energy = 0.0
             x = y = 0
@@ -400,6 +401,7 @@ class ConnectionGraphEditor:
             gforce = w / 2 - x + 1j * (h / 2 - y)
             for m1 in self.modules:
                 force = gforce
+                force += temperature * random.random()
                 for m2 in self.modules:
                     if m1 == m2:
                         continue
@@ -418,6 +420,7 @@ class ConnectionGraphEditor:
                 m1.group.update(True, cr, m1.bounds)
                 m1.update_wires()
             damping *= 0.99
+            temperature *= 0.99
             self.canvas.draw(gtk.gdk.Rectangle(0, 0, w, h))
             print "Energy is %s" % energy
             if energy < 0.1:

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list