Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    def test_marker_3dmarker_format(self):
        m = Marker(None, None, None, None)
        self.assertEqual(m.get_3dmarker_format(),
                         '')

        m = Marker(1, None, None, None)
        self.assertEqual(m.get_3dmarker_format(),
                         '')

        m = Marker(1, 1, None, None)
        self.assertEqual(m.get_3dmarker_format(),
                         '')

        m = Marker(1, 1, 1, None)
        self.assertEqual(m.get_3dmarker_format(),
                         '')

        m = Marker(1, 2, 3, 4)
        self.assertEqual(m.get_3dmarker_format(),
                         '     1    2.000000    3.000000    4.000000')

        m = Marker(10, -20, -30, -400)
        self.assertEqual(m.get_3dmarker_format(),
                         '    10  -20.000000  -30.000000 -400.000000')

        m = Marker(10, -20, -30, -4000)
        self.assertEqual(m.get_3dmarker_format(),
                         '    10  -20.000000  -30.000000 -4000.000000')

        m = Marker(1000, -20, -30, -40000)
        self.assertEqual(m.get_3dmarker_format(),
                         '  1000  -20.000000  -30.000000 -40000.000000')
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)