Voronoi plot, line crossing
I have the following problem. Initially I create 10 points, in a 2-D space, randomly distributed and then I use the Voronoi function to creat polygons. But I want my Voronoi polyhedra to obey a gaussian-normal distribution. So the area of each 开发者_如何学Cpolygon should obey this rule. But I cannot do this since my polyhedra are not convex but have vertices and corners outside the plot, extending to infinity. So what I want to do is to assign the crossing of the lines of the corresponding polygons with the borders of the plot. but how can I get the line intersections? I know the point inside the plot , but I donnot know anything about the point outside the plot.. Thank you very much for your help!
Panos
You may better specify the terms of your problem
- Why your vertices got to infinity? Are random points choosen all over 2d plan or inside a specified area?
- Why you don't know nothing about other points?
You should probably calculate the intersections automatically. You would first need to detect the two lines which you would need to calculate. from there, you need will need two points on each line. (x1a, y1a), (x2a, y2a) and (x1b, y1b), (x2b, y2b)
from here, use the point-slope equation to find where these lines intersect:
if y-y1a=m(x-x1a) and m=(y2a-y1a)/(x2a-x1a)
精彩评论