D
D
dom1n1k2018-05-23 10:52:16
Mathematics
dom1n1k, 2018-05-23 10:52:16

What is the best way to store a Voronoi diagram?

Let's leave the construction algorithm behind the scenes - let's say we know how to do it in some way, and even if only manually.
But what is the best way to store the finished chart, what data structure to use?
And not just to store, but to quickly and conveniently find out in which cell an arbitrary point fell into.
After all, it (the diagram) is generally devoid of any regularity.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2018-05-23
@sergiks

"Keep the chart" makes no sense.
I would store only the coordinates of the points and, when requested, do a search for the nearest neighbor. After all, the whole point of the Voronoi diagram is to divide it into regions where the nearest neighbor is one of the control points.
Upd. Perhaps I was wrong and you can store the diagram as a binary tree, which will give a faster search for an answer to whether a point belongs to an area - by traversing the tree. (or won't?)

F
forspamonly2, 2018-05-24
@forspamonly2

if you need to quickly find out the nearest point to a given one, then you can store the Voronoi diagram as a raster map.
regular grid, each cell has a list of nearest points. most of the cells inside the polygons of the diagram will have a list of one element, and on the borders between the polygons - of several.
the higher the resolution of the map, the more hits and less calculations per point. at a low card resolution (if there is little memory), you get a bloom filter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question