Support for clipped/centroidal Voronoi tessellations on non-convex geometries and multiply-connected/disjoint triangulations #147
Replies: 9 comments
-
A good example that almost works is using CairoMakie, DelaunayTriangulation
outer_boundary = [[(0.0, 0.0), (1.0, 0.0), (1.0, 0.3), (0.8, 0.3),
(0.8, 0.5), (1.0, 0.5), (1.0, 1.0), (0.0, 1.0), (0.0, 0.0)]]
inner_boundary = [[(0.2, 0.2), (0.2, 0.6), (0.4, 0.6), (0.4, 0.2), (0.2, 0.2)]]
boundary_nodes, points = convert_boundary_points_to_indices([outer_boundary, inner_boundary])
edges = Set(((2, 8), (5, 7)))
tri = triangulate(points; boundary_nodes, edges)
A = get_total_area(tri)
refine!(tri; max_area = 1e-3A, min_angle = 31.5)
vorn = voronoi(tri)
smooth_vorn = centroidal_smooth(vorn; maxiters = 2500)
cmap = cgrad(:jet)
colors = get_polygon_colors(vorn, cmap)
voronoiplot(smooth_vorn, show_generators = false, strokecolor = :red, strokewidth = 0.2, polygon_color = colors) |
Beta Was this translation helpful? Give feedback.
-
Note that |
Beta Was this translation helpful? Give feedback.
-
Any news on when to expect this feature? I'm thinking about using this package for producing high quality Voronoi meshes over geographical regions which are typically not convex, and this feature would certainly be handy. |
Beta Was this translation helpful? Give feedback.
-
No guarantees on any timeline, sorry @CNOT. Development on the package has temporarily stalled due to some life responsibilities, so can't say much for sure. I did have some ideas on how to address this, but haven't worked on anything yet. e: See new notice on the README. |
Beta Was this translation helpful? Give feedback.
-
@charperflow: In response to https://discourse.julialang.org/t/community-package-for-delaunay-triangulation-and-voronoi-cells/113249, specifically
Just wondering what your approach was for clipping to general convex boundaries? Is it similar to the current approach with a convex hull (I also have clipping to a general rectangle, but it's a bit specific to rectangles I think...)? |
Beta Was this translation helpful? Give feedback.
-
@DanielVandH: I don't know about @charperflow, but I did dig into this issue a fair bit. IMO the cleanest method for voronoi mesh construction on non-convex 3D geometries is the VoroCrust algorithm https://github.com/sandialabs/vorocrust-meshing. The 2D case is a bit hacky, however it can be done using their package as well. One needs to build a 3D object by stacking 2 copies of the 2D object on top of each other and then extract the cell generator coordinates near the boundary. I'm pretty certain there is a more direct and less hacky solution for 2D objects using the same ideas, however it hasn't been implemented in their software. |
Beta Was this translation helpful? Give feedback.
-
@DanielVandH Sorry for the latest response! Wrapping up the term and a bunch of applications, so it's quite hectic in my little corner of the world. Once things calm down in the transition to summer, I can dig back up the project, reorient myself, and give you a better response (probably 2-3 weeks)! Sorry!! |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reference. I looked at VoroCrust some time ago but the ideas seemed to be a bit difficult to fit into the existing code which is best suited for a workflow of
No worries, no rush at all. |
Beta Was this translation helpful? Give feedback.
-
@charperflow You might be interested in the latest release https://discourse.julialang.org/t/ann-delaunaytriangulation-v1-0-curved-domains-and-improved-docs-code/113997/11?u=danielvandh. I now allow you to provide a convex polygon to |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions