Exemple #1
0
    def test_orientation_2(self):
        """
        Base case: simple counterclockwise triangle.
        """
        line = Line(0, 0, 1, 0)
        p = np.array([3, 2])
        output = compute_orientation_points(line, p)

        self.assertEqual(Orientation.COUNTERCLOCKWISE, output)
Exemple #2
0
    def test_orientation_1(self):
        """
        Base case: simple clockwise triangle.
        """
        line = Line(0, 0, 1, 1)
        p = np.array([2, 0])
        output = compute_orientation_points(line, p)

        self.assertEqual(Orientation.CLOCKWISE, output)
Exemple #3
0
    def test_orientation_8(self):
        """
        Corner case: counterclockwise, 2 points same x-val.
        """
        line = Line(1, 1, 1, 2)
        p = np.array([0, 2])
        output = compute_orientation_points(line, p)

        self.assertEqual(Orientation.COUNTERCLOCKWISE, output)
Exemple #4
0
    def test_orientation_6(self):
        """
        Base case: right-angle counterclockwise triangle.
        """
        line = Line(1, 1, 2, 1)
        p = np.array([2, 2])
        output = compute_orientation_points(line, p)

        self.assertEqual(Orientation.COUNTERCLOCKWISE, output)
Exemple #5
0
    def test_orientation_5(self):
        """
        Base case: wide-angle clockwise triangle.
        """
        line = Line(1, 1, 2, 1)
        p = np.array([3, 0])
        output = compute_orientation_points(line, p)

        self.assertEqual(Orientation.CLOCKWISE, output)
Exemple #6
0
    def test_orientation_3(self):
        """
        Base case: simple collinear line.
        """
        line = Line(0, 0, 5, 5)
        p = np.array([2, 2])
        output = compute_orientation_points(line, p)

        self.assertEqual(Orientation.COLLINEAR, output)