|
5 | 5 | import igl |
6 | 6 | print("Using igl found at: ",igl.__file__) |
7 | 7 | import igl.triangle |
| 8 | +import igl.copyleft.tetgen |
8 | 9 | import igl.copyleft.cgal |
9 | 10 | import numpy as np |
10 | 11 | import scipy as sp |
@@ -2535,6 +2536,26 @@ def test_triangulate(self): |
2535 | 2536 | self.assertTrue(E2.shape == E.shape) |
2536 | 2537 | self.assertTrue(EM2.shape == EM.shape) |
2537 | 2538 |
|
| 2539 | + def test_tetrahedralize(self): |
| 2540 | + V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype='float64') |
| 2541 | + F = np.array([[0,1,2],[0,1,3],[0,2,3],[1,2,3]]) |
| 2542 | + TV,TT,TF = igl.copyleft.tetgen.tetrahedralize(V,F); |
| 2543 | + self.assertTrue(TV.shape == V.shape) |
| 2544 | + self.assertTrue(TT.shape == (4,)) |
| 2545 | + self.assertTrue(TF.shape == F.shape) |
| 2546 | + V = np.array([[1,1,0],[1,-1,0],[-1,-1,0],[-1,1,0],[0,0,1]],dtype='float64') |
| 2547 | + TV,TT,TF = igl.copyleft.tetgen.tetrahedralize(V,switches="cQ"); |
| 2548 | + self.assertTrue(TV.shape == V.shape) |
| 2549 | + self.assertTrue(TT.shape == (2,4)) |
| 2550 | + self.assertTrue(TF.shape == (6,3)) |
| 2551 | + TV,TT,TF = igl.copyleft.tetgen.tetrahedralize(self.v1,self.f1,switches="pQq1.34"); |
| 2552 | + igl.writeMESH("test.mesh",TV,TT,TF) |
| 2553 | + self.assertTrue(TV.shape[0] > self.v1.shape[0]) |
| 2554 | + self.assertTrue(TT.shape[0] > self.f1.shape[0]) |
| 2555 | + |
| 2556 | + |
| 2557 | + def test_writeMESH(self): |
| 2558 | + igl.writeMESH("test.mesh",self.v4,self.t4,self.f4) |
2538 | 2559 |
|
2539 | 2560 | # copyleft.cgal |
2540 | 2561 | def test_convex_hull(self): |
@@ -2599,6 +2620,10 @@ def test_triangle(self): |
2599 | 2620 | # check that type is <class 'module'> |
2600 | 2621 | self.assertTrue(type(igl.copyleft) == type(igl)) |
2601 | 2622 |
|
| 2623 | + def test_copyleft_tetgen(self): |
| 2624 | + # check that type is <class 'module'> |
| 2625 | + self.assertTrue(type(igl.copyleft.tetgen) == type(igl)) |
| 2626 | + |
2602 | 2627 |
|
2603 | 2628 |
|
2604 | 2629 | if __name__ == '__main__': |
|
0 commit comments