Example #1
0
    def test_sort_one_2(self):

        t = np.array([[1, 3, 0], [3, 2, 1]]).T
        sorted_t = sort_points.sort_triangle_edges(t)

        truth = np.array([[1, 3, 0], [1, 2, 3]]).T
        self.assertTrue(np.allclose(sorted_t, truth))
Example #2
0
    def test_no_sorting(self):

        t = np.array([[0, 1, 2], [2, 1, 3]]).T
        sorted_t = sort_points.sort_triangle_edges(t)

        truth = t
        self.assertTrue(np.allclose(sorted_t, truth))
Example #3
0
    def test_two_fracs_sort_second_then_third(self):
        # The first will lead the second to be sorted, which again remove the need to sort the third
        t = np.array([[0, 1, 2], [1, 2, 3], [3, 2, 4]]).T

        sorted_t = sort_points.sort_triangle_edges(t)

        truth = np.array([[0, 1, 2], [2, 1, 3], [2, 3, 4]]).T
        self.assertTrue(np.allclose(sorted_t, truth))
Example #4
0
 def test_issue_1(self):
     # Bug found while using the code
     t = np.array([
         [2, 1, 0, 5, 1, 0, 1, 6, 4, 7, 4, 5],
         [3, 3, 5, 3, 5, 5, 6, 7, 3, 3, 7, 4],
         [1, 0, 3, 4, 6, 1, 2, 2, 7, 2, 6, 6],
     ])
     sorted_t = sort_points.sort_triangle_edges(t.copy())
     truth = np.array([
         [2, 3, 1],
         [1, 3, 0],
         [3, 5, 0],
         [5, 3, 4],
         [1, 5, 6],
         [0, 5, 1],
         [1, 6, 2],
         [6, 7, 2],
         [4, 3, 7],
         [7, 3, 2],
         [4, 7, 6],
         [5, 4, 6],
     ]).T
     self.assertTrue(np.allclose(sorted_t, truth))
Example #5
0
    def test_four_fracs_last_sorted_automatically(self):
        t = np.array([[0, 1, 2], [1, 2, 3], [3, 2, 4], [0, 4, 2]]).T
        sorted_t = sort_points.sort_triangle_edges(t)

        truth = np.array([[0, 1, 2], [2, 1, 3], [2, 3, 4], [2, 4, 0]]).T
        self.assertTrue(np.allclose(sorted_t, truth))