gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/librenderables Renderables.hxx renderab...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/librenderables Renderables.hxx renderab...
Date: Tue, 17 Sep 2002 04:04:52 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/09/17 04:04:52

Modified files:
        gfx/librenderables: Renderables.hxx renderables.py 

Log message:
        Add AffineCoords::getInverse() method and use it in fisheye

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.35&tr2=1.36&r1=text&r2=text

Patches:
Index: gzz/gfx/librenderables/Renderables.hxx
diff -c gzz/gfx/librenderables/Renderables.hxx:1.10 
gzz/gfx/librenderables/Renderables.hxx:1.11
*** gzz/gfx/librenderables/Renderables.hxx:1.10 Sun Sep 15 06:22:13 2002
--- gzz/gfx/librenderables/Renderables.hxx      Tue Sep 17 04:04:52 2002
***************
*** 118,123 ****
--- 118,133 ----
            z = other.z + zoffs;
        }
  
+         /** Return the inverse of this coordinate system 
+        */
+         AffineCoords getInverse() const {
+         float m = 1.0 / (x.x * y.y - x.y * y.x);
+         AffineCoords r(Pt(0, 0), Vec(m * y.y, -m * x.y), Vec(-m * y.x, m * 
x.x));
+         r.center -= center.x * r.x + center.y * r.y;
+         r.z = -z;
+         return r;
+       }
+ 
        void dump() {
            cout << "Affinecoords: ";
            cout << center << " " << x << " " << y << " " << z <<"\n\n";
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.35 
gzz/gfx/librenderables/renderables.py:1.36
*** gzz/gfx/librenderables/renderables.py:1.35  Tue Sep 17 01:48:39 2002
--- gzz/gfx/librenderables/renderables.py       Tue Sep 17 04:04:52 2002
***************
*** 442,453 ****
            ZVec paperx = coords1.transform(Pt(1, 0)) - paperorigin;
            ZVec papery = coords1.transform(Pt(0, 1)) - paperorigin;
  
!             ZPt borig = coords2.transform(Pt(0, 0));
!             ZVec b0 =  coords2.transform(Pt(1, 0)) - borig;
!             ZVec b1 =  coords2.transform(Pt(0, 1)) - borig;
! 
!             b0 = 1.0 / (b0.x * b0.x + b0.y * b0.y) * b0;
!             b1 = 1.0 / (b1.x * b1.x + b1.y * b1.y) * b1;
  
              #if 0
              {
--- 442,448 ----
            ZVec paperx = coords1.transform(Pt(1, 0)) - paperorigin;
            ZVec papery = coords1.transform(Pt(0, 1)) - paperorigin;
  
!             AffineCoords cs2inv = coords2.getInverse();
  
              #if 0
              {
***************
*** 527,544 ****
                      for (float y = y_; i < 2; i++, y += ystep) {
                        glTexCoord2f(x, y);
  
!                       // Map (x,y) into coords2 as (a,b)
                        
                        ZPt pos = coords1.transform(Pt(x,y));
!                       float a = b0.dot(pos - borig);
!                       float b = b1.dot(pos - borig);
!                       float c = pos.z - borig.z;
  
                        // Modulate distance from coords2 origin
!                       float t = (1 + a * a + b * b);
!                       float m = 1 + c / t;
  
!                       coords2.vertex(ZPt(m*a, m*b, c));
                      }
                    }
                    glEnd();
--- 522,537 ----
                      for (float y = y_; i < 2; i++, y += ystep) {
                        glTexCoord2f(x, y);
  
!                       // Map (x,y) into coords2 as v
                        
                        ZPt pos = coords1.transform(Pt(x,y));
!                       ZPt v = cs2inv.transform(pos);
  
                        // Modulate distance from coords2 origin
!                       float t = (1 + v.x * v.x + v.y * v.y);
!                       float m = 1 + v.z / t;
  
!                       coords2.vertex(ZPt(m*v.x, m*v.y, v.z));
                      }
                    }
                    glEnd();




reply via email to

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