|
1 | 1 | import unittest |
2 | 2 | import mesh_model.mesh_struct.mesh as mesh |
3 | 3 | from mesh_model.mesh_struct.mesh_elements import Dart, Node |
4 | | - |
| 4 | +from mesh_model.random_trimesh import regular_mesh |
5 | 5 | from actions.triangular_actions import split_edge, flip_edge, collapse_edge |
| 6 | +from plots.mesh_plotter import plot_mesh |
| 7 | + |
6 | 8 |
|
7 | 9 | class TestActions(unittest.TestCase): |
8 | 10 |
|
@@ -61,14 +63,22 @@ def test_collapse(self): |
61 | 63 | nodes = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]] |
62 | 64 | faces = [[0, 1, 2], [0, 2, 3]] |
63 | 65 | cmap = mesh.Mesh(nodes, faces) |
| 66 | + plot_mesh(cmap) |
64 | 67 | n00 = Node(cmap, 0) |
65 | 68 | n11 = Node(cmap, 2) |
66 | 69 | split_edge(cmap, n00, n11) |
| 70 | + plot_mesh(cmap) |
67 | 71 | n5 = Node(cmap, 4) |
68 | 72 | collapse_edge(cmap, n00, n5) |
69 | 73 | d1_to_test = Dart(cmap, 7) |
70 | 74 | d2_to_test = Dart(cmap, 0) |
71 | 75 | self.assertEqual(collapse_edge(cmap, n00, n5), False) |
| 76 | + # Test possible collapse |
| 77 | + cmap = regular_mesh(16) |
| 78 | + d = Dart(cmap, 0) |
| 79 | + n0 = d.get_node() |
| 80 | + n1 = d.get_beta(1).get_node() |
| 81 | + self.assertEqual(collapse_edge(cmap, n0, n1), True) |
72 | 82 |
|
73 | 83 | def test_split_collapse_split(self): |
74 | 84 | nodes = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]] |
|
0 commit comments