File tree Expand file tree Collapse file tree
autoarray/structures/mesh Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -487,9 +487,13 @@ def split_cross(self) -> np.ndarray:
487487 gradient regularization to an `Inversion` using a Delaunay triangulation or Voronoi mesh.
488488 """
489489
490+ half_region_area_sqrt_lengths = 0.5 * np .sqrt (
491+ self .voronoi_pixel_areas_for_split
492+ )
493+
490494 return split_points_from (
491495 points = self .array ,
492- area_weights = 0.5 * self . delaunay . areas ,
496+ area_weights = half_region_area_sqrt_lengths ,
493497 xp = self ._xp ,
494498 )
495499
@@ -502,21 +506,10 @@ def voronoi_pixel_areas(self) -> np.ndarray:
502506 an input value of N% the maximum area of the Voronoi mesh, which this value is suitable for different
503507 calculations.
504508 """
505- voronoi_vertices = self .voronoi .vertices
506- voronoi_regions = self .voronoi .regions
507- voronoi_point_region = self .voronoi .point_region
508- region_areas = np .zeros (self .pixels )
509-
510- for i in range (self .pixels ):
511- region_vertices_indexes = voronoi_regions [voronoi_point_region [i ]]
512- if - 1 in region_vertices_indexes :
513- region_areas [i ] = - 1
514- else :
515- region_areas [i ] = grid_2d_util .compute_polygon_area (
516- voronoi_vertices [region_vertices_indexes ]
517- )
518-
519- return region_areas
509+ return voronoi_areas_via_delaunay_from (
510+ self .delaunay .points ,
511+ self .delaunay .simplices ,
512+ )
520513
521514 @property
522515 def voronoi_pixel_areas_for_split (self ) -> np .ndarray :
You can’t perform that action at this time.
0 commit comments