From cd3a298e0a3fc7f22f8d754776b32fe37e256b9f Mon Sep 17 00:00:00 2001 From: satabol Date: Sat, 6 Apr 2024 00:59:59 +0300 Subject: [PATCH] - fix glitch of test if sites are planes or lines (if not then it can increase performance) --- utils/voronoi3d.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/voronoi3d.py b/utils/voronoi3d.py index ba5d512839..8f6dbf1515 100644 --- a/utils/voronoi3d.py +++ b/utils/voronoi3d.py @@ -397,12 +397,12 @@ def cut_cell(start_mesh, sites_delaunay_params, site_idx, spacing, center_of_mas # select random sites to test are they are tethraeder or 3D? # If this thethod get wrong answer then not optimal method will be used. list_sites_for_test_plane = random.sample( range(0, len(sites)), 4) - v0 = sites[list_sites_for_test_plane[0]] - res = v0 - for I in range(1,4): + v0 = Vector(sites[list_sites_for_test_plane[0]]) + res = Vector(sites[list_sites_for_test_plane[1]])-v0 + for I in range(2,4): v_I = list_sites_for_test_plane[I] - res = np.cross( res, sites[v_I] ) - res_norm = np.linalg.norm( res/np.linalg.norm(res) ) + res = np.cross( res, Vector(sites[v_I])-v0 ) + res_norm = np.linalg.norm(res,ord=1) if res_norm>0.1: are_sites_plane = False else: