gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/lava/blob ellipses.mp fshape.py


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob/lava/blob ellipses.mp fshape.py
Date: Sat, 24 May 2003 10:02:12 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/05/24 10:02:11

Modified files:
        lava/blob      : ellipses.mp fshape.py 

Log message:
        ui

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/blob/ellipses.mp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/lava/blob/fshape.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: libvob/lava/blob/ellipses.mp
diff -u libvob/lava/blob/ellipses.mp:1.1 libvob/lava/blob/ellipses.mp:1.2
--- libvob/lava/blob/ellipses.mp:1.1    Sat May 24 08:55:32 2003
+++ libvob/lava/blob/ellipses.mp        Sat May 24 10:02:11 2003
@@ -107,7 +107,7 @@
 beginfig(1);
 
 for rad = .5 step 3 until 300 :
-    ellipseFrom( (0,0), (100,0), (100,100), (-5,100), rad );
+    ellipseFrom( (0,0), (20,0), (30,30), (-1,20), rad );
 endfor;
 
 if false:
Index: libvob/lava/blob/fshape.py
diff -u libvob/lava/blob/fshape.py:1.2 libvob/lava/blob/fshape.py:1.3
--- libvob/lava/blob/fshape.py:1.2      Fri May 23 10:07:51 2003
+++ libvob/lava/blob/fshape.py  Sat May 24 10:02:11 2003
@@ -28,7 +28,9 @@
 import sys
 import RandomArray
 
-length= 100
+from Tkinter import *
+
+length= 150
 epsilon = 0.0001
 
 # print l
@@ -37,11 +39,11 @@
     return (xright-xleft) * .5 * (rleft + rright)
 
 def L(xleft, xright, rleft, rright):
-    return sqrt((xright-xleft)**2 + (rright-rleft)**2)
+    return sqrt((xright-xleft)**2 + yweight**2 * (rright-rleft)**2)
 
 def U(xleft, xright, rleft, rright):
 
-    return A(xleft, xright, rleft, rright) +3* L(xleft, xright, rleft, rright)
+    return areaweight * A(xleft, xright, rleft, rright) +3* L(xleft, xright, 
rleft, rright)
 
 
 def pot(x, r):
@@ -88,7 +90,6 @@
 # geomview = sys.stdout
 
 geomview.write("""
-(merge-baseap { appearance { texture { file noisetex.ppm apply modulate } } })
 (geometry example { LIST { : foo0 } { : foo1 } { : foo2 } { :foo3 } { :foo4 }})
 """);
 geomview.flush()
@@ -114,7 +115,7 @@
        self.mom = x * 0
        self.x = x
        self.step = 0.02
-       self.brake = 0.980
+       self.brake = 0.990
     def round(self):
        (u, g) = self.func(self.x)
        self.u = u
@@ -126,7 +127,7 @@
 
 sur = []
 for i in range(1, 2):
-    l = 3**i
+    l = 2**i
     tl = l * length
     print "TL",tl
     x = zeros(2*tl, Float)
@@ -136,11 +137,37 @@
     mi = MomGrad(minfunc, x)
     sur.append(mi)
 
-while 1:
-    for i in range(0, len(sur)):
-       for rou in range(0,50): sur[i].round()
-       print "Pot:",sur[i].u
-       wmesh(i, sur[i].x[0:sur[i].x.shape[0]/2], 
sur[i].x[sur[i].x.shape[0]/2:])
+def slider(obj, name, var, default, from_, to, resolution=0.001):
+    setattr(obj, name, var)
+    var.set(default)
+    Scale(obj, label=name, orient="horizontal", 
+       resolution=resolution,
+       from_=from_, to=to, variable=var).pack(
+           fill="both", expand=1)
+
+class UI(Frame):
+    def __init__(self, master=None):
+       Frame.__init__(self, master)
+       self.pack(expand=1, fill="both")
+       Button(self, text="Start", command = self.idle).pack()
+       slider(self, "areaweight", DoubleVar(), 1, 0, 2);
+       slider(self, "yweight", DoubleVar(), 1, 0, 2);
+
+    def idle(self):
+       print "Start idle"
+       global areaweight
+       global yweight
+       for i in range(0, len(sur)):
+           areaweight = ui.areaweight.get()
+           yweight = ui.yweight.get()
+           for rou in range(0,100): sur[i].round()
+           print "Pot:",sur[i].u
+           wmesh(i, sur[i].x[0:sur[i].x.shape[0]/2], 
sur[i].x[sur[i].x.shape[0]/2:])
+       self.after_idle(self.idle)
+       print "End idle"
+
+ui = UI()
+ui.mainloop()
 
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]