Skip to content

Commit e978f6f

Browse files
committed
add unreferenced vertex test
1 parent 6605d40 commit e978f6f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/robust_laplacian_test.py

+27
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,33 @@ def test_mesh_laplacian(self):
6464
# rl.mesh_laplacian(V, "cat")
6565
# rl.mesh_laplacian(V.flatten(), F)
6666
# rl.mesh_laplacian(V, F.flatten())
67+
68+
def test_mesh_laplacian_unused_verts(self):
69+
70+
V = generate_verts()
71+
F = generate_faces()
72+
73+
# add an unused vertex at the beginning and end
74+
V = np.vstack((
75+
np.array([[0., 0., 0.,]]),
76+
V,
77+
np.array([[0., 0., 0.,]])
78+
))
79+
F = F + 1
80+
81+
L, M = rl.mesh_laplacian(V, F)
82+
83+
# Validate mass matrix
84+
self.assertTrue(is_nonnegative(M))
85+
self.assertTrue(is_symmetric(M))
86+
self.assertEqual(M.sum(), M.diagonal().sum())
87+
88+
# Validate Laplacian
89+
self.assertTrue(is_symmetric(L))
90+
off_L = scipy.sparse.diags(L.diagonal()) - L
91+
self.assertTrue(is_nonnegative(off_L)) # positive edge weights
92+
self.assertGreater(L.sum(), -1e-5)
93+
6794

6895
def test_point_cloud_laplacian(self):
6996

0 commit comments

Comments
 (0)