gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO gfx/demo/xupdf.py gfx/libcoords/Coor...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/demo/xupdf.py gfx/libcoords/Coor...
Date: Fri, 27 Sep 2002 02:34:54 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/27 02:34:53

Modified files:
        .              : TODO 
        gfx/demo       : xupdf.py 
        gfx/libcoords  : Coords.cxx Coords.hxx 
        gfx/librenderables: renderables.py 
        gfx/libutil    : effects.py 
        gzz/vob/buoy   : Buoy3Floater.java 

Log message:
        Now distorted paper works to at least some degree.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.148&tr2=1.149&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xupdf.py.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/effects.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/buoy/Buoy3Floater.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -c gzz/TODO:1.148 gzz/TODO:1.149
*** gzz/TODO:1.148      Thu Sep 26 14:39:24 2002
--- gzz/TODO    Fri Sep 27 02:34:53 2002
***************
*** 108,113 ****
--- 108,118 ----
  
            - multiple instances of same pdf / text visible? --> keys?
  
+       + if performance problems, redesign coordsys to allow
+         concatenation, reading only parameters and template
+         compilation of renderables.
+           - statistics of what coordinate systems used inside
+             each other how much ==> which to templatize
        + redesign mosaics to save memory and allow more internal
          formats + at the same time, mipmapping improvements
      anybody:
Index: gzz/gfx/demo/xupdf.py
diff -c gzz/gfx/demo/xupdf.py:1.21 gzz/gfx/demo/xupdf.py:1.22
*** gzz/gfx/demo/xupdf.py:1.21  Tue Sep 24 03:26:48 2002
--- gzz/gfx/demo/xupdf.py       Fri Sep 27 02:34:53 2002
***************
*** 226,262 ****
        pointy * pscale * scale,
      )
  
! def placepapers(vs, cs2, papers, key, x, y, paperx, papery, h, 
onlypages=None, depth=10,
                cliprect = None):
      # The height in coords
      ph = papers[0][1][2]
      scale = h/ph
!     curx = x - paperx * scale
!     ycoord = y - papery * scale
      # print "x,y for place: ",curx, ycoord
      # print papers
      grid = 13
!     if cliprect == None:
!       fishargs = (0, 0, papers[0][1][1], papers[0][1][2], grid, grid, 1)
!     else:
!       pscale = 1 / 72.0 / 6
!       fishargs = (cliprect[0]*pscale, cliprect[1]*pscale,
!                   cliprect[2]*pscale, cliprect[3]*pscale, grid, grid, 3)
      for i in range(0, len(papers)):
        # create always all cs, gets interpolation better
!       cs1 = vs.coords.affineCoordsys(0, key+"_p_"+str(i), 100,
                curx, ycoord, scale, 0, 0, scale)
        if onlypages == None or i in onlypages:
            if globalusefancypaper:
!               pq = GLRen.createFisheyePaperQuad(
!                   papers[i][0], *fishargs)
                vs.map.put(pq, cs1, cs2)
!               pq = GLRen.createFisheyePaperQuad(
!                   papers[i][1][3], *fishargs)
                vs.map.put(pq, cs1, cs2)
            else:
!               pq = GLRen.createFisheyePaperQuad(
!                   papers[i][1][0], *fishargs)
                vs.map.put(pq, cs1, cs2)
        curx += 1.02 *  papers[i][1][1] * scale
  
--- 226,264 ----
        pointy * pscale * scale,
      )
  
! # Height = always 1.
! # Start = always (0,0)
! def placepapers(vs, cs1into, papers, key, onlypages=None, depth=10,
                cliprect = None):
      # The height in coords
+     h = 1
      ph = papers[0][1][2]
      scale = h/ph
!     curx = 0
!     ycoord = 0
      # print "x,y for place: ",curx, ycoord
      # print papers
      grid = 13
!     corners = (0, 0, papers[0][1][1], papers[0][1][2])
!     cs2 = vs.coords.affineCoordsys(0, 0,
!           0, 0, 1, 0, 0, 1)
!     vs.matcher.add(cs2, key+"_p2_") 
      for i in range(0, len(papers)):
        # create always all cs, gets interpolation better
!       cs1 = vs.coords.affineCoordsys(cs1into, 100,
                curx, ycoord, scale, 0, 0, scale)
+       vs.matcher.add(cs1, key+"_p_"+str(i)) 
        if onlypages == None or i in onlypages:
            if globalusefancypaper:
!               pq = GLRen.createPaperQuad(
!                   papers[i][0], *corners)
                vs.map.put(pq, cs1, cs2)
!               pq = GLRen.createPaperQuad(
!                   papers[i][1][3], *corners)
                vs.map.put(pq, cs1, cs2)
            else:
!               pq = GLRen.createPaperQuad(
!                   papers[i][1][0], *corners)
                vs.map.put(pq, cs1, cs2)
        curx += 1.02 *  papers[i][1][1] * scale
  
***************
*** 383,401 ****
      def scene(self, vs):
        bg(vs)
        print globalpap
-       cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg", 
self.mag[0], 
-               0, globaly / globalpap[0][1][2] * screensize[1] - 
screensize[1]/2, 
-                   80, 0,0, 80)
        bf = NadirCircleFloater_NoAnchor(vs, 
                screenctr,  100, None, 1)
!       class CentralB(Runnable):
!           def run(rself):
!               placepapers(vs, cs2, globalpap, globalcursor.getId(), 0,
!                       globaly / globalpap[0][1][2] * screensize[1] - 
!                                                       screenctr[1], 
!                           globalx, globaly, 
!                           screensize[1] * (self.mag[0]/(0.3+self.mag[0])))
!       bf.addCentralBuoy(globalcursor.getId(), CentralB())
  
  currentScene = XuPDFScene_PDFZoom()
  moveToCell(cells[0])
--- 385,399 ----
      def scene(self, vs):
        bg(vs)
        print globalpap
        bf = NadirCircleFloater_NoAnchor(vs, 
                screenctr,  100, None, 1)
!       cs1 = bf.addCentralBuoy(globalcursor.getId())
!       # cs1_zoom = vs.coords.affineCoordsys(cs1, 0, 0, 0, 
!       #     100, 0, 0, 100)
!       cs1_zoom= vs.coords.distort(cs1, 0, 0, 1, 1, 500, 100)
!       vs.matcher.add(cs1_zoom, globalcursor.getId()+"__bulg") 
!       placepapers(vs, cs1_zoom, globalpap, globalcursor.getId())
!                   
  
  currentScene = XuPDFScene_PDFZoom()
  moveToCell(cells[0])
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.11 gzz/gfx/libcoords/Coords.cxx:1.12
*** gzz/gfx/libcoords/Coords.cxx:1.11   Thu Sep 26 14:39:24 2002
--- gzz/gfx/libcoords/Coords.cxx        Fri Sep 27 02:34:53 2002
***************
*** 129,134 ****
--- 129,136 ----
       * of the zoomed area.
       */
      class DistortCoords : public CoordSys {
+       float x, y;
+       float w, h;
        float mmin;
        float mmax;
        Fisheye::vector_mag_isotropic<Fisheye::scalar_mag_atan> distort;
***************
*** 136,143 ****
--- 138,149 ----
        enum { NParams = 6 };
        virtual void setParams(float *params) {
            CoordSys::setParams(params);
+           x = params[0];
+           y = params[1];
            mmax = exp(params[2]);
            mmin = exp(params[3]);
+           w = params[4];
+           h = params[5];
            distort.f = Fisheye::scalar_mag_atan(mmax / mmin);
        }
        virtual ZPt transform(const ZPt &p) const {
***************
*** 151,157 ****
            super->vertex(mp);
        }
        void tr(const ZPt &from, ZPt &to) const {
!           to = distort(from);
            to.x *= mmin;
            to.y *= mmin;
        }
--- 157,166 ----
            super->vertex(mp);
        }
        void tr(const ZPt &from, ZPt &to) const {
!           ZPt p = ZPt((from.x-x) / w, (from.y-y)/ h, from.z);
!           to = distort(p);
!           to.x *= w; to.y *= h;
!           to.x += x; to.y += y;
            to.x *= mmin;
            to.y *= mmin;
        }
Index: gzz/gfx/libcoords/Coords.hxx
diff -c gzz/gfx/libcoords/Coords.hxx:1.7 gzz/gfx/libcoords/Coords.hxx:1.8
*** gzz/gfx/libcoords/Coords.hxx:1.7    Thu Sep 26 14:39:24 2002
--- gzz/gfx/libcoords/Coords.hxx        Fri Sep 27 02:34:53 2002
***************
*** 56,62 ****
         * The return value is 1/l where l would be a reasonable length for 
dicing.
         * Returns 0 if dicing is required.
         */
!       virtual float nonlinearity(const ZPt &p, float radius) { return 0; }
  
        /** Whether this transformation can be performed by OpenGL
         * alone.
--- 56,64 ----
         * The return value is 1/l where l would be a reasonable length for 
dicing.
         * Returns 0 if dicing is required.
         */
!       virtual float nonlinearity(const ZPt &p, float radius) { 
!           return super->nonlinearity(transform(p), radius); 
!       }
  
        /** Whether this transformation can be performed by OpenGL
         * alone.
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.66 
gzz/gfx/librenderables/renderables.py:1.67
*** gzz/gfx/librenderables/renderables.py:1.66  Thu Sep 26 14:39:24 2002
--- gzz/gfx/librenderables/renderables.py       Fri Sep 27 02:34:53 2002
***************
*** 318,323 ****
--- 318,329 ----
        """
  },
  
+ # PaperQuad is a bit complicated: there are three coordinate
+ # systems here: the window cs, the object cs and the paper cs.
+ # cs1 is object => window,
+ # and cs2 is paper => object.
+ # Corners give the corners of the quad to render, in object
+ # coordinates.
  {
      "Type" : "2",
      "Name": "PaperQuad",
Index: gzz/gfx/libutil/effects.py
diff -c gzz/gfx/libutil/effects.py:1.5 gzz/gfx/libutil/effects.py:1.6
*** gzz/gfx/libutil/effects.py:1.5      Thu Sep 26 09:15:21 2002
--- gzz/gfx/libutil/effects.py  Fri Sep 27 02:34:53 2002
***************
*** 62,68 ****
        self.dir = dir
        self.ind = 0
        self.angles = [0.2 * 2*math.pi, 0.4 * 2*math.pi]
!     def addBuoy(self, anchorX, anchorY, importance, key, buoy, w, h):
        size = importance
  
        # 1. find the buoy point
--- 62,68 ----
        self.dir = dir
        self.ind = 0
        self.angles = [0.2 * 2*math.pi, 0.4 * 2*math.pi]
!     def addBuoy(self, anchorX, anchorY, importance, key, w, h):
        size = importance
  
        # 1. find the buoy point
***************
*** 90,105 ****
        # ac = vs.coords.coordsys(0, str(key)+"_5", 10, anchorX, anchorY, 0, 0)
        # bc = vs.coords.coordsys(0, str(key)+"_6", 10, b[0], b[1], 0, 0)
        # vs.map.put(self.linecon, ac, bc)
!     def addCentralBuoy(self, key, buoy):
! 
        b = self.c
        size = 1
        vs = self.vs
!       transaffine(vs, str(key)+"_1", b[0], b[1], size, 0, 0, size)
!       rotate(vs, str(key)+"_2", 0, 0, 0, 1)
!       buoy.run()
!       poptrans(vs, str(key)+"_2")
!       poptrans(vs, str(key)+"_1")
  
        
  
--- 90,105 ----
        # ac = vs.coords.coordsys(0, str(key)+"_5", 10, anchorX, anchorY, 0, 0)
        # bc = vs.coords.coordsys(0, str(key)+"_6", 10, b[0], b[1], 0, 0)
        # vs.map.put(self.linecon, ac, bc)
!     def addCentralBuoy(self, key):
        b = self.c
        size = 1
        vs = self.vs
!       cs = vs.coords.affineCoordsys(0, 100, b[0], b[1], size, 0, 0, size)
!       vs.matcher.add(cs, str(key)+"_1") 
! 
!       cs2 = vs.coords.rotateXY(cs, 0)
!       vs.matcher.add(cs2, str(key)+"_2") 
!       return cs2
  
        
  
Index: gzz/gzz/vob/buoy/Buoy3Floater.java
diff -c gzz/gzz/vob/buoy/Buoy3Floater.java:1.3 
gzz/gzz/vob/buoy/Buoy3Floater.java:1.4
*** gzz/gzz/vob/buoy/Buoy3Floater.java:1.3      Wed Sep 18 21:20:05 2002
--- gzz/gzz/vob/buoy/Buoy3Floater.java  Fri Sep 27 02:34:53 2002
***************
*** 25,30 ****
--- 25,31 ----
  
  /** An interface to buoy layouts. As opposed to Buoy2, here we start by 
   * the idea that we will have several different layouts.
+  * XXX Delayed until all buoys there? Or modify coords?
   */
  
  public interface Buoy3Floater {
***************
*** 36,49 ****
       *           It is not guaranteed that this runnable will ever be called, 
if the buoy
       *           layout decides that there is too much crowding.
       * @param w,h The width and height, centered around the origin of the 
coordinate system.
       */
!     void addBuoy(float anchorX, float anchorY, float importance,
!                   Object key, Runnable buoy, float w, float h);
  
      /** Add the given "buoy" as a central system (the coordinates
       * are not modified except by translation). 
       * This is so that it will be easy to animate
       * between buoy coord systems and the center.
       */
!     void addCentralBuoy(Object key, Runnable buoy);
  }
--- 37,51 ----
       *           It is not guaranteed that this runnable will ever be called, 
if the buoy
       *           layout decides that there is too much crowding.
       * @param w,h The width and height, centered around the origin of the 
coordinate system.
+      * @return The new coordinate system.
       */
!     int addBuoy(float anchorX, float anchorY, float importance,
!                   Object key, float w, float h);
  
      /** Add the given "buoy" as a central system (the coordinates
       * are not modified except by translation). 
       * This is so that it will be easy to animate
       * between buoy coord systems and the center.
       */
!     int addCentralBuoy(Object key);
  }




reply via email to

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