@@ -600,3 +600,64 @@ def udf_sphere(Q):
600600 unique_ijk , J , unique_corners = igl .unique_sparse_voxel_corners (origin ,h0 ,max_depth ,ijk )
601601 unique_S = sdf_sphere (unique_corners )
602602 V ,F = igl .marching_cubes (unique_S ,unique_corners ,J ,0.0 )
603+
604+ def test_is_intrinsic_delaunay () -> None :
605+ # vs and fs come from a simple plane from pyvista
606+ # mesh = pv.Plane(i_resolution=3, j_resolution=2, i_size=2).triangulate()
607+ # fs = mesh._connectivity_array.reshape(-1, 3).astype(np.int32)
608+ # vs = mesh.points.astype(np.float64)
609+
610+ fs = np .array (
611+ [
612+ [0 , 1 , 4 ],
613+ [1 , 5 , 4 ],
614+ [1 , 2 , 5 ],
615+ [2 , 6 , 5 ],
616+ [2 , 3 , 6 ],
617+ [3 , 7 , 6 ],
618+ [4 , 5 , 8 ],
619+ [5 , 9 , 8 ],
620+ [5 , 6 , 9 ],
621+ [6 , 10 , 9 ],
622+ [6 , 7 , 10 ],
623+ [7 , 11 , 10 ],
624+ ]
625+ )
626+
627+ vs = np .array (
628+ [
629+ [- 1.0 , - 0.5 , 0.0 ],
630+ [- 0.33333334 , - 0.5 , 0.0 ],
631+ [0.33333334 , - 0.5 , 0.0 ],
632+ [1.0 , - 0.5 , 0.0 ],
633+ [- 1.0 , 0.0 , 0.0 ],
634+ [- 0.33333334 , 0.0 , 0.0 ],
635+ [0.33333334 , 0.0 , 0.0 ],
636+ [1.0 , 0.0 , 0.0 ],
637+ [- 1.0 , 0.5 , 0.0 ],
638+ [- 0.33333334 , 0.5 , 0.0 ],
639+ [0.33333334 , 0.5 , 0.0 ],
640+ [1.0 , 0.5 , 0.0 ],
641+ ]
642+ )
643+
644+ lin = igl .edge_lengths (vs , fs )
645+ mask = igl .is_intrinsic_delaunay (lin , fs ).astype (bool )
646+
647+ expected_mask = np .array (
648+ [
649+ [0 , 1 , 1 ],
650+ [1 , 0 , 1 ],
651+ [1 , 1 , 1 ],
652+ [1 , 1 , 1 ],
653+ [0 , 1 , 1 ],
654+ [1 , 0 , 1 ],
655+ [0 , 1 , 1 ],
656+ [1 , 0 , 1 ],
657+ [1 , 1 , 1 ],
658+ [1 , 1 , 1 ],
659+ [0 , 1 , 1 ],
660+ [1 , 0 , 1 ],
661+ ]
662+ )
663+ assert np .array_equal (mask , expected_mask )
0 commit comments