@@ -796,6 +796,9 @@ def triangulate(
796796 if np .max (heights )== 0 :
797797 return self .subdivide (cells = [self .labels ])
798798
799+ if verbosity >= 1 :
800+ print (f"Constructing the triangulation via lifting..." ,flush = True )
801+
799802 # nonzero heights -> lift via a point configuration
800803 if backend == "cgal" :
801804 orig = np .zeros ((1 ,self .ambient_dim ),dtype = int )
@@ -811,18 +814,25 @@ def triangulate(
811814 # heights = 0 doesn't lead to trivial subdivision)
812815 #
813816 # maybe this causes errors leading to non-star triangulations...
814- height_min = np .min (heights )
815- height_orig = - 1e-6 * height_min
817+ height_scale = max (1 , np .min (heights ))
818+ height_orig = - 1e-6 * height_scale
819+
820+ Niter = 0
816821 while True :
822+ if verbosity >= 2 :
823+ print (f"Iteration { Niter } , trying the origin with height { height_orig } ..." ,end = '\r ' )
824+ Niter += 1
817825 heights_pc = np .concatenate (([height_orig ], heights ))
818826 simp_pcinds = pc .triangulate_with_heights (heights_pc ).simplices ()
819827
820828 # lower the height of the origin if not star
821829 if not all ([0 in simp for simp in simp_pcinds ]):
822- height_orig -= height_min
830+ height_orig -= 10 * height_scale
823831 continue
824832
825833 # star :)
834+ if verbosity >= 2 :
835+ print ("" )
826836 break
827837
828838 # check that we didn't lower the height of origin a crazy amount
@@ -839,7 +849,7 @@ def triangulate(
839849 # read the simplices as indices in the VC
840850 if not all ([0 in s for s in simp_pcinds ]):
841851 msg = "cgal didn't produce a star triangulation... "
842- msg += f"cells = { simp_pcinds } (0 corresponds to origin). "
852+ msg += f"cells = { sorted ([ sorted ( s ) for s in simp_pcinds . tolist ()]) } (0 corresponds to origin). "
843853 msg += "maybe try PPL..."
844854 raise ValueError (msg )
845855 simp_vcinds = [[pti - 1 for pti in s if pti != 0 ] for s in simp_pcinds ]
@@ -863,6 +873,9 @@ def triangulate(
863873 f = self .triangulate (cells = simp_labels )
864874
865875 # some sanity checks
876+ if verbosity >= 1 :
877+ print (f"Doing sanity checks on the triangulation..." ,flush = True )
878+
866879 if not f .is_triangulation ():
867880 if verbosity >= 1 :
868881 msg = "Upon lifting, a non-triangulation subdivision was "
0 commit comments