/[gzz]/gzz/gfx/libcolor/spaces.py
ViewVC logotype

Diff of /gzz/gfx/libcolor/spaces.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by jvk, Wed Sep 25 11:28:11 2002 UTC revision 1.7 by jvk, Fri Sep 27 11:55:28 2002 UTC
# Line 80  def getRandomColor2(minL, maxL, rnd): Line 80  def getRandomColor2(minL, maxL, rnd):
80    
81      return LABclamp(rgb)      return LABclamp(rgb)
82    
83    
84    def getRandomColor3(minL, maxL, hue_avg, hue_sd, rnd):
85        """Get a random color deterministically with Gaussian hue
86    
87        minL, maxL: minimum and maximum luminance value
88        hue_avg, hue_sd: hue distribution parameters in degerees
89        rnd: a random number generator, corresponding to
90            java.util.Random for the API. The same color
91            is always returned if the PRNG returns the
92            same list of values.
93        """
94        rgb = [-1]
95        L = minL + (maxL - minL) * rnd.nextDouble()
96        ang = (hue_avg + rnd.nextGaussian() * hue_sd) / 180 * math.pi
97        a = 100 * math.cos(ang)
98        b = 100 * math.sin(ang)
99        rgb = LABtoRGB([L,a,b])
100    
101        return LABclamp(rgb)
102    
103    
104  def LABclamp(rgb):  def LABclamp(rgb):
105      """Clamp a RGB color into [0,1]^3 towards the CIELAB L-axis      """Clamp a RGB color into [0,1]^3 towards the CIELAB L-axis
106    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26