Commit 9171f9d0 authored by Alexander Dielen's avatar Alexander Dielen

updated the tests to work without the status class

parent eceb478a
...@@ -5,156 +5,6 @@ import numpy as np ...@@ -5,156 +5,6 @@ import numpy as np
class DeleteFaceTriangleMesh(unittest.TestCase): class DeleteFaceTriangleMesh(unittest.TestCase):
def test_delete_half_triangle_mesh_cube_no_edge_status(self):
self.mesh = openmesh.TriMesh()
self.vhandle = []
# Add some vertices
self.vhandle.append(self.mesh.add_vertex(np.array([-1, -1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, -1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, 1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([-1, 1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([-1, -1, -1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, -1, -1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, 1, -1])))
self.vhandle.append(self.mesh.add_vertex(np.array([-1, 1, -1])))
# Add six faces to form a cube
face_vhandles = []
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[3])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[3])
self.mesh.add_face(face_vhandles)
#=======================
face_vhandles = []
face_vhandles.append(self.vhandle[7])
face_vhandles.append(self.vhandle[6])
face_vhandles.append(self.vhandle[5])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[7])
face_vhandles.append(self.vhandle[5])
face_vhandles.append(self.vhandle[4])
self.mesh.add_face(face_vhandles)
#=======================
face_vhandles = []
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[4])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[4])
face_vhandles.append(self.vhandle[5])
self.mesh.add_face(face_vhandles)
#=======================
face_vhandles = []
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[5])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[5])
face_vhandles.append(self.vhandle[6])
self.mesh.add_face(face_vhandles)
#=======================
face_vhandles = []
face_vhandles.append(self.vhandle[3])
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[6])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[3])
face_vhandles.append(self.vhandle[6])
face_vhandles.append(self.vhandle[7])
self.mesh.add_face(face_vhandles)
#=======================
face_vhandles = []
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[3])
face_vhandles.append(self.vhandle[7])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[7])
face_vhandles.append(self.vhandle[4])
self.mesh.add_face(face_vhandles)
# Test setup:
#
# 3 ======== 2
# / /|
# / / | z
# 0 ======== 1 | |
# | | | | y
# | 7 | 6 | /
# | | / | /
# | |/ |/
# 4 ======== 5 -------> x
# Check setup
self.assertEqual(self.mesh.n_edges(), 18)
self.assertEqual(self.mesh.n_halfedges(), 36)
self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 12)
# =====================================================
# Now we delete half of the mesh
# =====================================================
self.mesh.request_face_status()
self.mesh.request_vertex_status()
self.mesh.request_halfedge_status()
n_face_to_delete = self.mesh.n_faces() / 2
# Check the variable
self.assertEqual(n_face_to_delete, 6)
for i in range(int(n_face_to_delete)):
self.mesh.delete_face(self.mesh.face_handle(i))
# =====================================================
# Check config afterwards
# =====================================================
self.assertEqual(self.mesh.n_edges(), 18)
self.assertEqual(self.mesh.n_halfedges(), 36)
self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 12)
# =====================================================
# Cleanup and recheck
# =====================================================
self.mesh.garbage_collection()
self.assertEqual(self.mesh.n_edges(), 18)
self.assertEqual(self.mesh.n_halfedges(), 36)
self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 6)
def test_delete_half_triangle_mesh_cube_with_edge_status(self): def test_delete_half_triangle_mesh_cube_with_edge_status(self):
self.mesh = openmesh.TriMesh() self.mesh = openmesh.TriMesh()
self.vhandle = [] self.vhandle = []
...@@ -273,11 +123,6 @@ class DeleteFaceTriangleMesh(unittest.TestCase): ...@@ -273,11 +123,6 @@ class DeleteFaceTriangleMesh(unittest.TestCase):
# ===================================================== # =====================================================
# Now we delete half of the mesh # Now we delete half of the mesh
# ===================================================== # =====================================================
self.mesh.request_face_status()
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_halfedge_status()
n_face_to_delete = self.mesh.n_faces() / 2 n_face_to_delete = self.mesh.n_faces() / 2
# Check the variable # Check the variable
...@@ -305,116 +150,6 @@ class DeleteFaceTriangleMesh(unittest.TestCase): ...@@ -305,116 +150,6 @@ class DeleteFaceTriangleMesh(unittest.TestCase):
self.assertEqual(self.mesh.n_vertices(), 8) self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 6) self.assertEqual(self.mesh.n_faces(), 6)
def test_deletete_half_poly_mesh_cube_without_edge_status(self):
self.mesh = openmesh.PolyMesh()
self.vhandle = []
# Add some vertices
self.vhandle.append(self.mesh.add_vertex(np.array([-1, -1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, -1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, 1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([-1, 1, 1])))
self.vhandle.append(self.mesh.add_vertex(np.array([-1, -1, -1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, -1, -1])))
self.vhandle.append(self.mesh.add_vertex(np.array([ 1, 1, -1])))
self.vhandle.append(self.mesh.add_vertex(np.array([-1, 1, -1])))
# Add six faces to form a cube
face_vhandles = []
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[3])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[7])
face_vhandles.append(self.vhandle[6])
face_vhandles.append(self.vhandle[5])
face_vhandles.append(self.vhandle[4])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[4])
face_vhandles.append(self.vhandle[5])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[1])
face_vhandles.append(self.vhandle[5])
face_vhandles.append(self.vhandle[6])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[3])
face_vhandles.append(self.vhandle[2])
face_vhandles.append(self.vhandle[6])
face_vhandles.append(self.vhandle[7])
self.mesh.add_face(face_vhandles)
face_vhandles = []
face_vhandles.append(self.vhandle[0])
face_vhandles.append(self.vhandle[3])
face_vhandles.append(self.vhandle[7])
face_vhandles.append(self.vhandle[4])
self.mesh.add_face(face_vhandles)
# Test setup:
#
# 3 ======== 2
# / /|
# / / | z
# 0 ======== 1 | |
# | | | | y
# | 7 | 6 | /
# | | / | /
# | |/ |/
# 4 ======== 5 -------> x
# Check setup
self.assertEqual(self.mesh.n_edges(), 12)
self.assertEqual(self.mesh.n_halfedges(), 24)
self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 6)
# =====================================================
# Now we delete half of the mesh
# =====================================================
self.mesh.request_face_status()
self.mesh.request_vertex_status()
self.mesh.request_halfedge_status()
n_face_to_delete = self.mesh.n_faces() / 2
# Check the variable
self.assertEqual(n_face_to_delete, 3)
for i in range(int(n_face_to_delete)):
self.mesh.delete_face(self.mesh.face_handle(i))
# =====================================================
# Check config afterwards
# =====================================================
self.assertEqual(self.mesh.n_edges(), 12)
self.assertEqual(self.mesh.n_halfedges(), 24)
self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 6)
# =====================================================
# Cleanup and recheck
# =====================================================
self.mesh.garbage_collection()
self.assertEqual(self.mesh.n_edges(), 12)
self.assertEqual(self.mesh.n_halfedges(), 24)
self.assertEqual(self.mesh.n_vertices(), 8)
self.assertEqual(self.mesh.n_faces(), 3)
def test_deletete_half_poly_mesh_cube_with_edge_status(self): def test_deletete_half_poly_mesh_cube_with_edge_status(self):
self.mesh = openmesh.PolyMesh() self.mesh = openmesh.PolyMesh()
self.vhandle = [] self.vhandle = []
...@@ -493,11 +228,6 @@ class DeleteFaceTriangleMesh(unittest.TestCase): ...@@ -493,11 +228,6 @@ class DeleteFaceTriangleMesh(unittest.TestCase):
# ===================================================== # =====================================================
# Now we delete half of the mesh # Now we delete half of the mesh
# ===================================================== # =====================================================
self.mesh.request_face_status()
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_halfedge_status()
n_face_to_delete = self.mesh.n_faces() / 2 n_face_to_delete = self.mesh.n_faces() / 2
# Check the variable # Check the variable
......
...@@ -126,11 +126,6 @@ class Property(unittest.TestCase): ...@@ -126,11 +126,6 @@ class Property(unittest.TestCase):
self.assertEqual(self.mesh.vertex_property("intProp", next(v_it)), 2) self.assertEqual(self.mesh.vertex_property("intProp", next(v_it)), 2)
def test_check_status_properties_halfedge_edge_all_deleted(self): def test_check_status_properties_halfedge_edge_all_deleted(self):
self.mesh.request_vertex_status()
self.mesh.request_face_status()
self.mesh.request_halfedge_status()
self.mesh.request_edge_status()
# Define positions # Define positions
p1 = np.array([0, 0, 0]) p1 = np.array([0, 0, 0])
p2 = np.array([0, 1, 0]) p2 = np.array([0, 1, 0])
...@@ -156,8 +151,8 @@ class Property(unittest.TestCase): ...@@ -156,8 +151,8 @@ class Property(unittest.TestCase):
self.mesh.delete_face(f4) self.mesh.delete_face(f4)
for heh in self.mesh.halfedges(): for heh in self.mesh.halfedges():
self.assertTrue(self.mesh.status(self.mesh.edge_handle(heh)).deleted()) self.assertTrue(self.mesh.is_deleted(self.mesh.edge_handle(heh)))
self.assertTrue(self.mesh.status(heh).deleted()) self.assertTrue(self.mesh.is_deleted(heh))
def test_copy_all_properties_vertex_after_remove_of_property(self): def test_copy_all_properties_vertex_after_remove_of_property(self):
# Add some vertices # Add some vertices
......
...@@ -56,10 +56,6 @@ class Collapse(unittest.TestCase): ...@@ -56,10 +56,6 @@ class Collapse(unittest.TestCase):
face_vhandles.append(self.vhandle[2]) face_vhandles.append(self.vhandle[2])
self.mesh.add_face(face_vhandles) self.mesh.add_face(face_vhandles)
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_face_status()
# Get the halfedge # Get the halfedge
v2v1 = self.mesh.find_halfedge(self.vhandle[2], self.vhandle[1]) v2v1 = self.mesh.find_halfedge(self.vhandle[2], self.vhandle[1])
...@@ -105,10 +101,6 @@ class Collapse(unittest.TestCase): ...@@ -105,10 +101,6 @@ class Collapse(unittest.TestCase):
face_vhandles.append(self.vhandle[0]) face_vhandles.append(self.vhandle[0])
self.mesh.add_face(face_vhandles) self.mesh.add_face(face_vhandles)
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_face_status()
v0v1 = self.mesh.halfedge_handle(0) v0v1 = self.mesh.halfedge_handle(0)
v1v0 = self.mesh.opposite_halfedge_handle(v0v1) v1v0 = self.mesh.opposite_halfedge_handle(v0v1)
...@@ -186,10 +178,10 @@ class Collapse(unittest.TestCase): ...@@ -186,10 +178,10 @@ class Collapse(unittest.TestCase):
self.assertEqual(self.mesh.n_faces(), 4) self.assertEqual(self.mesh.n_faces(), 4)
# Check if the right vertices got deleted # Check if the right vertices got deleted
self.assertTrue(self.mesh.status(self.mesh.face_handle(0)).deleted()) self.assertTrue(self.mesh.is_deleted(self.mesh.face_handle(0)))
self.assertFalse(self.mesh.status(self.mesh.face_handle(1)).deleted()) self.assertFalse(self.mesh.is_deleted(self.mesh.face_handle(1)))
self.assertFalse(self.mesh.status(self.mesh.face_handle(2)).deleted()) self.assertFalse(self.mesh.is_deleted(self.mesh.face_handle(2)))
self.assertTrue(self.mesh.status(self.mesh.face_handle(3)).deleted()) self.assertTrue(self.mesh.is_deleted(self.mesh.face_handle(3)))
# Check the vertices of the two remaining faces # Check the vertices of the two remaining faces
fh_1 = self.mesh.face_handle(1) fh_1 = self.mesh.face_handle(1)
...@@ -395,10 +387,6 @@ class Collapse(unittest.TestCase): ...@@ -395,10 +387,6 @@ class Collapse(unittest.TestCase):
face_vhandles.append(self.vhandle[3]) face_vhandles.append(self.vhandle[3])
self.mesh.add_face(face_vhandles) self.mesh.add_face(face_vhandles)
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_face_status()
# ============================================= # =============================================
# Collapse halfedge from 0 to 4 # Collapse halfedge from 0 to 4
# ============================================= # =============================================
...@@ -488,11 +476,6 @@ class Collapse(unittest.TestCase): ...@@ -488,11 +476,6 @@ class Collapse(unittest.TestCase):
# \ / \|/ # \ / \|/
# 3 ==== 4 # 3 ==== 4
# Request the status bits
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_face_status()
# ============================================= # =============================================
# Collapse halfedge from 1 to 4 # Collapse halfedge from 1 to 4
# ============================================= # =============================================
...@@ -515,8 +498,8 @@ class Collapse(unittest.TestCase): ...@@ -515,8 +498,8 @@ class Collapse(unittest.TestCase):
# Collapse it # Collapse it
self.mesh.collapse(heh_collapse) self.mesh.collapse(heh_collapse)
self.assertTrue(self.mesh.status(vh_from).deleted()) self.assertTrue(self.mesh.is_deleted(vh_from))
self.assertFalse(self.mesh.status(vh_to).deleted()) self.assertFalse(self.mesh.is_deleted(vh_to))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -7,11 +7,6 @@ class TriMeshGarbageCollection(unittest.TestCase): ...@@ -7,11 +7,6 @@ class TriMeshGarbageCollection(unittest.TestCase):
def setUp(self): def setUp(self):
self.mesh = openmesh.TriMesh() self.mesh = openmesh.TriMesh()
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_halfedge_status()
self.mesh.request_face_status()
# Add some vertices # Add some vertices
self.vhandle = [] self.vhandle = []
......
...@@ -178,10 +178,6 @@ class TriMeshIterators(unittest.TestCase): ...@@ -178,10 +178,6 @@ class TriMeshIterators(unittest.TestCase):
# Run over all halfedges # Run over all halfedges
heCounter = 0 heCounter = 0
self.mesh.request_face_status()
self.mesh.request_vertex_status()
self.mesh.request_halfedge_status()
# Get second edge # Get second edge
eh = self.mesh.edge_handle(2) eh = self.mesh.edge_handle(2)
...@@ -280,10 +276,6 @@ class TriMeshIterators(unittest.TestCase): ...@@ -280,10 +276,6 @@ class TriMeshIterators(unittest.TestCase):
# Run over all halfedges # Run over all halfedges
heCounter = 0 heCounter = 0
self.mesh.request_face_status()
self.mesh.request_vertex_status()
self.mesh.request_halfedge_status()
# Get second edge # Get second edge
eh = self.mesh.edge_handle(2) eh = self.mesh.edge_handle(2)
...@@ -360,11 +352,6 @@ class TriMeshIterators(unittest.TestCase): ...@@ -360,11 +352,6 @@ class TriMeshIterators(unittest.TestCase):
self.assertFalse(found_37) self.assertFalse(found_37)
def test_face_iter_empty_mesh_one_deleted_face(self): def test_face_iter_empty_mesh_one_deleted_face(self):
# Request delete_face capability
self.mesh.request_vertex_status()
self.mesh.request_edge_status()
self.mesh.request_face_status()
# Add some vertices # Add some vertices
self.vhandle.append(self.mesh.add_vertex(np.array([0, 0, 0]))) self.vhandle.append(self.mesh.add_vertex(np.array([0, 0, 0])))
self.vhandle.append(self.mesh.add_vertex(np.array([0, 1, 0]))) self.vhandle.append(self.mesh.add_vertex(np.array([0, 1, 0])))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment