/[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.9 by tjl, Tue Sep 3 13:18:08 2002 UTC revision 1.10 by jvk, Fri Sep 6 12:35:01 2002 UTC
# Line 70  class TexGenXYRepeatUnit: Line 70  class TexGenXYRepeatUnit:
70              return              return
71    
72          # The angle between the basis vectors          # The angle between the basis vectors
73          angle = (.25 + angle_stddev*rnd.nextGaussian()) * math.pi          angle = (.25 + angle_stddev*rnd.nextGaussian()) * 2 * math.pi
74          angle *= 1 - 2 * rnd.nextBoolean()          angle *= 1 - 2 * rnd.nextBoolean()
75    
76    
# Line 92  class TexGenXYRepeatUnit: Line 92  class TexGenXYRepeatUnit:
92    
93          # The vectors that give x and y when dotted with (s, t, 0, 1)          # The vectors that give x and y when dotted with (s, t, 0, 1)
94          self.vecs = [[ rs * math.cos(as), rt * math.cos(at)],          self.vecs = [[ rs * math.cos(as), rt * math.cos(at)],
95                 [ rs * math.sin(as), rt * math.sin(at)]]                       [ rs * math.sin(as), rt * math.sin(at)]]
96    
97      def _getSTVectors(self, rnd):      def _getSTVectors(self, rnd):
98          """Get the 2 4-component vectors that (x,y,0,1) should          """Get the 2 4-component vectors that (x,y,0,1) should
# Line 151  class TexGenXYRepeatUnit: Line 151  class TexGenXYRepeatUnit:
151          a,b,c,d = chooseInts(rnd)          a,b,c,d = chooseInts(rnd)
152          # 1 / determinant          # 1 / determinant
153          f = 1.0 / (a * d - b * c)          f = 1.0 / (a * d - b * c)
154          vecs = [ [ f * self.vecs[1][1], -f*self.vecs[0][1] ],          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] ],
155                   [ -f*self.vecs[1][0], f*self.vecs[0][0] ]                   [ f * d * self.vecs[1][0] - f * b * self.vecs[1][1], -f * c * self.vecs[1][0] + f * a * self.vecs[1][1] ] ]
156                   ]  
157            # Note that the 'vecs' matrix stores the parallelogram side vectors as its columns
158            # The debug prints below show that 'vecs' correctly solves the equation
159            if 0:
160                print "S: ", [self.vecs[0][0], self.vecs[1][0]]
161                print "T: ", [self.vecs[0][1], self.vecs[1][1]]
162                print "a S' + b T':", [a*vecs[0][0]+b*vecs[0][1], a*vecs[1][0]+b*vecs[1][1]]
163                print "c S' + d T':", [c*vecs[0][0]+d*vecs[0][1], c*vecs[1][0]+d*vecs[1][1]]
164                print "a,b,c,d:", a,b,c,d
165    
166          return TexGenXYRepeatUnit(vecs=vecs)          return TexGenXYRepeatUnit(vecs=vecs)
167    
168  class TexGen3DSlice:  class TexGen3DSlice:

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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