voronoi

Draw different colored regions in gnuplot

一个人想着一个人 提交于 2019-12-13 07:30:11
问题 I have made the following script to draw a diagram in gnuplot. There are a few number of points each enclosed within a certain area. I want to give each enclosed region a certain color. My script is as follows: set terminal wxt set yrange [0:100] set xrange [0:100] unset colorbox set style arrow 1 nohead lc rgb 'black' set style arrow 2 nohead lc rgb 'red' set label 7 "" at 35,80 point pointtype 5 lc rgb 'black' set label 8 "" at 40,30 point pointtype 5 lc rgb 'black' set arrow from 77.0522

Trying to modify Voronoi Map in D3JS

旧街凉风 提交于 2019-12-13 05:12:16
问题 I am trying to modify this D3 example to use with my dataset http://mbostock.github.io/d3/talk/20111116/airports.html I think my problem is creating the array of coordinates for calculating the Voronoi polygons, but at this point I'm not sure. I'm getting a Uncaught TypeError: Cannot read property '0' of undefined error that points to the line where I am calling the array. The code is live, please see here http://cds.library.brown.edu/projects/mapping-genres/symbol-maps/brown-voronoi-map.html

How can I draw the polygons of a Voronoi Tesselation instead of the segments?

六眼飞鱼酱① 提交于 2019-12-12 17:16:33
问题 I've found a method to draw the segments of a Voronoi tesselation using ggplot2 : library(deldir) library(ggplot2) library(ggthemes) set.seed(123) df <- data.frame(lat = rnorm(20,39,10),long = rnorm(20,-98,15)) voronoi <- deldir(df$long, df$lat) ggplot(data=df, aes(x=long,y=lat)) + geom_segment(aes(x = x1, y = y1, xend = x2, yend = y2),size = 2,data = voronoi$dirsgs,linetype = 1,color= "#419AB0") + geom_point(fill="#EACA3E",pch=21,size = 4,color="white") I would like to know if it is possible

Furthest-point Voronoi diagram in Java

。_饼干妹妹 提交于 2019-12-12 17:09:05
问题 I'm looking for a naive algorithm to find the furthest point Voronoi diagram. Input sizes are not going to be big enough where I need something complex and as there are no Java libraries that I can find. I was hoping someone could describe a simple algorithm that shouldn't be too hard to compute? Thanks 回答1: You can find an algorithm pseduocode for farthest-point Voronoi diagram here. The Java code written by the same person is here. 回答2: I know this is kind of a late addition, but you might

Having the final Thiessen polygons, is it possible to find the initial set of points?

旧城冷巷雨未停 提交于 2019-12-12 10:23:18
问题 I'm trying to find a way to reverse the Voronoi algorithm. Basically, having some connected shapes which mostly consist of triangles and squares, I'm trying to find the set of points which, by using the Voronoi algorithm would recreate the initial shapes. 回答1: Introduction. This problem has been solved in a paper by Biedl et al. in 2013 after a partial solution by Ash and Boker in 1985. In case your Voronoi nodes are all of odd degree then the algorithm by Ash and Bolker works for you. First

Why isn't the d3 voronoi polygon drag event triggering on polygons in force simulation?

谁说我不能喝 提交于 2019-12-11 08:03:33
问题 Following this example, why isn't drag event triggering on the polygons in the following code? var data = [ { "index" : 0, "vx" : 0, "vy" : 0, "x" : 842, "y" : 106 }, { "index" : 1, "vx" : 0, "vy" : 0, "x" : 839, "y" : 56 }, { "index" : 2, "vx" : 0, "vy" : 0, "x" : 771, "y" : 72 } ] var svg = d3.select("svg"), width = +svg.attr("width"), height = +svg.attr("height"); var simulation = d3.forceSimulation(data) .force("charge", d3.forceManyBody()) .force("center", d3.forceCenter(width / 2,

Plot VoronoiDiagram using Graphics in Mathematica

◇◆丶佛笑我妖孽 提交于 2019-12-11 05:29:23
问题 Completing questions on how to plot a ConvexHull or a DelaunayTriangulation using Graphics in Mathematica, I would now like to plot the VoronoiDiagram within Graphics. Considering : Needs["ComputationalGeometry`"] pts = RandomReal[{0, 10}, {60, 2}]; vdpts=VoronoiDiagram[pts] 回答1: How about Needs["ComputationalGeometry`"] pts = RandomReal[{0, 10}, {10, 2}] DiagramPlot[pts] or am I missing your point? 来源: https://stackoverflow.com/questions/6477753/plot-voronoidiagram-using-graphics-in

How to stop plotting once line touches perimeter of predefined square?

落花浮王杯 提交于 2019-12-11 05:05:29
问题 I am trying to recreate a Voronoi diagram without actually using the Voronoi function plot. I have a predefined 1x1 square that acts as my "test" area. My code knows where the lines of the diagram intersect the perimeter, but the line doesn't stop there. It keeps going until it reaches a random point. x1 = 6 y1 = x1 x = gallery('uniformdata',[1,x1],0) y = gallery('uniformdata',[1,y1],1) sizeofx = size(x,2) sizeofy = size(y,2) reshapedx = reshape(x,sizeofx,1) reshapedy = reshape(y,sizeofy,1)

How do I pass on points that the user entered in Matplotlib to a np.array?

≯℡__Kan透↙ 提交于 2019-12-10 23:18:13
问题 I want to create a program that allows the user to first enter points in a Matplotlib plot and then creates a Voronoi Diagram using those points. Figured out the 2 parts, but not the connection. How do I pass on the points that the user entered and use it in the Voronoi part? (I just need to know how to change the points = np.random.rand(20,2) to the points the user entered.) Plotting the points: import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlim([0, 10])

Color unbounded cells of voronoi diagram in MATLAB

时光毁灭记忆、已成空白 提交于 2019-12-10 15:40:03
问题 I have two sets of points and plot them in blue stars and red dots. Then I plot Voronoi diagram of both sets with voronoi(X,Y) function. I want to specify color of each cell depends on which set it's site is belong. I've almost done this one by the use of patch function this way: [v,c]=voronoin(D); for p=1:TheNumberOfSets r=rand()/2+0.5; % random gray color col=[r r r]; for s=1:PointsInSet(p) l=l+1; patch(v(c{l},1),v(c{l},2),col); % color axis([0 10 0 10]); end end Where D is the coordinates