Ejemplo n.º 1
0
 def testZero(self):
     """Rotation by an angle of 0 has no effect."""
     v = np.array([1, 1, 1], dtype=complex)
     vrx = geo.rotX(0).dot(v)
     vry = geo.rotY(0).dot(v)
     vrz = geo.rotZ(0).dot(v)
     self.assertTrue(np.allclose(vrx, v))
     self.assertTrue(np.allclose(vry, v))
     self.assertTrue(np.allclose(vrz, v))
Ejemplo n.º 2
0
 def testQuarterTurn(self):
     """Rotation by 90 degrees is correct."""
     v = np.array([1, 1, 1], dtype=complex)
     angle = geo.TAU / 4
     vrx = geo.rotX(angle).dot(v)
     vry = geo.rotY(angle).dot(v)
     vrz = geo.rotZ(angle).dot(v)
     vx = np.array([1, -1, 1], dtype=complex)
     vy = np.array([1, 1, -1], dtype=complex)
     vz = np.array([-1, 1, 1], dtype=complex)
     self.assertTrue(np.allclose(vrx, vx))
     self.assertTrue(np.allclose(vry, vy))
     self.assertTrue(np.allclose(vrz, vz))