예제 #1
0
    def test_heading(self):
        """
        The positive Z heading points towards a heading of zero, and the
        positive X heading points towards three-halves pi.
        """

        first = Position(0, 0, 0)
        second = Position(0, 0, 1)
        third = Position(1, 0, 0)

        self.assertAlmostEqual(first.heading(second), 0)
        self.assertAlmostEqual(first.heading(third), 3 * math.pi / 2)
        # Just for fun, this should point between pi and 3pi/2, or 5pi/4.
        self.assertAlmostEqual(second.heading(third), 5 * math.pi / 4)
예제 #2
0
    def test_heading(self):
        """
        The positive Z heading points towards a heading of zero, and the
        positive X heading points towards three-halves pi.
        """

        first = Position(0, 0, 0)
        second = Position(0, 0, 1)
        third = Position(1, 0, 0)

        self.assertAlmostEqual(first.heading(second), 0)
        self.assertAlmostEqual(first.heading(third), 3 * math.pi / 2)
        # Just for fun, this should point between pi and 3pi/2, or 5pi/4.
        self.assertAlmostEqual(second.heading(third), 5 * math.pi / 4)
예제 #3
0
    def test_heading_negative(self):
        """
        Headings shouldn't be negative.

        Well, they can be, technically, but in Bravo, they should be clamped
        to the unit circle.
        """

        first = Position(0, 0, 0)
        second = Position(-1, 0, 0)

        self.assertTrue(first.heading(second) >= 0)
예제 #4
0
    def test_heading_negative(self):
        """
        Headings shouldn't be negative.

        Well, they can be, technically, but in Bravo, they should be clamped
        to the unit circle.
        """

        first = Position(0, 0, 0)
        second = Position(-1, 0, 0)

        self.assertTrue(first.heading(second) >= 0)