@@ -2470,6 +2470,41 @@ def test_flip_edge(self):
24702470 emap .dtype == self .f1 .dtype )
24712471 self .assertTrue (np .array (ue2e ).dtype == self .f1 .dtype )
24722472
2473+ def test_AABB (self ):
2474+ tree = igl .AABB_f64_3 ()
2475+ tree .init (self .v1 ,self .f1 )
2476+ bc = igl .barycenter (self .v1 ,self .f1 )
2477+ sqrD = tree .squared_distance (self .v1 ,self .f1 ,bc )
2478+ self .assertTrue (sqrD .shape [0 ] == bc .shape [0 ])
2479+ self .assertTrue (np .max (sqrD ) <= 1e-16 )
2480+ sqrD ,I ,C = tree .squared_distance (self .v1 ,self .f1 ,bc ,return_index = True ,return_closest_point = True )
2481+ self .assertTrue (sqrD .shape [0 ] == bc .shape [0 ])
2482+ self .assertTrue (I .shape [0 ] == bc .shape [0 ])
2483+ self .assertTrue (C .shape == bc .shape )
2484+
2485+ def test_in_element_3 (self ):
2486+ V = np .array ([ [0. ,0 ,0 ], [1 ,0 ,0 ], [0 ,1 ,0 ], [0 ,0 ,1 ], [1 ,1 ,1 ]],dtype = 'float64' )
2487+ T = np .array ([[0 ,1 ,2 ,3 ],[4 ,3 ,2 ,1 ]],dtype = 'int32' )
2488+ Q = np .array ([[0.1 ,0.1 ,0.1 ],[0.9 ,0.9 ,0.9 ]],dtype = 'float64' )
2489+ tree = igl .AABB_f64_3 ()
2490+ tree .init (V ,T )
2491+ I = igl .in_element_3 (V ,T ,Q ,tree )
2492+ self .assertTrue (I .shape [0 ] == Q .shape [0 ])
2493+ self .assertTrue (I [0 ] == 0 )
2494+ self .assertTrue (I [1 ] == 1 )
2495+
2496+ def test_in_element_2 (self ):
2497+ V = np .array ([ [0. ,0 ], [1 ,0 ], [0 ,1 ], [1 ,1 ]],dtype = 'float64' )
2498+ F = np .array ([[0 ,1 ,2 ],[2 ,1 ,3 ]],'int32' )
2499+ Q = np .array ([[0.1 ,0.1 ],[0.9 ,0.9 ]],dtype = 'float64' )
2500+ tree = igl .AABB_f64_2 ()
2501+ tree .init (V ,F )
2502+ I = igl .in_element_2 (V ,F ,Q ,tree )
2503+ self .assertTrue (I .shape [0 ] == Q .shape [0 ])
2504+ self .assertTrue (I [0 ] == 0 )
2505+ self .assertTrue (I [1 ] == 1 )
2506+
2507+
24732508 def test_triangulate (self ):
24742509 V = np .array ([[0 ,0 ],[1 ,0 ],[1 ,1 ],[0 ,1 ]],dtype = 'float64' )
24752510 E = np .array ([[0 ,1 ],[1 ,2 ],[2 ,3 ],[3 ,0 ]])
@@ -2489,6 +2524,7 @@ def test_triangulate(self):
24892524 self .assertTrue (E2 .shape == E .shape )
24902525 self .assertTrue (EM2 .shape == EM .shape )
24912526
2527+
24922528 # copyleft.cgal
24932529 def test_convex_hull (self ):
24942530 V = np .array ([[0 ,0 ,0 ],[1 ,0 ,0 ],[0 ,1 ,0 ],[0 ,0 ,1 ]],dtype = "float64" )
0 commit comments