/[libvob]/libvob/test/vob/gl/glvobcoorder.test
ViewVC logotype

Diff of /libvob/test/vob/gl/glvobcoorder.test

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

revision 1.3 by tjl, Wed Mar 12 09:00:50 2003 UTC revision 1.4 by tjl, Wed Mar 12 16:17:20 2003 UTC
# Line 48  def testTransform(): Line 48  def testTransform():
48      checkTrans(vs, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 21, 13])      checkTrans(vs, cs, [0, 0, 0, 1, 1, 1, 2, 2, 2], [10, 15, 5, 11, 18, 9, 12, 21, 13])
49    
50    
     cs3 = c.distort(0, 0, 0, 0.1, 0.1, 20, 5)  
     checkTrans(vs, cs3, [0, 0, 0, 0.001, 0.001, 1], [0, 0, 0, 0.02, 0.02, 1], delta=0.00001, alsoRender = 0)  
51    
52    
53    
# Line 59  def testTransform(): Line 57  def testTransform():
57      # Clockwise rotation      # Clockwise rotation
58      c.setRotateParams(r, 90)      c.setRotateParams(r, 90)
59      checkTrans(vs, r, [0, 0, 0, 0, 50, 0], [100, 100, 0, 50, 100, 0])      checkTrans(vs, r, [0, 0, 0, 0, 50, 0], [100, 100, 0, 50, 100, 0])
   
     cs4 = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)  
     cs4clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)  
   
     cs4cull = c.cull(cs4, cs4clip)  
     checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])  
   
     c.setAffineParams(cs4clip, 0, 1500, 1500, 10, 0, 0, 10)  
     checkNoTrans(vs, cs4cull)  
   
60  def checkInverse(c, cs):  def checkInverse(c, cs):
61      # unit cube      # unit cube
62      src = array([      src = array([
# Line 99  def checkInverse(c, cs): Line 87  def checkInverse(c, cs):
87      c.transformPoints3(cs, src, dst)      c.transformPoints3(cs, src, dst)
88      c.inverseTransformPoints3(cs, dst, src2)      c.inverseTransformPoints3(cs, dst, src2)
89    
90      cs_inv = c.invert(cs)      cs_inv = c.concatInverse(0, cs)
91    
92      c.transformPoints3(cs_inv, dst, src3)      c.transformPoints3(cs_inv, dst, src3)
93      c.inverseTransformPoints3(cs_inv, src2, dst2)      c.inverseTransformPoints3(cs_inv, src2, dst2)
# Line 128  def checkInverse(c, cs): Line 116  def checkInverse(c, cs):
116    
117  def testInverses():  def testInverses():
118      for i in range(0,5):      for i in range(0,5):
119          c = GLVobCoorder()          c = getvs().coords
120    
121          cs_ortho = c.ortho(0, 2, 3.5, 9.1, 1.2, 3.9)          cs_ortho = c.ortho(0, 2, 3.5, 9.1, 1.2, 3.9)
122          cs_ortho2 = c.ortho(cs_ortho, -1.92, 4.1, 2.951, 2.52, 291)          cs_ortho2 = c.ortho(cs_ortho, -1.92, 4.1, 2.951, 2.52, 291)
# Line 149  def testInverses(): Line 137  def testInverses():
137          checkInverse(c, cs_ortho4)          checkInverse(c, cs_ortho4)
138          checkInverse(c, cs_ortho5)          checkInverse(c, cs_ortho5)
139    
140          cs_dist = c.distort(0, 0, 0, 0.5, 0.1, 20, 5)          cs_affine = c.affine(0, 0, 0, 0, 100, 0, 0, 100)
141            cs_affine_clip = c.affine(0, 0, 50, 50, 10, 0, 0, 10)
         checkInverse(c, cs_dist)  
   
         cs_affine = c.affineCoordsys(0, 0, 0, 0, 100, 0, 0, 100)  
         cs_affine_clip = c.affineCoordsys(0, 0, 50, 50, 10, 0, 0, 10)  
142          cs_cull = c.cull(cs_affine, cs_affine_clip)          cs_cull = c.cull(cs_affine, cs_affine_clip)
143          checkInverse(c, cs_cull)          checkInverse(c, cs_cull)
144    
# Line 166  def testInverses(): Line 150  def testInverses():
150          c.getSqSize(cs_box, box)          c.getSqSize(cs_box, box)
151          failUnlessEqual(box[0], 420)          failUnlessEqual(box[0], 420)
152          failUnlessEqual(box[1], 430)          failUnlessEqual(box[1], 430)
         cs_nadir = c.nadirUnitSq(cs_box, cs_ortho)  
         c.getSqSize(cs_nadir, box)  
         failUnlessEqual(box[0], 420)  
         failUnlessEqual(box[1], 430)  
         checkInverse(c, cs_nadir)  
         cs_nadir = c.nadirOrigin(cs_box, cs_ortho)  
         c.getSqSize(cs_nadir, box)  
         failUnlessEqual(box[0], 420)  
         failUnlessEqual(box[1], 430)  
         checkInverse(c, cs_nadir)  
153    
154  def testInterpolateTranslation():  def testInterpolateTranslation():
155    
# Line 188  def testInterpolateTranslation(): Line 162  def testInterpolateTranslation():
162          [55, 15, 0]          [55, 15, 0]
163      )      )
164    
 def testInterpolateBuoy():  
   
     cs_anchor = c1.translate(0, 10, 0)  
     cs_b1 = c1.buoyOnCircle(0, cs_anchor, 0, 0, 20, -20, 0, 0)  
   
     checkTrans(vs1, cs_b1,  
         [0, 0, 0],  
         [20, 0, 0],  
         1)  
   
     cs_b2t = c2.affineCoordsys(0, 0, 200, 200, 1, 0, 0, 1)  
     interp[cs_b1] = cs_b2t  
   
     checkInterp(vs1, vs2, interp, .5, cs_b1,  
         [0, 0, 0],  
         [110, 100, 0],  
         1)  
   
 def testNadir():  
   
     # Check that a simple nadir cs does the right thing  
     cs_nadir = c1.translate(0, 50, 100)    
     cs_center = c1.translate(0, 50, 20)  
     cs_rot = c1.nadirOrigin(cs_center, cs_nadir)  
   
     checkTrans(vs1, cs_rot,  
         [0, 0, 0,   0, 10, 0],  
         [50, 20, 0, 50, 30, 0],  
         .1)  
   
     # Even after translate params.  
     c1.setTranslateParams(cs_center, 20, 100)  
   
     checkTrans(vs1, cs_rot,  
         [0, 0, 0,   0, 10, 0],  
         [20, 100, 0, 30, 100, 0],  
         .1)  
   
     # Check that an orthoBox CS is rotated around the  
     # center of the box by nadirUnitSq  
     # center = 600, 600  
     cs_orthobox = c1.orthoBox(0, 0, 500, 500, .2, .2, 1000, 1000)  
     cs_nadir = c1.translate(0, 600, 1000)  
     cs_rot = c1.nadirUnitSq(cs_orthobox, cs_nadir)  
   
     checkTrans(vs1, cs_rot,  
         [500, 500, 0, 600, 500, 0],  
         [600, 600, 0, 620, 600, 0],  
         .1)  
   
     center = vs1.translateCS(0, "Center", 400, 300)  
   
     main = vs1.orthoBoxCS(center, "MAINVP", 0,  
                             -100, -100, .2, .2, 1000, 1000)  
   
     nadirCS = vs1.translateCS(0, "NADIRORIGIN", 400, 1500)  
   
     n =  vs1.coords.nadirUnitSq(main, nadirCS)  
   
   
     checkTrans(vs1, n,  
         [0, 0, 0, 500, 500, 0],  
         [300, 200, 0, 400, 300, 0],  
         .1)  
   
   
165    
166    
167  def testCulling():  def testCulling():
# Line 273  def testCulling(): Line 181  def testCulling():
181      font = GL.createFont("gfx/fonts/a010013l.pfb", 16)      font = GL.createFont("gfx/fonts/a010013l.pfb", 16)
182      renderable = GLRen.createHorizText2(font, "FOO", 1, 1, 1, 1)      renderable = GLRen.createHorizText2(font, "FOO", 1, 1, 1, 1)
183            
184      cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
185      cs_clip = c.affineCoordsys(0, 0, 0, 0, 200, 0, 0, 200)      cs_clip = c.affine(0, 0, 0, 0, 200, 0, 0, 200)
186      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
187    
188      putThings()      putThings()
# Line 304  def testCulling(): Line 212  def testCulling():
212      checkNotAvgColor(0, 0, 200, 200, (255, 0, 0), delta=50)      checkNotAvgColor(0, 0, 200, 200, (255, 0, 0), delta=50)
213                    
214  #test same area  #test same area
215      cs_clip = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs_clip = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
216      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
217    
218      putThings()      putThings()
219      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
220    
221  #test normal intersection  #test normal intersection
222      cs_clip = c.affineCoordsys(0, 0, 60, 60, 100, 0, 0, 100)      cs_clip = c.affine(0, 0, 60, 60, 100, 0, 0, 100)
223      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
224    
225      putThings()      putThings()
226      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
227    
228  #test clip inside  #test clip inside
229      cs_clip = c.affineCoordsys(0, 0, 60, 60, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 60, 60, 10, 0, 0, 10)
230      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
231    
232      putThings()      putThings()
233      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
234    
235  #test side touch (should not be drawn)  #test side touch (should not be drawn)
236      cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
237      cs_clip = c.affineCoordsys(0, 0, 110, 60, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 110, 60, 10, 0, 0, 10)
238      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
239    
240      putThings()      putThings()
241      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
242    
243  #test corner-touch (should not be drawn)  #test corner-touch (should not be drawn)
244      cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
245      cs_clip = c.affineCoordsys(0, 0, 110, 110, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 110, 110, 10, 0, 0, 10)
246      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
247    
248      putThings()      putThings()
249      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
250    
251  #test clip outside (should not be drawn)  #test clip outside (should not be drawn)
252      cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
253      cs_clip = c.affineCoordsys(0, 0, 120, 60, 10, 0, 0, 10)      cs_clip = c.affine(0, 0, 120, 60, 10, 0, 0, 10)
254      cs_cull = c.cull(cs, cs_clip)      cs_cull = c.cull(cs, cs_clip)
255    
256      putThings()      putThings()
257      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
258    
259  #test distorted inside (should be drawn)  #test distorted inside (should be drawn)
260      cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
261      cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)      cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
262      cs_clip = c.affineCoordsys(0, 0, 10, 90, 100, 0, 0, 100)      cs_clip = c.affine(0, 0, 10, 90, 100, 0, 0, 100)
263      cs_cull = c.cull(cs_d, cs_clip)      cs_cull = c.cull(cs_d, cs_clip)
264    
265      putThings()      putThings()
266      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)      checkNotAvgColor(10, 10, 100, 100, (255, 0, 0), delta=50)
267    
268  #test distorted outside (should not be drawn)  #test distorted outside (should not be drawn)
269      cs = c.affineCoordsys(0, 0, 10, 10, 100, 0, 0, 100)      cs = c.affine(0, 0, 10, 10, 100, 0, 0, 100)
270      cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)      cs_d = c.distort(cs, 0, 0, 1, 1, 1, 0.1)
271      #normally without distortion this should be drawn      #normally without distortion this should be drawn
272      cs_clip = c.affineCoordsys(0, 0, 10, 100, 100, 0, 0, 100)      cs_clip = c.affine(0, 0, 10, 100, 100, 0, 0, 100)
273      cs_cull = c.cull(cs_d, cs_clip)      cs_cull = c.cull(cs_d, cs_clip)
274    
275      putThings()      putThings()
276      checkAvgColor(10, 10, 80, 80, (255, 0, 0), delta=50)      checkAvgColor(10, 10, 80, 80, (255, 0, 0), delta=50)
277    
278        cs4 = c.affine(0, 0, 0, 0, 100, 0, 0, 100)
279        cs4clip = c.affine(0, 0, 50, 50, 10, 0, 0, 10)
280    
281        cs4cull = c.cull(cs4, cs4clip)
282        checkTrans(vs, cs4cull, [0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 0, 0, 100, 100, 1, 200, 200, 2])
283    
284        c.setAffineParams(cs4clip, 0, 1500, 1500, 10, 0, 0, 10)
285        checkNoTrans(vs, cs4cull)
286    
287    
288  def testInterpolateType():  def testInterpolateType():
289      """Test that cses of different types get interpolated      """Test that cses of different types get interpolated
290      """      """

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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