gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] fenfire/org/fenfire/loom WheelView.java WheelVi...


From: Asko Soukka
Subject: [Gzz-commits] fenfire/org/fenfire/loom WheelView.java WheelVi...
Date: Wed, 12 Mar 2003 04:14:31 -0500

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Asko Soukka <address@hidden>    03/03/12 04:14:31

Modified files:
        org/fenfire/loom: WheelView.java WheelView.test 

Log message:
        maxangle for wheelview

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/WheelView.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/WheelView.test.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/loom/WheelView.java
diff -u fenfire/org/fenfire/loom/WheelView.java:1.6 
fenfire/org/fenfire/loom/WheelView.java:1.7
--- fenfire/org/fenfire/loom/WheelView.java:1.6 Tue Mar 11 17:52:22 2003
+++ fenfire/org/fenfire/loom/WheelView.java     Wed Mar 12 04:14:31 2003
@@ -56,11 +56,14 @@
     }
 
     /** XXX gapy has currently no effect, should be used
-     * to determine the minimum rotation angle
+     * to determine the minimum rotation angle.
      */
     protected int sizex = 250, sizey = 20;
     protected int gapx = 50, gapy = 30;
 
+    /** Maximum rotation angle. */
+    protected double maxrota = Math.PI / 9;
+
     public void render(VobScene sc, int into, Cursor c) {
        int midx = sc.size.width/2, midy = sc.size.height/2;
        NodeView.Nodespec spec = new NodeView.Nodespec(c.focus);
@@ -72,16 +75,19 @@
        int totpos = c.getConnections(1).size();
        int totneg = c.getConnections(-1).size();
 
-       /* Rotation angle = 2PI / 2(greater of totpos and totgen) */
+       /** Rotation angle = 2PI / 2(greater of totpos and totgen). */
         double rota;
        if (totpos < totneg) rota = 2 * totneg;
        else rota = 2 * totpos;
        rota = (2 * Math.PI) / rota;
 
-       /* Radius = gapx * sizex */
+       /** Rotation angle should be no bigger than defined maximu. */
+       if (rota > maxrota) rota = maxrota;
+
+       /** Radius = gapx * sizex */
        int r = gapx + sizex;
 
-       /* Poswards connections */
+       /** Poswards connections */
        int before = c.getRotationIndex(1);     
        double cura = -(before * rota);
        for(Iterator j=c.getConnections(1).iterator(); j.hasNext();) {
@@ -100,7 +106,7 @@
            before--;
        }
 
-       /* Negward connections */
+       /** Negward connections */
        before = c.getRotationIndex(-1);        
        cura = Math.PI-(before * rota);
        for(Iterator j=c.getConnections(-1).iterator(); j.hasNext();) {
Index: fenfire/org/fenfire/loom/WheelView.test
diff -u fenfire/org/fenfire/loom/WheelView.test:1.9 
fenfire/org/fenfire/loom/WheelView.test:1.10
--- fenfire/org/fenfire/loom/WheelView.test:1.9 Tue Mar 11 17:52:22 2003
+++ fenfire/org/fenfire/loom/WheelView.test     Wed Mar 12 04:14:31 2003
@@ -72,7 +72,7 @@
     if x == 0 and y < 0: return math.pi * 1.5
     elif x == 0 and y == 0: return 0.0
     elif x == 0 and y > 0: return math.pi/2
-    elif x > 0 and y < 0: return math.pi * 1.5 + math.atan(-y/x)
+    elif x > 0 and y < 0: return math.pi * 2.0 - math.atan(-y/x)
     elif x > 0 and y == 0: return 0.0
     elif x > 0 and y > 0: return math.atan(y/x)
     elif x < 0 and y < 0: return math.pi + math.atan(-y/-x)
@@ -125,7 +125,6 @@
         [getZ(vs, cs) for cs in [cs_r, cs_s, cs_t, cs_u, cs_v, cs_w]]  
 
     # Check that selected nodes are drawn on same level
-
     assert pw.y == pr.y == ps.y
     assert pwz == prz == psz
 
@@ -134,20 +133,18 @@
     assert pt.x < ps.x > pv.x
     assert ptz > psz < pvz < puz
        
-
     # Check that all nodes have approximately the same distance
     # from r
-    
+    #
     for px in (pt, pu, pv, pw):
-        assert abs(distance(pr,ps) - distance(pr,px)) < 1
+        assert abs(distance(pr,ps) - distance(pr,px)) < 1.2
 
     # Check the angles
-
     assert angle(pr, ps) == 0
-    assert angle(pr, pv) == 2*math.pi/8
-    assert angle(pr, pu) == 2*math.pi/8*2
+    assert abs(angle(pr, pv) - math.pi / 9) < 0.001
+    assert abs(angle(pr, pu) - (math.pi / 9) * 2) < 0.001
     assert angle(pr, pw) == math.pi
-    assert angle(pr, pt) == 2*math.pi - angle(pr, pv)
+    assert abs(angle(pr, pt) - (2*math.pi - angle(pr, pv))) < 0.001
 
     # Test that all node coordinate systems are activated
     # (clickable).




reply via email to

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