gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx librenderables/renderables.py libcolor/...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx librenderables/renderables.py libcolor/...
Date: Fri, 27 Sep 2002 07:55:28 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/09/27 07:55:28

Modified files:
        gfx/librenderables: renderables.py 
        gfx/libcolor   : spaces.py 
        gfx/demo       : papertest.py 

Log message:
        Really fix coordinate systems in papertest.py: cs2 must be stretched 
(inversely) to match cs1 size

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.70&tr2=1.71&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcolor/spaces.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/papertest.py.diff?tr1=1.30&tr2=1.31&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/papertest.py
diff -c gzz/gfx/demo/papertest.py:1.30 gzz/gfx/demo/papertest.py:1.31
*** gzz/gfx/demo/papertest.py:1.30      Fri Sep 27 06:01:30 2002
--- gzz/gfx/demo/papertest.py   Fri Sep 27 07:55:28 2002
***************
*** 82,90 ****
  
  
  zoom = [100.0, 500.0, 650.0, 800.0, 2000.0]
! #paperzoom = [2, 10, 33, 100]
! #paperzoom = [0.2, 1, 3, 0.05]
! paperzoom = [100.0, 200.0, 400.0, 800.0]
  
  passmask = [1,1,1,1]
  
--- 82,89 ----
  
  
  zoom = [100.0, 500.0, 650.0, 800.0, 2000.0]
! paperzoom = [0.2, 1, 3, 0.05]
! 
  
  passmask = [1,1,1,1]
  
***************
*** 164,170 ****
  
        cs1 = vs.coords.affineCoordsys(0, 10, 700, 500, 700, 0, 0, 450)
        scale = zoom[0] / paperzoom[0]
!       cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale, 0, 0, scale)
  
        vs.matcher.add(cs1, "1")
        vs.matcher.add(cs2, "2")
--- 163,169 ----
  
        cs1 = vs.coords.affineCoordsys(0, 10, 700, 500, 700, 0, 0, 450)
        scale = zoom[0] / paperzoom[0]
!       cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale / 700, 0, 0, scale / 
450)
  
        vs.matcher.add(cs1, "1")
        vs.matcher.add(cs2, "2")
***************
*** 225,232 ****
      def scene(self, vs):
        putnoc(vs, background(self.bgcolor))
  
        scale = zoom[0] / paperzoom[0]
!       cs2 = vs.coords.affineCoordsys(0, 1, 400, 400, scale, 0, 0, scale)
          vs.matcher.add(cs2, "tex")
  
          cs1 = range(0,self.w*self.h)
--- 224,235 ----
      def scene(self, vs):
        putnoc(vs, background(self.bgcolor))
  
+ 
+         cs1w = .47*1200.0/self.w
+         cs1h = .47*900.0/self.h
+ 
        scale = zoom[0] / paperzoom[0]
!       cs2 = vs.coords.affineCoordsys(0, 1, 0, 0, scale/cs1w, 0, 0, scale/cs1h)
          vs.matcher.add(cs2, "tex")
  
          cs1 = range(0,self.w*self.h)
***************
*** 235,242 ****
              cs1[i] = vs.coords.affineCoordsys(0, 100-i,
                                                (i%self.w+.5)*1200.0/self.w,
                                                (i/self.w+.5)*900.0/self.h,
!                                               .47*1200.0/self.w, 0,
!                                               0, .47*900.0/self.h)
              vs.matcher.add(cs1[i], str(i))
              
              vs.map.put(self.pq[i], cs1[i], cs2)
--- 238,244 ----
              cs1[i] = vs.coords.affineCoordsys(0, 100-i,
                                                (i%self.w+.5)*1200.0/self.w,
                                                (i/self.w+.5)*900.0/self.h,
!                                               cs1w, 0, 0, cs1h)
              vs.matcher.add(cs1[i], str(i))
              
              vs.map.put(self.pq[i], cs1[i], cs2)
Index: gzz/gfx/libcolor/spaces.py
diff -c gzz/gfx/libcolor/spaces.py:1.6 gzz/gfx/libcolor/spaces.py:1.7
*** gzz/gfx/libcolor/spaces.py:1.6      Wed Sep 25 07:28:11 2002
--- gzz/gfx/libcolor/spaces.py  Fri Sep 27 07:55:28 2002
***************
*** 80,85 ****
--- 80,106 ----
  
      return LABclamp(rgb)
  
+ 
+ def getRandomColor3(minL, maxL, hue_avg, hue_sd, rnd):
+     """Get a random color deterministically with Gaussian hue
+ 
+     minL, maxL: minimum and maximum luminance value
+     hue_avg, hue_sd: hue distribution parameters in degerees
+     rnd: a random number generator, corresponding to
+       java.util.Random for the API. The same color
+       is always returned if the PRNG returns the
+       same list of values.
+     """
+     rgb = [-1]
+     L = minL + (maxL - minL) * rnd.nextDouble()
+     ang = (hue_avg + rnd.nextGaussian() * hue_sd) / 180 * math.pi
+     a = 100 * math.cos(ang)
+     b = 100 * math.sin(ang)
+     rgb = LABtoRGB([L,a,b])
+ 
+     return LABclamp(rgb)
+ 
+ 
  def LABclamp(rgb):
      """Clamp a RGB color into [0,1]^3 towards the CIELAB L-axis 
  
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.70 
gzz/gfx/librenderables/renderables.py:1.71
*** gzz/gfx/librenderables/renderables.py:1.70  Fri Sep 27 07:11:52 2002
--- gzz/gfx/librenderables/renderables.py       Fri Sep 27 07:55:27 2002
***************
*** 554,560 ****
  }    ,
  
  
! # coords1: paper => object
  # coords2: tearaway => paper (assumed to be affine)
  # The paper is [-paperw,paperw]x[-paperh,paperh] in paper coordinates and
  # the tearaway part is [-1,1]x[-1,1] in tearaway coordinates.
--- 554,560 ----
  }    ,
  
  
! # coords1: paper => window
  # coords2: tearaway => paper (assumed to be affine)
  # The paper is [-paperw,paperw]x[-paperh,paperh] in paper coordinates and
  # the tearaway part is [-1,1]x[-1,1] in tearaway coordinates.




reply via email to

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