gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO Documentation/VISION gfx/demo/sqfill...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO Documentation/VISION gfx/demo/sqfill...
Date: Thu, 24 Oct 2002 22:57:18 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/24 22:57:18

Modified files:
        .              : TODO 
        Documentation  : VISION 
        gfx/demo       : sqfillet.py 
        gfx/libfillet  : Fillet.cxx Fillet.hxx 
        gfx/librenderables: renderables.py 
        gzz/view       : xubuoy.py 

Log message:
        twid

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.321&tr2=1.322&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/VISION.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/sqfillet.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libfillet/Fillet.cxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libfillet/Fillet.hxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.112&tr2=1.113&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/xubuoy.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text

Patches:
Index: gzz/Documentation/VISION
diff -u gzz/Documentation/VISION:1.6 gzz/Documentation/VISION:1.7
--- gzz/Documentation/VISION:1.6        Wed Oct 23 05:29:15 2002
+++ gzz/Documentation/VISION    Thu Oct 24 22:57:17 2002
@@ -117,6 +117,8 @@
         - zz-rakenne
         - Xanadu-hypertekstimalli
 
+       - fisheye
+
 Tavoitteet
 
 - Gzz-prototyypin arkityössä käyttökelpoinen versio
Index: gzz/TODO
diff -u gzz/TODO:1.321 gzz/TODO:1.322
--- gzz/TODO:1.321      Wed Oct 23 10:55:39 2002
+++ gzz/TODO    Thu Oct 24 22:57:17 2002
@@ -126,12 +126,6 @@
                - dicing only when needed
                - don't
            - soft shadows
-       - pre-rendering paper for speedup
-       - Nokia demo [deadline 24.10]
-           - xupdf:
-               - larger structure 
-               - adjust dicing [from frame rate???]
-           - gzz.info: xupdf demo movie clearly accessible
        - PP [deadline 5.11]
            - refactor
            - make it work again
@@ -144,6 +138,7 @@
            - saving
            - soft shadows
            + merge !!!
+       - gzz.info: xupdf demo movie clearly accessible
        + [GI03] irregu animations
        + [GI03] paper animations?
        - motion: grab & drag, not click & slide
@@ -156,6 +151,8 @@
             - Clipping in awt
            - text size in OpenGL
        - xupdf: distorted multi-page PDF view with xu links
+           - larger structure 
+           - adjust dicing [from frame rate???]
            - adjustable zoom / distortion area by mouse
            + discard high-rez images (500kB/image) ?
                (imagecache)
Index: gzz/gfx/demo/sqfillet.py
diff -u gzz/gfx/demo/sqfillet.py:1.4 gzz/gfx/demo/sqfillet.py:1.5
--- gzz/gfx/demo/sqfillet.py:1.4        Wed Oct 23 05:40:07 2002
+++ gzz/gfx/demo/sqfillet.py    Thu Oct 24 22:57:17 2002
@@ -1,15 +1,38 @@
+from __future__ import nested_scopes
+
 AbstractUpdateManager.defaultAnimationTime = 150000
 from java.lang import Math
 
 class SqfScene:
     def __init__(self):
-       self.w = [20, 40, 80]
+       self.w = 40
+       self.blendw = 0.125
+       self.power = 6
        self.flags = [1, 0]
        self.rand = 1
        self.updcoords()
     def key(self, key):
-       if key == "w":
-           rotatelist(self.w)
+       def mul(attr, down, up):
+           if key == down:
+               setattr(self, attr, getattr(self, attr) / 1.05)
+           elif key == up:
+               setattr(self, attr, getattr(self, attr) * 1.05)
+           else:
+               return
+           AbstractUpdateManager.setNoAnimation()
+       def id(attr, down, up):
+           if key == down:
+               setattr(self, attr, getattr(self, attr) - 1)
+           elif key == up:
+               setattr(self, attr, getattr(self, attr) + 1)
+           else:
+               return
+           AbstractUpdateManager.setNoAnimation()
+       
+       
+       mul("w", "w", "W")
+       mul("blendw", "b", "B")
+       id("power", "p", "P")
        if key == "f":
            rotatelist(self.flags)
            print "Flags: ",self.flags[0]
@@ -49,10 +72,10 @@
 
        vs.map.put(getDListNocoords("""
            Color 0 0 0
-           LineWidth 1
+           LineWidth 2
        """))
 
-       fil = GLRen.createSqFilletConnection(self.w[0], self.flags[0])
+       fil = GLRen.createSqFilletConnection(self.w, self.flags[0], 
self.blendw, self.power)
 
        n = 20
 
Index: gzz/gfx/libfillet/Fillet.cxx
diff -u gzz/gfx/libfillet/Fillet.cxx:1.4 gzz/gfx/libfillet/Fillet.cxx:1.5
--- gzz/gfx/libfillet/Fillet.cxx:1.4    Wed Oct 23 05:40:07 2002
+++ gzz/gfx/libfillet/Fillet.cxx        Thu Oct 24 22:57:17 2002
@@ -33,7 +33,7 @@
        return true;
     }
 
-    ZPt FilletDistort::operator() (ZPt p, bool &wasshifted) {
+    ZPt FilletDistort::operator() (ZPt p, bool &wasshifted, float fract) {
        Vec p2c(p-center);
        float x0 = norm.dot(p2c) ;
        float x = x0 / width;
@@ -46,13 +46,13 @@
        }
 
        float t = fabs(x);
-#define BLENDW .125
-       t -= BLENDW;
+       t -= blendw;
        if (t < 0) t = 0;
        if (t > 1) t = 1;
          
        // Blending functions
-       float b = 1 - sqrt(sqrt(1-(1-t)*(1-t)*(1-t)*(1-t))); // distance
+       float b = 1 - pow( 1 - pow( 1-t, power ), 1.0/power);
+       // float b = 1 - sqrt(sqrt(1-(1-t)*(1-t)*(1-t)*(1-t))); // distance
        // float b = 1 - sqrt(1-(1-t)*(1-t)); // distance
        
        if(flags & 1) 
@@ -62,9 +62,9 @@
 
        ZPt res;
        if (t < 1E-4) {
-           int sign = (x > 0 ? 1 : -1);
-           res.x = to.x + sign * BLENDW * width * norm.x;
-           res.y = to.y + sign * BLENDW * width * norm.y;
+           int sign = (fract > 0.5 ? 1 : -1);
+           res.x = to.x + sign * blendw * width * norm.x;
+           res.y = to.y + sign * blendw * width * norm.y;
            res.z = to.z;
            DBG(dbg) << "Result by close range " << res << " from "<<
                    to<<" "<<x<<" "<<width<<" "<<norm<<"\n";
Index: gzz/gfx/libfillet/Fillet.hxx
diff -u gzz/gfx/libfillet/Fillet.hxx:1.5 gzz/gfx/libfillet/Fillet.hxx:1.6
--- gzz/gfx/libfillet/Fillet.hxx:1.5    Wed Oct 23 02:13:04 2002
+++ gzz/gfx/libfillet/Fillet.hxx        Thu Oct 24 22:57:17 2002
@@ -89,16 +89,26 @@
        Vec norm;
        int flags;
 
-       FilletDistort(ZPt center, ZPt to, float width, int flags) :
-           center(center), to(to), width(width), flags(flags) {
+       float blendw;
+       int power;
+
+       FilletDistort(ZPt center, ZPt to, float width, int flags,
+               float blendw, int power) :
+           center(center), to(to), width(width), flags(flags),
+               blendw(blendw), power(power) {
            dir = Vec(to-center).normalize();
            norm = dir.cw90();
            length = Vec(to-center).length();
        }
 
-       ZPt operator() (ZPt p, bool& wasshifted) ;
+       ZPt operator() (ZPt p, bool& wasshifted, float fract) ;
     };
 
+    // Dicer: 
+    //  in: range of A, 
+    //      f: A->B,
+    //      d: B,B->bool  (acceptable difference)
+
     template<class In, class Out, class Shift>
        void shiftEdge(const In &b, 
                        const In &e, 
@@ -107,18 +117,21 @@
        In cur = b;
        In prev = b;
        bool prevshifted, curshifted;;
-       ZPt prevpt = d(*prev, prevshifted);
+       ZPt prevpt = d(*prev, prevshifted, 0);
        *o++ = prevpt;
        if(dbg_origs) *o++ = *prev;
+       int n = e-b-1;
+       int curi = 0;
        while( (++cur) != e) {
-           ZPt curpt = d(*cur, curshifted);
+           float fract = (curi / (float)n);
+           ZPt curpt = d(*cur, curshifted, fract);
            if(curshifted || prevshifted) {
                // Dice...
                const int n = 30;
                bool fooshifted;
                for(int i=1; i<n; i++) {
                    ZPt p = lerp(*prev, *cur, (float)i / n); 
-                   *o++ = d(p, fooshifted);
+                   *o++ = d(p, fooshifted, fract);
                    if(dbg_origs) *o++ = p;
                }
            }
@@ -127,6 +140,7 @@
            prev = cur;
            prevpt = curpt;
            prevshifted = curshifted;
+           curi ++;
        }
     }
 
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.112 
gzz/gfx/librenderables/renderables.py:1.113
--- gzz/gfx/librenderables/renderables.py:1.112 Wed Oct 23 02:13:04 2002
+++ gzz/gfx/librenderables/renderables.py       Thu Oct 24 22:57:18 2002
@@ -293,9 +293,10 @@
 {
     "Type": "2",
     "Name": "SqFilletConnection",
-    "Data": "float width;int flags;",
-    "Params": "float width, int flags",
-    "ParamCode": "this->width = width; this->flags = flags; ",
+    "Data": "float width;int flags; float blendw; int power;",
+    "Params": "float width, int flags, float blendw, int power",
+    "ParamCode": """this->width = width; this->flags = flags;
+               this->blendw = blendw; this->power = power; """,
     "RenderCode" : """
            vector<ZPt> sq1;
            vector<ZPt> sq2;
@@ -311,8 +312,8 @@
            ZPt ctr2 = coords2.transform(ZPt(.5, .5, 0));
            ZPt mid = 0.5*(ctr1 + ctr2);
 
-           Fillet::FilletDistort d1(ctr1, mid, width, flags);
-           Fillet::FilletDistort d2(ctr2, mid, width, flags);
+           Fillet::FilletDistort d1(ctr1, mid, width, flags, blendw, power);
+           Fillet::FilletDistort d2(ctr2, mid, width, flags, blendw, power);
 
            vector<ZPt> o1;
            if(!Fillet::blendEdge(sq1.begin(), sq1.end(), 
Index: gzz/gzz/view/xubuoy.py
diff -u gzz/gzz/view/xubuoy.py:1.26 gzz/gzz/view/xubuoy.py:1.27
--- gzz/gzz/view/xubuoy.py:1.26 Sun Oct 20 05:55:57 2002
+++ gzz/gzz/view/xubuoy.py      Thu Oct 24 22:57:18 2002
@@ -107,6 +107,7 @@
 
 
 lineconn = GLRen.createLineConnector(0,0)
+filletconn = GLRen.createSqFilletConnection(40, 1, .1, 6)
 
 class XuPDFBuoy:
     def __init__(self, linkindex, link, enfoverlap):
@@ -161,12 +162,24 @@
            mainp = mainlinkspan.getLocation()
            mainoffsp = globalspan.getLocation()
            maind = mainlinkspan.getSize()
-           mainpoint = globalview.paperpoint(mainpage,  
mainp.x-mainoffsp.x+0.5*maind.width,
-                                                   
mainp.y-mainoffsp.y+0.5*maind.height)
+
+           mup = globalview.paperpoint(mainpage, mainp.x + mainoffsp.x, 
mainp.y - mainoffsp.y)
+           mlp = globalview.paperpoint(mainpage, mainp.x + mainoffsp.x + 
maind.width, 
+                                               mainp.y - mainoffsp.y + 
maind.height)
+           ms = (mlp[0]-mup[0], mlp[1]-mup[1])
+
+           # mainpoint = globalview.paperpoint(mainpage,  
mainp.x-mainoffsp.x+0.5*maind.width,
+       #                                           
mainp.y-mainoffsp.y+0.5*maind.height)
         else:
-            mainpoint = (0, 0)
+           mup = (0,0)
+           mlp = (0,0)
+           ms = (0,0)
+            # mainpoint = (0, 0)
             
-        main_end_cs = vs.coords.ortho(maincs, -20, mainpoint[0], mainpoint[1], 
0, 0)
+       mainpoint = mup
+#        main_end_cs = vs.coords.ortho(maincs, -20, mainpoint[0], 
mainpoint[1], 0, 0)
+        main_whole_cs = vs.coords.ortho(maincs, -20, mup[0], mup[1], ms[0], 
ms[1])
+        main_end_cs = vs.coords.translate(main_whole_cs, .5, .5, 0)
 
        cs1 = floater.buoyCoordsys(main_end_cs, self.cell.getId())
 
@@ -196,13 +209,18 @@
 
            # Then, the xu link connector
 
-           link_end_cs = vs.coords.ortho(cs1_trans, -20, self.pctr[0], 
self.pctr[1], 0, 0)
+           link_whole_cs = vs.coords.ortho(cs1_trans, -20, 
+               self.p0[0], self.p0[1], self.p1[0]-self.p0[0],
+                       self.p1[1]-self.p0[1])
+           link_end_cs = vs.coords.translate(link_whole_cs, .5, .5, 0)
             
         else:
             puttext(cell, vs, cs1, 1.2)
             
             link_end_cs = vs.coords.ortho(cs1, -20, 0, 0, 0, 0)
 
+       vs.matcher.add(main_whole_cs, 
"wlink"+str(self.link)+str(self.linkindex))
+       vs.matcher.add(link_whole_cs, 
"wlink"+str(self.link)+str(1-self.linkindex))
        vs.matcher.add(main_end_cs, "link"+str(self.link)+str(self.linkindex))
        vs.matcher.add(link_end_cs, "link"+str(self.link)+str(1-self.linkindex))
 
@@ -214,7 +232,10 @@
            Enable BLEND
            Color 0 0 0 0.6
        """))
+
        vs.map.put(lineconn, main_end_cs, link_end_cs)
+       vs.map.put(filletconn, main_whole_cs, link_whole_cs)
+
        vs.map.put(GLCache.getCallList("""
            PopAttrib
        """))
@@ -528,8 +549,7 @@
            eye, eye, *(self.modes[0].mag))
        vs.matcher.add(cs1_zoom, self.cursor.getId()+"__bulg") 
 
-       cs1_trans = vs.coords.translate(cs1_zoom, 
-               -globalx, -globaly + focusy_at)
+       cs1_trans = vs.coords.translate(cs1_zoom, -globalx, -globaly + 
focusy_at)
        vs.matcher.add(cs1_trans, self.cursor.getId()+"__trans") 
 
        if self.clip:




reply via email to

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