0
$\begingroup$

Can anyone tell me the way to generate a 3D Voronoi Diagram like the one given at http://mathworld.wolfram.com/VoronoiDiagram.html. I need to draw the 4th diagram on this page (Second row, last plot).

In that plot the points are only on the top of the structures. I need to have points in-between the structures also (some of them needs to be visible). There needs to be two sets of points with two different colours. The ratio of density for the two sets of points should be 2-3 times.

$\endgroup$
6
$\begingroup$

Can anyone tell me the way to generate a 3D Voronoi Diagram like the one given at http://mathworld.wolfram.com/VoronoiDiagram.html. I need to draw the 4th diagram on this page (Second row, last plot).

pts = RandomReal[{}, {20, 3}];
Show[{
  ListPlot3D[pts, InterpolationOrder -> 0, Mesh -> None, 
   Filling -> Bottom, ColorFunction -> "Rainbow", 
   PlotRange -> {{0, 1}, {0, 1}, Automatic}],
  Graphics3D[{PointSize[.02], Point[pts]}]},
 ImageSize -> Medium ]

I copied this from the notebook on the page you linked.

In that plot the points are only on the top of the structures. I need to have points in-between the structures also (some of them needs to be visible).

For this we can simply take the z-coordinate and divide it by two for the plotted points.

There needs to be two sets of points with two different colours. The ratio of density for the two sets of points should be 2-3 times.

For this we will make two different plots and combine them with Show

plot1 = Show[{
   ListPlot3D[pts1, InterpolationOrder -> 0, Mesh -> None, 
    Filling -> Bottom, PlotStyle -> Purple, 
    PlotRange -> {{0, 1}, {0, 1}, Automatic}],
   Graphics3D[{PointSize[.02], Point[{#1, #2, #3/2} & @@@ pts1]}]}
  ]
plot2 = Show[{
   ListPlot3D[pts2, InterpolationOrder -> 0, Mesh -> None, 
    Filling -> Bottom, PlotStyle -> Green, 
    PlotRange -> {{0, 1}, {0, 1}, Automatic}],
   Graphics3D[{PointSize[.02], Point[{#1, #2, #3/2} & @@@ pts2]}]}
  ]

enter image description here

Show[plot1, plot2]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you very much for your answer. I think the code you copied from the link I provided is okay with me. However, if I want to replace the points in the plot with some other items, How to do it? For example, If I want replace each of the points with the router figure given at en.wikipedia.org/wiki/Wireless_router, is it possible? The size of the router should be as small as possible but completely recognisable. $\endgroup$ – Dimitrios Feb 26 '16 at 2:37
  • $\begingroup$ It would be very nice if some points can be put in the shadowed regions. I just want a plot like second plot you had drawn on this page with some points on top of the 3D building kind of shapes. And the points needs to be replaced with routers given in my previous comment. My model is: In a 3D squared region, there will be some buildings and routers will be within and top of the buildings. $\endgroup$ – Dimitrios Feb 26 '16 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.