How to partition (discretize) the space around points using Voronoi Diagram?

16 ビュー (過去 30 日間)
David Franco
David Franco 2020 年 4 月 24 日
コメント済み: HG 2021 年 6 月 14 日
I have a problem:
The plot shows a 399 cities locations and the Voroni Diagram (in latitude and longitude coordinates).
The question is, if a have a new coordinate pair and I want to assign it to some os the 399 cities how to find out which Voronoy cell it is in?
The coordinates file are attached.
Thanks in advance!

採用された回答

Sean de Wolski
Sean de Wolski 2020 年 4 月 24 日
編集済み: Sean de Wolski 2020 年 4 月 24 日
  • Create a polyshape for each voronoi cell.
  • Loop over cells and test isinterior for each, you can short circuit when you find a match. To be even smarter, you could calculate distance to each cell's centroid using pdist or hypot, sort it ascending, and start testing isinterior in that order.
NOTE: You should really project your lat/lon data into a cartesian coordinate system. Lat/Lon are measured on the surface of a sphere so the lengths of the voronoi cell edges are not in a linear unit. Look at mfwdtran or https://www.mathworks.com/help/map/ref/map.rasterref.geographiccellsreference.geographictointrinsic.html

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVoronoi Diagram についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by