This page gives a self-contained treatment of the Voronoi tessellation as the local integration subdomain in the MLPG5 method: its mathematical definition, its dual relationship with the Delaunay triangulation, how it is constructed and clipped in GearMaster, and a rigorous comparison with circular and rectangular alternatives.
Implemented in: assembler.py — assemble_stiffness_voronoi(),
_compute_voronoi_cells(), _clip_polygon_pyclipper()
(uses scipy.spatial.Voronoi and optionally pyclipper).
Let P = {x1, …, xN} be a finite set of points in ℜ2 (the generators or sites). The Voronoi cell of site xI is the set of all points in the plane at least as close to xI as to any other site:
Each cell is a (possibly unbounded) convex polygon. The Voronoi diagram is the subdivision of ℜ2 into the N cells {VI}. Key combinatorial properties:
Voronoi diagrams were introduced by Dirichlet (1850) in the context of quadratic forms and independently by Voronoi (1908). The discrete geometry community refers to them also as Dirichlet tessellations or Thiessen polygons.
The Voronoi diagram and the Delaunay triangulation of the same point set are geometric duals: every Voronoi vertex corresponds to a Delaunay triangle, every Voronoi edge corresponds to a Delaunay edge, and every Voronoi cell corresponds to a Delaunay vertex.
Formally, the Delaunay triangulation DT(P) is the unique triangulation (for points in general position) such that the open circumdisc of every triangle contains no other generator:
The Voronoi vertex associated with triangle Tijk is precisely the circumcentre of that triangle. The duality means:
In GearMaster, the Voronoi diagram is computed directly via
scipy.spatial.Voronoi (Fortune's sweep algorithm, O(N log N)),
without building the Delaunay triangulation explicitly. The duality is exploited
implicitly: the Voronoi cells of a point set generated by the Poisson-disk or
Delaunay samplers in GearMaster are near-regular hexagons (which is exactly the Voronoi
dual of an approximately regular triangulation).
In MLPG5 the stiffness contribution of node I is:
The choice of ΩI is theoretically free, but the numerical and physical quality of the method depends critically on it. Using ΩI = VI (the Voronoi cell of node I) has a compelling set of motivations:
The Voronoi cells partition the domain exactly:
This means that every point of the domain is counted exactly once in the assembly. There are no integration gaps and no integration overlaps. For a divergence-based formulation (which MLPG5 is), exact partition directly implies local conservation: summing the equations over all subdomains recovers the global balance law exactly.
The Voronoi cell is the region of the plane "owned" by node I in the closest-point sense. This is the most natural and physically unambiguous way to associate an integration region with a node — it corresponds to the nearest-neighbour interpolation region and provides equal-area cells (approximately) for uniform distributions.
Every Voronoi edge e_{IJ} separates cells VI and VJ. Because the outward normals at e_{IJ} are opposite for the two cells, the flux contributions at that shared edge cancel in pairs when summing over the global assembly — a discrete analogue of the interior flux cancellation in the divergence theorem. This is geometrically equivalent to the finite-volume flux conservation property.
Unlike circular and rectangular subdomains, Voronoi cells adapt automatically to the local point spacing: large cells appear where nodes are sparse, small cells where nodes are dense. This makes the method naturally suited to graded and adaptive refinement, where the integration quality degrades gracefully rather than abruptly when spacing changes.
The raw scipy.spatial.Voronoi output contains infinite regions for
nodes on or near the convex hull: some Voronoi vertices are sent to infinity because there
is no generator on the other side. To obtain bounded polygonal cells for all nodes,
GearMaster applies the mirror-node technique: four sets of ghost nodes are added
by reflecting the real nodes across the four sides of the bounding box:
where Pleft = \{(2xmin − xi,\; yi)\}, etc. The Voronoi tessellation is computed on P ∪ Pmirror. Mirror nodes force the Voronoi ridges of boundary nodes to terminate within the bounding box, so every real node's region VI is a bounded polygon.
Only the regions corresponding to the original N real nodes (indices 0 to N−1) are retained.
For non-convex domains (L-shapes, stepped beams, holes), the Voronoi cell of a boundary node may extend outside the physical domain. After computing the bounded Voronoi polygon for each node, GearMaster clips it to the true domain polygon using PyClipper (a Python wrapper for the Clipper2 polygon-clipping library):
The domain polygon Ω is the ordered CCW boundary polygon
stored in GM_PointCloud.domain_polygon. It is generated at point-cloud creation
time, either from the CAD model wire edges (via OpenCASCADE BRepTools_WireExplorer)
or by tangent-guided nearest-neighbour traversal of the boundary nodes.
PyClipper operates with integer coordinates at a scale of
1 000 000 (1×106) to avoid floating-point
precision issues. The clipped result is converted back to floating-point coordinates.
pyclipper is not installed, GearMaster
falls back to clipping each Voronoi polygon to the bounding box using the
Sutherland-Hodgman algorithm. This is incorrect for non-convex domains — cells near
re-entrant corners will include area outside the physical domain, producing integration
errors. Installing pyclipper is strongly recommended:
pip install pyclipper.
After clipping, some edges of VIclipped
coincide with the domain boundary ∂Ω. These edges
are excluded from the stiffness integral. The physical reason is that on
∂ΩI ∩ ∂Ω the flux
NTDBJ represents
the traction boundary condition, which is handled separately in the force vector
(via apply_concentrated_loads()). Including it in K would double-count
the boundary traction.
Segment exclusion is implemented by checking whether both endpoints of each Voronoi edge
lie within a tolerance (2e-6) of any edge of the domain polygon.
_compute_voronoi_cells():
scipy.spatial.Voronoi(augmented).vor.regions.query_ball_point(x_g, r_max)).sparse_K=True: convert COO triplets to CSR matrix.| Property | Voronoi (default) |
Rectangular (β ≤ 0.5) |
Circular (β ≤ 0.5) |
|---|---|---|---|
| Partition of domain | ✓ Exact | ✓ Exact (non-overlap) | ✗ Overlaps possible |
| Correct for irregular clouds | ✓ Automatic adaptation | ✗ Assumes near-regular grid | ✗ Fixed radius per node |
| Non-convex domain support | ✓ Via PyClipper | ✓ Via bbox clipping | ✓ Via arc clipping |
| Exact flux cancellation | ✓ On shared Voronoi edges | ✓ On axis-aligned shared sides | ✗ No geometric contact |
| Segment count per node | 4–10 (varies) | 4 (fixed) | 1 arc (full circle) |
| Symmetry of resulting K | Non-symmetric | Non-symmetric | Non-symmetric |
| Dependence on β parameter | ✓ None | ✗ Sensitive (β ≤ 0.5) | ✗ Sensitive (β ≤ 0.5) |
| External library required | scipy (+ pyclipper) |
None | None |
| Recommended use | All cases; default | Regular-grid clouds only | Research / comparison |
scipy (always available in GearMaster)
and pyclipper (optional; falls back to bounding-box clipping without it).scipy.spatial.Voronoi runs in O(N log N); for
very large clouds (>105 nodes) this can take a few seconds.scipy.sparse.linalg.spsolve). This is more memory- and time-intensive
than the symmetric SPD solvers (Cholesky, CG) available for EFG Galerkin.scipy.spatial.Voronoi]