/[escript]/trunk/pycad/test/python/run_pycad_test.py
ViewVC logotype

Diff of /trunk/pycad/test/python/run_pycad_test.py

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

revision 3258 by gross, Tue Sep 14 01:55:24 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 319  class Test_PyCAD_Transformations(unittes Line 319  class Test_PyCAD_Transformations(unittes
319          s=t([1,2,3])          s=t([1,2,3])
320          self.failUnless(isinstance(s,numpy.ndarray),"s is not an ndarray object.")          self.failUnless(isinstance(s,numpy.ndarray),"s is not an ndarray object.")
321          self.failUnless(self.__distance(s,numpy.array([1.,2,1]))<self.ABS_TOL,"s is wrong.")          self.failUnless(self.__distance(s,numpy.array([1.,2,1]))<self.ABS_TOL,"s is wrong.")
322     def test_Rotation_x_90_0(self):     def test_Rotatation_x_90_0(self):
323          t=Rotation(axis=[1.,0.,0.],point=[1.,0.,0.],angle=90*DEG)          t=Rotatation(axis=[1.,0.,0.],point=[1.,0.,0.],angle=90*DEG)
324          s0=t([1,0,0])          s0=t([1,0,0])
325          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
326          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 330  class Test_PyCAD_Transformations(unittes Line 330  class Test_PyCAD_Transformations(unittes
330          s2=t([0,0,1])          s2=t([0,0,1])
331          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
332          self.failUnless(self.__distance(s2,numpy.array([0.,-1.,0.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,-1.,0.]))<self.ABS_TOL,"s2 is wrong.")
333     def test_Rotation_x_30_0(self):     def test_Rotatation_x_30_0(self):
334          t=Rotation(axis=[1.,0.,0.],point=[1.,0.,0.],angle=30*DEG)          t=Rotatation(axis=[1.,0.,0.],point=[1.,0.,0.],angle=30*DEG)
335          s0=t([1,0,0])          s0=t([1,0,0])
336          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
337          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 345  class Test_PyCAD_Transformations(unittes Line 345  class Test_PyCAD_Transformations(unittes
345          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
346          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")
347          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([1.,0.,0.]))<0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([1.,0.,0.]))<0.,"s2 has wrong orientation.")
348     def test_Rotation_x_330_0(self):     def test_Rotatation_x_330_0(self):
349          t=Rotation(axis=[1.,0.,0.],point=[1.,0.,0.],angle=330*DEG)          t=Rotatation(axis=[1.,0.,0.],point=[1.,0.,0.],angle=330*DEG)
350          s0=t([1,0,0])          s0=t([1,0,0])
351          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
352          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 360  class Test_PyCAD_Transformations(unittes Line 360  class Test_PyCAD_Transformations(unittes
360          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
361          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")
362          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([1.,0.,0.]))>0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([1.,0.,0.]))>0.,"s2 has wrong orientation.")
363     def test_Rotation_x_90(self):     def test_Rotatation_x_90(self):
364          t=Rotation(axis=[-1.,0.,0.],point=[2.,0.,0.],angle=90*DEG)          t=Rotatation(axis=[-1.,0.,0.],point=[2.,0.,0.],angle=90*DEG)
365          s0=t([1,0,0])          s0=t([1,0,0])
366          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
367          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 371  class Test_PyCAD_Transformations(unittes Line 371  class Test_PyCAD_Transformations(unittes
371          s2=t([0,0,1])          s2=t([0,0,1])
372          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
373          self.failUnless(self.__distance(s2,numpy.array([0.,1.,0.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,1.,0.]))<self.ABS_TOL,"s2 is wrong.")
374     def test_Rotation_x_30(self):     def test_Rotatation_x_30(self):
375          t=Rotation(axis=[-1.,0.,0.],point=[1.,0.,0.],angle=30*DEG)          t=Rotatation(axis=[-1.,0.,0.],point=[1.,0.,0.],angle=30*DEG)
376          s0=t([1,0,0])          s0=t([1,0,0])
377          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
378          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 386  class Test_PyCAD_Transformations(unittes Line 386  class Test_PyCAD_Transformations(unittes
386          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
387          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")
388          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([-1.,0.,0.]))<0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([-1.,0.,0.]))<0.,"s2 has wrong orientation.")
389     def test_Rotation_x_330(self):     def test_Rotatation_x_330(self):
390          t=Rotation(axis=[-1.,0.,0.],point=[1.,0.,0.],angle=330*DEG)          t=Rotatation(axis=[-1.,0.,0.],point=[1.,0.,0.],angle=330*DEG)
391          s0=t([1,0,0])          s0=t([1,0,0])
392          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
393          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 401  class Test_PyCAD_Transformations(unittes Line 401  class Test_PyCAD_Transformations(unittes
401          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
402          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")
403          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([-1.,0.,0.]))>0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([-1.,0.,0.]))>0.,"s2 has wrong orientation.")
404     def test_Rotation_y_90_0(self):     def test_Rotatation_y_90_0(self):
405          t=Rotation(axis=[0.,1.,0.],point=[0.,1.,0.],angle=90*DEG)          t=Rotatation(axis=[0.,1.,0.],point=[0.,1.,0.],angle=90*DEG)
406          s0=t([1,0,0])          s0=t([1,0,0])
407          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
408          self.failUnless(self.__distance(s0,numpy.array([0.,0,-1.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([0.,0,-1.]))<self.ABS_TOL,"s0 is wrong.")
# Line 412  class Test_PyCAD_Transformations(unittes Line 412  class Test_PyCAD_Transformations(unittes
412          s2=t([0,0,1])          s2=t([0,0,1])
413          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
414          self.failUnless(self.__distance(s2,numpy.array([1,0.,0.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([1,0.,0.]))<self.ABS_TOL,"s2 is wrong.")
415     def test_Rotation_y_30_0(self):     def test_Rotatation_y_30_0(self):
416          t=Rotation(axis=[0.,1.,0.],point=[0.,1.,0.],angle=30*DEG)          t=Rotatation(axis=[0.,1.,0.],point=[0.,1.,0.],angle=30*DEG)
417          s0=t([1,0,0])          s0=t([1,0,0])
418          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
419          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 427  class Test_PyCAD_Transformations(unittes Line 427  class Test_PyCAD_Transformations(unittes
427          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
428          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")
429          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,1.,0.]))<0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,1.,0.]))<0.,"s2 has wrong orientation.")
430     def test_Rotation_y_330_0(self):     def test_Rotatation_y_330_0(self):
431          t=Rotation(axis=[0.,1.,0.],point=[0.,1.,0.],angle=330*DEG)          t=Rotatation(axis=[0.,1.,0.],point=[0.,1.,0.],angle=330*DEG)
432          s0=t([1,0,0])          s0=t([1,0,0])
433          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
434          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 442  class Test_PyCAD_Transformations(unittes Line 442  class Test_PyCAD_Transformations(unittes
442          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
443          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")
444          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,1.,0.]))>0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,1.,0.]))>0.,"s2 has wrong orientation.")
445     def test_Rotation_y_90(self):     def test_Rotatation_y_90(self):
446          t=Rotation(axis=[0.,-1.,0.],point=[0.,2.,0.],angle=90*DEG)          t=Rotatation(axis=[0.,-1.,0.],point=[0.,2.,0.],angle=90*DEG)
447          s0=t([1,0,0])          s0=t([1,0,0])
448          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
449          self.failUnless(self.__distance(s0,numpy.array([0.,0,1.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([0.,0,1.]))<self.ABS_TOL,"s0 is wrong.")
# Line 453  class Test_PyCAD_Transformations(unittes Line 453  class Test_PyCAD_Transformations(unittes
453          s2=t([0,0,1])          s2=t([0,0,1])
454          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
455          self.failUnless(self.__distance(s2,numpy.array([-1,0.,0.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([-1,0.,0.]))<self.ABS_TOL,"s2 is wrong.")
456     def test_Rotation_y_30(self):     def test_Rotatation_y_30(self):
457          t=Rotation(axis=[0.,-1.,0.],point=[0.,2.,0.],angle=30*DEG)          t=Rotatation(axis=[0.,-1.,0.],point=[0.,2.,0.],angle=30*DEG)
458          s0=t([1,0,0])          s0=t([1,0,0])
459          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
460          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 468  class Test_PyCAD_Transformations(unittes Line 468  class Test_PyCAD_Transformations(unittes
468          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
469          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(30*DEG))<self.ABS_TOL,"s2 angle is wrong.")
470          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,-1.,0.]))<0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,-1.,0.]))<0.,"s2 has wrong orientation.")
471     def test_Rotation_y_330(self):     def test_Rotatation_y_330(self):
472          t=Rotation(axis=[0.,-1.,0.],point=[0.,2.,0.],angle=330*DEG)          t=Rotatation(axis=[0.,-1.,0.],point=[0.,2.,0.],angle=330*DEG)
473          s0=t([1,0,0])          s0=t([1,0,0])
474          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
475          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 483  class Test_PyCAD_Transformations(unittes Line 483  class Test_PyCAD_Transformations(unittes
483          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")          self.failUnless(abs(numpy.dot(s2,s2)-1.)<self.ABS_TOL,"s2 length is wrong.")
484          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")          self.failUnless(abs(s2[2]-math.cos(330*DEG))<self.ABS_TOL,"s2 angle is wrong.")
485          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,-1.,0.]))>0.,"s2 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s2,[0,0,1]),numpy.array([0.,-1.,0.]))>0.,"s2 has wrong orientation.")
486     def test_Rotation_z_90_0(self):     def test_Rotatation_z_90_0(self):
487          t=Rotation(axis=[0.,0.,1.],point=[0.,0.,1.],angle=90*DEG)          t=Rotatation(axis=[0.,0.,1.],point=[0.,0.,1.],angle=90*DEG)
488          s0=t([1,0,0])          s0=t([1,0,0])
489          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
490          self.failUnless(self.__distance(s0,numpy.array([0.,1,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([0.,1,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 494  class Test_PyCAD_Transformations(unittes Line 494  class Test_PyCAD_Transformations(unittes
494          s2=t([0,0,1])          s2=t([0,0,1])
495          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
496          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
497     def test_Rotation_z_30_0(self):     def test_Rotatation_z_30_0(self):
498          t=Rotation(axis=[0.,0.,1.],point=[0.,0.,1.],angle=30*DEG)          t=Rotatation(axis=[0.,0.,1.],point=[0.,0.,1.],angle=30*DEG)
499          s0=t([1,0,0])          s0=t([1,0,0])
500          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
501          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 509  class Test_PyCAD_Transformations(unittes Line 509  class Test_PyCAD_Transformations(unittes
509          s2=t([0,0,1])          s2=t([0,0,1])
510          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
511          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
512     def test_Rotation_z_330_0(self):     def test_Rotatation_z_330_0(self):
513          t=Rotation(axis=[0.,0.,1.],point=[0.,0.,1.],angle=330*DEG)          t=Rotatation(axis=[0.,0.,1.],point=[0.,0.,1.],angle=330*DEG)
514          s0=t([1,0,0])          s0=t([1,0,0])
515          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
516          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 521  class Test_PyCAD_Transformations(unittes Line 521  class Test_PyCAD_Transformations(unittes
521          self.failUnless(abs(numpy.dot(s1,s1)-5.**2)<self.ABS_TOL,"s1 length is wrong.")          self.failUnless(abs(numpy.dot(s1,s1)-5.**2)<self.ABS_TOL,"s1 length is wrong.")
522          self.failUnless(abs(s1[1]/5.-math.cos(330*DEG))<self.ABS_TOL,"s1 angle is wrong.")          self.failUnless(abs(s1[1]/5.-math.cos(330*DEG))<self.ABS_TOL,"s1 angle is wrong.")
523          self.failUnless(numpy.dot(_cross(s1,[0,1,0]),numpy.array([0.,0.,1.]))>0.,"s1 has wrong orientation.")          self.failUnless(numpy.dot(_cross(s1,[0,1,0]),numpy.array([0.,0.,1.]))>0.,"s1 has wrong orientation.")
524     def test_Rotation_z_90(self):     def test_Rotatation_z_90(self):
525          t=Rotation(axis=[0.,0.,-1.],point=[0.,0.,2.],angle=90*DEG)          t=Rotatation(axis=[0.,0.,-1.],point=[0.,0.,2.],angle=90*DEG)
526          s0=t([1,0,0])          s0=t([1,0,0])
527          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
528          self.failUnless(self.__distance(s0,numpy.array([0.,-1,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([0.,-1,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 532  class Test_PyCAD_Transformations(unittes Line 532  class Test_PyCAD_Transformations(unittes
532          s2=t([0,0,1])          s2=t([0,0,1])
533          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
534          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
535     def test_Rotation_z_30(self):     def test_Rotatation_z_30(self):
536          t=Rotation(axis=[0.,0.,-1.],point=[0.,0.,2.],angle=30*DEG)          t=Rotatation(axis=[0.,0.,-1.],point=[0.,0.,2.],angle=30*DEG)
537          s0=t([1,0,0])          s0=t([1,0,0])
538          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
539          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 547  class Test_PyCAD_Transformations(unittes Line 547  class Test_PyCAD_Transformations(unittes
547          s2=t([0,0,1])          s2=t([0,0,1])
548          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
549          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
550     def test_Rotation_z_330(self):     def test_Rotatation_z_330(self):
551          t=Rotation(axis=[0.,0.,-1.],point=[0.,0.,2.],angle=330*DEG)          t=Rotatation(axis=[0.,0.,-1.],point=[0.,0.,2.],angle=330*DEG)
552          s0=t([1,0,0])          s0=t([1,0,0])
553          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
554          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-1.)<self.ABS_TOL,"s0 length is wrong.")
# Line 562  class Test_PyCAD_Transformations(unittes Line 562  class Test_PyCAD_Transformations(unittes
562          s2=t([0,0,1])          s2=t([0,0,1])
563          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
564          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
565     def test_Rotation_x_90_1(self):     def test_Rotatation_x_90_1(self):
566          t=Rotation(point=[0.,0.,1.],axis=[1.,0.,0.],angle=90*DEG)          t=Rotatation(point=[0.,0.,1.],axis=[1.,0.,0.],angle=90*DEG)
567          s0=t([1,0,0])          s0=t([1,0,0])
568          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
569          self.failUnless(self.__distance(s0,numpy.array([1.,1,1.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,1,1.]))<self.ABS_TOL,"s0 is wrong.")
# Line 573  class Test_PyCAD_Transformations(unittes Line 573  class Test_PyCAD_Transformations(unittes
573          s2=t([0,0,1])          s2=t([0,0,1])
574          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
575          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([0.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
576     def test_Rotation_y_90_1(self):     def test_Rotatation_y_90_1(self):
577          t=Rotation(point=[1.,0.,0.],axis=[0.,1.,0.],angle=90*DEG)          t=Rotatation(point=[1.,0.,0.],axis=[0.,1.,0.],angle=90*DEG)
578          s0=t([1,0,0])          s0=t([1,0,0])
579          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
580          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,0,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 584  class Test_PyCAD_Transformations(unittes Line 584  class Test_PyCAD_Transformations(unittes
584          s2=t([0,0,1])          s2=t([0,0,1])
585          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
586          self.failUnless(self.__distance(s2,numpy.array([2.,0,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([2.,0,1.]))<self.ABS_TOL,"s2 is wrong.")
587     def test_Rotation_z_90_1(self):     def test_Rotatation_z_90_1(self):
588          t=Rotation(point=[0.,1.,0.],axis=[0.,0.,1.],angle=90*DEG)          t=Rotatation(point=[0.,1.,0.],axis=[0.,0.,1.],angle=90*DEG)
589          s0=t([1,0,0])          s0=t([1,0,0])
590          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
591          self.failUnless(self.__distance(s0,numpy.array([1.,2,0.]))<self.ABS_TOL,"s0 is wrong.")          self.failUnless(self.__distance(s0,numpy.array([1.,2,0.]))<self.ABS_TOL,"s0 is wrong.")
# Line 595  class Test_PyCAD_Transformations(unittes Line 595  class Test_PyCAD_Transformations(unittes
595          s2=t([0,0,1])          s2=t([0,0,1])
596          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")          self.failUnless(isinstance(s2,numpy.ndarray),"s2 is not an ndarray object.")
597          self.failUnless(self.__distance(s2,numpy.array([1.,1,1.]))<self.ABS_TOL,"s2 is wrong.")          self.failUnless(self.__distance(s2,numpy.array([1.,1,1.]))<self.ABS_TOL,"s2 is wrong.")
598     def test_Rotation_diag_90_0(self):     def test_Rotatation_diag_90_0(self):
599          t=Rotation(axis=[1.,1.,1.],angle=90*DEG)          t=Rotatation(axis=[1.,1.,1.],angle=90*DEG)
600          s0=t([1,-1,0])          s0=t([1,-1,0])
601          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")          self.failUnless(isinstance(s0,numpy.ndarray),"s0 is not an ndarray object.")
602          self.failUnless(abs(numpy.dot(s0,s0)-2.)<self.ABS_TOL,"s0 length is wrong.")          self.failUnless(abs(numpy.dot(s0,s0)-2.)<self.ABS_TOL,"s0 length is wrong.")

Legend:
Removed from v.3258  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26