gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/libpaper colors.py texcoords.py


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/libpaper colors.py texcoords.py
Date: Fri, 06 Sep 2002 08:35:01 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/09/06 08:35:01

Modified files:
        gfx/libpaper   : colors.py texcoords.py 

Log message:
        Fix CONSTANT_COLOR scaling (cannot be negative); fix expected angle 
between basis vectors; fix related repeat unit computation

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/colors.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texcoords.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gzz/gfx/libpaper/colors.py
diff -c gzz/gfx/libpaper/colors.py:1.2 gzz/gfx/libpaper/colors.py:1.3
*** gzz/gfx/libpaper/colors.py:1.2      Wed Sep  4 03:37:10 2002
--- gzz/gfx/libpaper/colors.py  Fri Sep  6 08:35:01 2002
***************
*** 30,38 ****
        return self.colors[ind%len(self.colors)]
  
      def _randvec2(self):
!       x = 2 * self.rnd.nextDouble() - 1
!       y = 2 * self.rnd.nextDouble() - 1
!       z = 2 * self.rnd.nextDouble() - 1
        return [x, y, z]
  
      def getNVDP3VecStr(self, ind):
--- 30,41 ----
        return self.colors[ind%len(self.colors)]
  
      def _randvec2(self):
!       #x = 2 * self.rnd.nextDouble() - 1
!       #y = 2 * self.rnd.nextDouble() - 1
!       #z = 2 * self.rnd.nextDouble() - 1
!       x = self.rnd.nextDouble()
!       y = self.rnd.nextDouble()
!       z = self.rnd.nextDouble()
        return [x, y, z]
  
      def getNVDP3VecStr(self, ind):
Index: gzz/gfx/libpaper/texcoords.py
diff -c gzz/gfx/libpaper/texcoords.py:1.9 gzz/gfx/libpaper/texcoords.py:1.10
*** gzz/gfx/libpaper/texcoords.py:1.9   Tue Sep  3 09:18:08 2002
--- gzz/gfx/libpaper/texcoords.py       Fri Sep  6 08:35:01 2002
***************
*** 70,76 ****
            return
  
        # The angle between the basis vectors
!       angle = (.25 + angle_stddev*rnd.nextGaussian()) * math.pi
        angle *= 1 - 2 * rnd.nextBoolean()
  
  
--- 70,76 ----
            return
  
        # The angle between the basis vectors
!       angle = (.25 + angle_stddev*rnd.nextGaussian()) * 2 * math.pi
        angle *= 1 - 2 * rnd.nextBoolean()
  
  
***************
*** 92,98 ****
  
        # The vectors that give x and y when dotted with (s, t, 0, 1)
        self.vecs = [[ rs * math.cos(as), rt * math.cos(at)],
!              [ rs * math.sin(as), rt * math.sin(at)]]
  
      def _getSTVectors(self, rnd):
        """Get the 2 4-component vectors that (x,y,0,1) should
--- 92,98 ----
  
        # The vectors that give x and y when dotted with (s, t, 0, 1)
        self.vecs = [[ rs * math.cos(as), rt * math.cos(at)],
!                      [ rs * math.sin(as), rt * math.sin(at)]]
  
      def _getSTVectors(self, rnd):
        """Get the 2 4-component vectors that (x,y,0,1) should
***************
*** 151,159 ****
        a,b,c,d = chooseInts(rnd)
        # 1 / determinant
        f = 1.0 / (a * d - b * c)
!       vecs = [ [ f * self.vecs[1][1], -f*self.vecs[0][1] ],
!                [ -f*self.vecs[1][0], f*self.vecs[0][0] ]
!                ]
        return TexGenXYRepeatUnit(vecs=vecs)
  
  class TexGen3DSlice:
--- 151,168 ----
        a,b,c,d = chooseInts(rnd)
        # 1 / determinant
        f = 1.0 / (a * d - b * c)
!         vecs = [ [ f * d * self.vecs[0][0] - f * b * self.vecs[0][1], -f * c 
* self.vecs[0][0] + f * a * self.vecs[0][1] ],
!                  [ f * d * self.vecs[1][0] - f * b * self.vecs[1][1], -f * c 
* self.vecs[1][0] + f * a * self.vecs[1][1] ] ]
! 
!         # Note that the 'vecs' matrix stores the parallelogram side vectors 
as its columns
!         # The debug prints below show that 'vecs' correctly solves the 
equation
!         if 0:
!             print "S: ", [self.vecs[0][0], self.vecs[1][0]]
!             print "T: ", [self.vecs[0][1], self.vecs[1][1]]
!             print "a S' + b T':", [a*vecs[0][0]+b*vecs[0][1], 
a*vecs[1][0]+b*vecs[1][1]]
!             print "c S' + d T':", [c*vecs[0][0]+d*vecs[0][1], 
c*vecs[1][0]+d*vecs[1][1]]
!             print "a,b,c,d:", a,b,c,d
! 
        return TexGenXYRepeatUnit(vecs=vecs)
  
  class TexGen3DSlice:




reply via email to

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