Exemple #1
0
    def test_marker_shift_marker(self):
        m = Marker(1, 2, 3, 4)
        m.shift_marker(0, 0, 0)
        self.assertEqual(m.get_index(), 1)
        self.assertEqual(m.get_x(), 2)
        self.assertEqual(m.get_y(), 3)
        self.assertEqual(m.get_z(), 4)

        m.shift_marker(1, -1, 2)
        self.assertEqual(m.get_index(), 1)
        self.assertEqual(m.get_x(), 3)
        self.assertEqual(m.get_y(), 2)
        self.assertEqual(m.get_z(), 6)
Exemple #2
0
    def test_marker_rotate_by_theta(self):

        # rotate by 90
        m = Marker(1, 0, 1, 0)
        m.rotate_by_theta(2 * math.pi * 90 / 360, 0, 0)
        self.assertEqual(m.get_index(), 1)
        self.assertEqual(m.get_x(), -1)
        self.assertTrue(math.fabs(m.get_y()) < 0.00001)
        self.assertEqual(m.get_z(), 0)

        # rotate by -90
        m.rotate_by_theta(2 * math.pi * -90 / 360, 0, 0)
        self.assertEqual(m.get_index(), 1)
        self.assertEqual(m.get_x(), 0)
        self.assertTrue(math.fabs(m.get_y() - 1) < 0.00001)
        self.assertEqual(m.get_z(), 0)

        # rotate by 45
        m.rotate_by_theta(2 * math.pi * 45 / 360, 0, 0)
        self.assertEqual(m.get_index(), 1)
        self.assertTrue(math.fabs(m.get_x() + 0.7071) < 0.1)
        self.assertTrue(math.fabs(m.get_y() - 0.7071) < 0.00001)
        self.assertEqual(m.get_z(), 0)
Exemple #3
0
 def test_marker_constructor(self):
     m = Marker(1, 2, 3, 4)
     self.assertEqual(m.get_index(), 1)
     self.assertEqual(m.get_x(), 2)
     self.assertEqual(m.get_y(), 3)
     self.assertEqual(m.get_z(), 4)