/[gzz]/gzz/gfx/libpaper/texcoords.py
ViewVC logotype

Diff of /gzz/gfx/libpaper/texcoords.py

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

revision 1.16 by tjl, Wed Oct 23 13:45:37 2002 UTC revision 1.17 by jvk, Fri Oct 25 14:20:15 2002 UTC
# Line 1  Line 1 
1  # Texture coordinates  # Texture coordinates
2  from __future__ import nested_scopes  from __future__ import nested_scopes
3  import math  import math
4    from math import sqrt
5    
6  def smallIntegerG0(rnd):  def smallIntegerG0(rnd):
7      """Return a small integer greater than 0.      """Return a small integer greater than 0.
# Line 146  class TexGenXYRepeatUnit: Line 147  class TexGenXYRepeatUnit:
147          """          """
148    
149          def chooseInts(rnd):          def chooseInts(rnd):
150              a,b,c,d = 0,0,0,0              while 1:
151              while a*d-b*c == 0:                  a,b,c,d = [int(2*rnd.nextGaussian()**3) for i in range(0,4)]
152                  a,b,c,d = [int(0.5*rnd.nextGaussian()) for i in range(0,4)]                  l1 = sqrt(a*a + b*b)
153                    l2 = sqrt(c*c + d*d)
154                    det = a*d-b*c
155                    if det == 0: continue
156                    if l1 * l2 / det > 2: continue
157                    if abs(math.log(l1 / l2)) > .7: continue
158                    break
159                
160              return (a,b,c,d)              return (a,b,c,d)
161            
162          a,b,c,d = chooseInts(rnd)          a,b,c,d = chooseInts(rnd)
163          # 1 / determinant          # 1 / determinant
164          f = 1.0 / (a * d - b * c)          f = 1.0 / (a * d - b * c)

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

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