Skip to content

Commit

Permalink
- fix glitch of test if sites are planes or lines (if not then it can…
Browse files Browse the repository at this point in the history
… increase performance)
  • Loading branch information
satabol committed Apr 5, 2024
1 parent c340eab commit cd3a298
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils/voronoi3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cd3a298

Please sign in to comment.