I want to make a diagram (and also a Graph
of the vertex + edge config) of the orthogonal projection of the intersections of a set of conical surfaces in order to create weighted Voronoi diagrams as in these pictures:
additively weighted Voronoi diagram (heights vary)
multiplicatively weighted Voronoi diagram (radii vary)
I tried to do this using Mathematica's geometric regions tools but they're not working well for me. For example, here is some code:
(* Define a cone centred at x,y,z with radius r and height h \
by subtracting a disk from the boundary of a solid cone *)
cone[x_, y_, z_, r_, h_] :=
RegionDifference[RegionBoundary[Cone[{{x, y, z}, {x, y, z + h}}, r]],
TransformedRegion[Ball[{x, y, z}, r],
Function[{p}, {p[[1]], p[[2]], 0}]]]
(* Create a random set of cones sitting on the xy-plane*)
n = 3;
SeedRandom[123]
points = RandomReal[{-1, 1}, {n, 2}];
heights = RandomReal[{1/2, 1}, n];
radii = RandomReal[{1/2, 1}, n];
cones = cone[#[[1, 1]], #[[1, 2]], 0, #[[2]], #[[3]]] & /@
Transpose[{points, heights, radii}];
(* Check discretize region for one cone*)
DiscretizeRegion[cones[[1]]]
(* Discretize union of intersections of cones *)
DiscretizeRegion[
RegionUnion[RegionIntersection /@ Subsets[cones, {2}]]]
For the particular random seed 123
, DiscretizeRegion[cones[[1]]]
outputs
However it fails for most other random seeds. And then the next line has failed for every seed I tried (and does so quite slowly).
What am I doing wrong and is there a better way to do this?
Thanks a lot.
EDIT: I hope to get this working nicely for about $n=60$.