voronoi

plotting and coloring data on irregular grid

帅比萌擦擦* 提交于 2019-11-30 02:23:14
I have data in the form (x, y, z) where x and y are not on a regular grid. I wish to display a 2D colormap of these data, with intensity (say, grey scale) mapped to the z variable. An obvious solution is to interpolate (see below) on a regular grid, d <- data.frame(x=runif(1e3, 0, 30), y=runif(1e3, 0, 30)) d$z = (d$x - 15)^2 + (d$y - 15)^2 library(akima) d2 <- with(d, interp(x, y, z, xo=seq(0, 30, length = 30), yo=seq(0, 30, length = 50), duplicate="mean")) pal1 <- grey(seq(0,1,leng=500)) with(d2, image(sort(x), sort(y), z, useRaster=TRUE, col = pal1)) points(d$x, d$y, col="white", bg=grey(d$z

Nearest Neighbor Searching using Voronoi Diagrams

╄→尐↘猪︶ㄣ 提交于 2019-11-29 01:47:46
I've successfully implemented a way to generate Voronoi diagrams in 2 dimensions using Fortune's method. But now I'm trying to use it for nearest neighbor queries for a point (which is not one of the original points used to generate the diagram). I keep seeing people saying that it can be done in O(lg n) time (and I believe them), but I can't find a description of how it's actually done. I'm familiar with binary searches, but I can't figure out a good criteria to guarantee that upper bound. I also figured maybe it could have to do with inserting the point into the diagram and updating

plotting and coloring data on irregular grid

痴心易碎 提交于 2019-11-28 23:14:22
问题 I have data in the form (x, y, z) where x and y are not on a regular grid. I wish to display a 2D colormap of these data, with intensity (say, grey scale) mapped to the z variable. An obvious solution is to interpolate (see below) on a regular grid, d <- data.frame(x=runif(1e3, 0, 30), y=runif(1e3, 0, 30)) d$z = (d$x - 15)^2 + (d$y - 15)^2 library(akima) d2 <- with(d, interp(x, y, z, xo=seq(0, 30, length = 30), yo=seq(0, 30, length = 50), duplicate="mean")) pal1 <- grey(seq(0,1,leng=500))

Voronoi diagram polygons enclosed in geographic borders

人走茶凉 提交于 2019-11-28 20:46:38
I am trying to create Voronoi polygons (aka Dirichlet tessellations or Thiessen polygons) within a fixed geographic region for a set of points. However, I am having trouble finding a method in R that will bound the polygons within the map borders. My main goal is to get accurate area calculations (not simply to produce a visual plot). For example, the following visually communicates what I'm trying to achieve: library(maps) library(deldir) data(countyMapEnv) counties <- map('county', c('maryland,carroll','maryland,frederick', 'maryland,montgomery', 'maryland,howard'), interior=FALSE) x <- c(

Getting a bounded polygon coordinates from Voronoi cells

…衆ロ難τιáo~ 提交于 2019-11-28 20:46:23
I have points (e.g., lat, lon pairs of cell tower locations) and I need to get the polygon of the Voronoi cells they form. from scipy.spatial import Voronoi tower = [[ 24.686 , 46.7081], [ 24.686 , 46.7081], [ 24.686 , 46.7081]] c = Voronoi(towers) Now, I need to get the polygon boundaries in lat,lon coordinates for each cell (and what was the centroid this polygon surrounds). I need this Voronoi to be bounded as well. Meaning that the boundaries don't go to infinity, but rather within a bounding box. Given a rectangular bounding box, my first idea was to define a kind of intersection

How do I derive a Voronoi diagram given its point set and its Delaunay triangulation?

半腔热情 提交于 2019-11-28 17:52:44
I'm working on a game where I create a random map of provinces (a la Risk or Diplomacy). To create that map, I'm first generating a series of semi-random points, then figuring the Delaunay triangulations of those points. With that done, I am now looking to create a Voronoi diagram of the points to serve as a starting point for the province borders. My data at this point (no pun intended) consists of the original series of points and a collection of the Delaunay triangles. I've seen a number of ways to do this on the web, but most of them are tied up with how the Delaunay was derived. I'd love

Python: Calculate Voronoi Tesselation from Scipy's Delaunay Triangulation in 3D

别来无恙 提交于 2019-11-28 16:21:48
问题 I have about 50,000 data points in 3D on which I have run scipy.spatial.Delaunay from the new scipy (I'm using 0.10) which gives me a very useful triangulation. Based on: http://en.wikipedia.org/wiki/Delaunay_triangulation (section "Relationship with the Voronoi diagram") ...I was wondering if there is an easy way to get to the "dual graph" of this triangulation, which is the Voronoi Tesselation. Any clues? My searching around on this seems to show no pre-built in scipy functions, which I

Algorithm to compute a Voronoi diagram on a sphere?

南笙酒味 提交于 2019-11-28 16:06:03
I'm looking for a simple (if exists) algorithm to find the Voronoi diagram for a set of points on the surface of a sphere. Source code would be great. I'm a Delphi man (yes, I know...), but I eat C-code too. Jason S Here's a paper on spherical Voronoi diagrams . Or if you grok Fortran (bleah!) there's this site . Update in July 2016: Thanks to a number of volunteers (especially Nikolai Nowaczyk and I), there is now far more robust / correct code for handling Voronoi diagrams on the surface of a sphere in Python. This is officially available as scipy.spatial.SphericalVoronoi from version 0.18

Nearest Neighbor Searching using Voronoi Diagrams

早过忘川 提交于 2019-11-27 16:13:39
问题 I've successfully implemented a way to generate Voronoi diagrams in 2 dimensions using Fortune's method. But now I'm trying to use it for nearest neighbor queries for a point (which is not one of the original points used to generate the diagram). I keep seeing people saying that it can be done in O(lg n) time (and I believe them), but I can't find a description of how it's actually done. I'm familiar with binary searches, but I can't figure out a good criteria to guarantee that upper bound. I

Getting a bounded polygon coordinates from Voronoi cells

爱⌒轻易说出口 提交于 2019-11-27 13:09:01
问题 I have points (e.g., lat, lon pairs of cell tower locations) and I need to get the polygon of the Voronoi cells they form. from scipy.spatial import Voronoi tower = [[ 24.686 , 46.7081], [ 24.686 , 46.7081], [ 24.686 , 46.7081]] c = Voronoi(towers) Now, I need to get the polygon boundaries in lat,lon coordinates for each cell (and what was the centroid this polygon surrounds). I need this Voronoi to be bounded as well. Meaning that the boundaries don't go to infinity, but rather within a