Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4947 fixing Overlapping Voronoi 3D sites #4948

Merged
merged 12 commits into from
Jul 18, 2023

Conversation

satabol
Copy link
Collaborator

@satabol satabol commented Jul 11, 2023

  1. Fix some glitches of disappearing parts if spacing is growing.
  2. Voronoi algorithm speed up. Has some glitches. qhull do not see some sites near each other.

image

image

Sites 1 and 9 overlapped. QHull do not see them as overlapped.

for tests:
Voronoi on mesh.004.glitches.overlapped sites.blend.zip


See also:

satabol added 3 commits July 11, 2023 19:10
01. Fix some glitches of disappearing parts if spacing is growing.
02. Voronoi algorithm speed up. Has some glitches. qhull do not see some sites near each other.
…hes on torus horisontal bisect (fill main hole)
@satabol
Copy link
Collaborator Author

satabol commented Jul 12, 2023

image

Test:

Test.Voronoi.on.mesh.002.Good.edit.mp4

satabol added 3 commits July 13, 2023 21:39
2. Optimization for bisect order
3. make bbox_aligned optimization for precalc side of planes of bisections
4. Optimize mesh performance
2. Optimization for bisect order
3. make bbox_aligned optimization for precalc side of planes of bisections
@satabol
Copy link
Collaborator Author

satabol commented Jul 15, 2023

see also:

Description of optimization:
image

1. Optimization for except some bisects

  1. if bbox_aligned is on the positive side of site then object will have no changes after bisect and all its vertices stay unchanged. One can skip that bisects.
    image

  2. if bbox_aligned is on the negative side of the site then object will be erased (clear) after bisect (if any bisects was before too). So one can skip all bisects and return empty object without of any bisects.
    image

2. Optimization for bisect order
This program doesn't know anything about topology of mesh. So this algorithm observe this mesh as cloud of points with max concentration near the center_of_mass (not geometric center. geometric center do not point to the center of mass).
image
Radius has no specific value now but this is not need for this algorithm. It is very simple for now to select what plain to bisect first plain12 or plane23 when process site1? (Do you see this is not need to know the radius value?) Now obvious that bisect plane with center on negative side will remove more points from mesh geometry than plane with center on positive side. So plane12 is better plane13. So we simplify next bisects because they will be work with less geometry.
If there is two planes both with center on negative side then need first select a plane with bigger distance from center to plane:
image
here is the plane14 is better the plane12.
Positive side of planes has the same rule about distance. First plane has bigger distance from center to plane to remove maximum geometry on bisect.

3. test is spacing is more than all dists from planes to Site.
if all distance from planes to their site is less than a spacing/2 then the bisect will cutoff all vertices anyway:
image
so one can to skip all bisect and return nothing for this site.

Test File

Voronoi on mesh.005.tests with meshes and points.blend.zip

Content of file:
image

@satabol
Copy link
Collaborator Author

satabol commented Jul 15, 2023

Result

image

utils/voronoi3d.py Outdated Show resolved Hide resolved
utils/voronoi3d.py Outdated Show resolved Hide resolved
utils/voronoi3d.py Outdated Show resolved Hide resolved
utils/voronoi3d.py Outdated Show resolved Hide resolved
satabol added 3 commits July 15, 2023 21:38
- unused function removed (get_ridges_per_site for voronoi)
- unused function removed (get_ridges_per_site for voronoi)
@satabol
Copy link
Collaborator Author

satabol commented Jul 16, 2023

All vectors math expressions aligned to direction to site_idx from site_pair_idx (all expressions with “plain_no” has “+” , no “-“ now).

- fix signs in expressions with plane's normal.
- replace 'fill' parameter to 'mode' to the future use in the function 'voronoi_on_mesh_bmesh'
@satabol satabol force-pushed the fix_4947_overlapping_voronoi_3d_sites branch from 5bd5947 to 9dff62a Compare July 18, 2023 16:11
@satabol satabol merged commit 926f26e into master Jul 18, 2023
@satabol satabol deleted the fix_4947_overlapping_voronoi_3d_sites branch July 18, 2023 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants