Skip to content

Commit 64fea12

Browse files
author
Alec Jacobson
committed
fix annoying random data
1 parent b923da5 commit 64fea12

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

tests/test_basic.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,18 @@ def setUp(self):
3838
self.v2, self.f2 = igl.read_triangle_mesh(
3939
os.path.join(self.test_data_path, "fertility.off"))
4040

41-
self.v = np.random.rand(10, 3).astype(self.v1.dtype)
42-
self.t = np.random.rand(10, 4)
43-
self.f = np.random.randint(0, 10, size=(20, 3), dtype=self.f1.dtype)
44-
self.g = np.random.randint(0, 10, size=(20, 4), dtype="int32")
41+
## Alec: I don't understand why it makes sense to use junk random data
42+
## for the tests. Especially for f and t. These will almost never be
43+
## non-degenerate meshes.
44+
#self.v = np.random.rand(10, 3).astype(self.v1.dtype)
45+
#self.t = np.random.rand(10, 4)
46+
#self.f = np.random.randint(0, 10, size=(20, 3), dtype=self.f1.dtype)
47+
#self.g = np.random.randint(0, 10, size=(20, 4), dtype="int32")
48+
self.v, self.t, self.f = igl.read_mesh(os.path.join(self.test_data_path, "decimated-knight.mesh"))
49+
# This model is a quad mesh that's been trivially triangulated
50+
self.v3, self.f3 = igl.read_triangle_mesh(os.path.join(self.test_data_path, "face.obj"))
51+
self.q3 = np.concatenate((self.f3[0::2,0:3], self.f3[1::2,2:3]), axis=1)
52+
4553

4654
self.default_int = np.array(range(2)).dtype
4755
self.default_float = np.zeros((2,2)).dtype
@@ -443,9 +451,9 @@ def test_circumradius(self):
443451
self.assertTrue(r.flags.c_contiguous)
444452

445453
def test_quad_planarity(self):
446-
p = igl.quad_planarity(self.v, self.g)
447-
self.assertTrue(p.dtype == self.v.dtype)
448-
self.assertEqual(p.shape[0], self.g.shape[0])
454+
p = igl.quad_planarity(self.v3, self.q3)
455+
self.assertTrue(p.dtype == self.v3.dtype)
456+
self.assertEqual(p.shape[0], self.q3.shape[0])
449457
self.assertTrue(p.flags.c_contiguous)
450458

451459
def test_collapse_small_triangles(self):
@@ -2536,7 +2544,7 @@ def test__version(self):
25362544

25372545
def test_blue_noise(self):
25382546
r = igl.avg_edge_length(self.v, self.f)
2539-
b,fi,p = igl.blue_noise(self.v, self.f, r*0.1)
2547+
b,fi,p = igl.blue_noise(self.v, self.f, r)
25402548
self.assertTrue(b.shape[0] == fi.shape[0])
25412549
self.assertTrue(b.shape[0] == p.shape[0])
25422550
self.assertTrue(self.v.shape[1] == p.shape[1])

0 commit comments

Comments
 (0)