Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I work in GIS. I have a set of polygons. I would like to make an algorithm which first check if the polygon set is a valid Voronoi diagram. If yes then returns the set of points which can generate the same voronoi diagram.
Can anybody help me how to go for it
Thanks
A short summary of this SO answer, which uses the term Thiessen polygons instead of Voronoi diagram:
This problem has been solved by Biedl et al, Recognizing Straight Skeletons and Voronoi Diagrams and Reconstructing Their Input, ISVD 2013.
The problem is simpler for some special cases, but not so trivial for general input. Note that for some input there might be infinitely many solutions, i.e., point sets with the same Voronoi diagram:
The paper by Biedl et al. presents an algorithm that (i) checks whether a polygonal tessellation is a Voronoi diagram and (ii) determines all possible point sets whose Voronoi diagram is equal to the tessellation.
The basic idea is the following: Consider a rooted spanning tree of the dual of the Voronoi diagram and keep propagating local restrictions at Voronoi nodes to a root Voronoi region. The intersection of this restrictions gives all possible solutions.
See more details in the other SO answer.
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 months ago.
Improve this question
I've studied Voronoi Diagrams and Fortune's Algorithm before. What I'm curious about is if there's a generalization of Voronoi diagrams where instead of the input being a set of points, it is instead a set of non-intersecting curves in the plane, where we want to partition the plane into regions based off the Euclidean distance to the nearest curve.
Is this problem well defined and is there any known (hopefully efficient) algorithm to compute this generalization?
I've tried searching for an answer to this, but most resources seem to focus on curved metric spaces or curved regions rather than the input set itself being composed of non-points.
Edit:
If this isn't well defined for non-intersecting curves, will it work for line segments?
Yes, the Voronoi diagram is defined for arbitrary point sets and other distances than Euclidean. A quick web search gives you as many examples as you want. Intersecting curves are also possible.
The construction of the diagram for a set of line segments is well documented. The cells are bounded by line segments and parabolic arcs. If I am right, Fortune's algorithm generalizes to this case.
For general curves, the problem gets harder. In all cases, you need to derive the equation of bisector lines, and intersect them correctly to delimit the proper arcs at triple points.
A digitized version (on a raster grid) is easier and will work with any kind of shape. It is similar to the computation of a distance map, and can be performed in time linear in the number of pixels.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I was asked this question in an interview, have no clue how to solve it.
"Given a fixed camera in a forest (with predefined trees), give the best angle in which the camera pictures the maximum of trees"
How would you approach it or at least what questions would you ask to get more requirements?
If trees don't obscure over trees then:
Sort all trees by angle around the camera position.
Use sliding window approach to find direction to look at.
If trees can obscure other trees then the second step is a bit trickier.
the idea is this:
convert the list of tree coordinates to a list of angles.
sort the list of angles
use a sliding window to find the starting and ending indices that maximize the number of trees.
note: because the best angle to position the camera might actually be very near the 360 degree, you need to take into account trees on the other side of the 360/0 line. The easiest way to handle that is to add duplicate trees to the list (in step 2) with a 360 shift. for example, a tree in degree 10 would be added twice, at degree 10 and 360+10. you don't actually need to add ALL the trees twice - you only really need to duplicate trees in the range 360+camera_angle, but its easy to just duplicate all the trees and it doesn't hurt.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to implement code that finds the largest circle that lies within boundaries of polygon with genetic algorithm.
Does anyone ha any idea?
There probably is a known algorithm in computational geometry for doing this exactly. If you want to do it using a genetic algorithm and are satisifed with a good circle rather than an optimal circle, then that is certainly possible (although an evolutionary algorithm seems a bit more natural). Circles can be represented by triples of the form (x,y,r). Mutation operators can bump the coordinates in various ways (e.g. a normally distributed increment). Cross over would be something like e.g. (a,b,c) x (d,e,f) => (a,e,f), (d,b,c). You need an objective function. Conceptually it is area -- but it is hard to make sure that the constraints are always satisfied. What you could do is use as an objective function the area minus a penalty for each violated constraint. The penalty can be adjusted to eventually kill-off all circles which violate the constraint but shouldn't be so large that it prevents all parts of the solution space from being explored. Such parameters often need to be tweaked on a trial-and-error basis.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
There is a class of algorithms for triangulation between two planar contours. These algorithms try to make a "good triangulation" to fill a space between these contours:
One of them (Optimal surface reconstruction from planar contours) is based on the dynamic programming technique and uses a cost function for determining which triangulation is acceptable according to the minimum cost.
A minimal triangle area as a cost function makes a good result in most of cases (Triangulation of Branching Contours using Area Minimization), but, unfortunately, not in all of them.
For example when you have two rectangle contours that are shifted from each other.
As you can see, according to the minimal area criteria, all points from the contour \alpha will be connected to the point A of the contour \beta, that is not true (a correct triangulation must be a "tube" through both curves, instead of two tetrahedrons).
So my questions are:
1) Does any algorithm that deals with two contours better than the dynamic programming based one exist?
2) If not, which criteria for the cost function can provide a better result?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Besides Boyd's Convex Programming book,
what's the best resource for:
analysis + practical implementation of interior point algorithms?
If you have Boyd's book, you know about CVXOPT. Look inside of it. If you are interested in implementation details, looking at an implementation is invaluable. As with most complex numerical algorithms, you are going to be much better off using previously written code than writing your own, but you probably know that. There are many other interior point implementations available online for linear programing, SOCP, quadratic programming, convex programming, etc. I have also used OOQP, and looked a bit at the insides. It seemed straightforward enough.
I also liked the first edition of Numerical Optimization. I had a good, fairly practical, overview of predictor-corrector methods in the second half. The second edition is no doubt of similar quality.
You can implement it in two ways:
If you have only one point, you'll get the area of the polygon, and then check if the sum of the area of the n triangles with a verticle in the point and the other two in two consecutively points is equal with the area of the polygon. If it's true, the point is inside, otherwise it's outside.
If you have many points (let's say M points) and you have to find if it's inside, you'll find a point inside the polygon, and split the polygon into n triangles, with a verticle in that point and the other two in two consecutively points on the polygon (that form an edge). You will have n lines, with a verticle in the point choosed before and a point in each point of the polygon. You'll sort them by the angle, clockwise. Then, you'll have M lines with a verticle in the point choosed and the other in one of the M points. You'll sort them like the first N. Then, you can find in o(N + M), for each point in the M, the nearest left and right line from the N (let's say the lines are CenterAx and CenterAy. Next, you'll have to find if the point it's in the triangle CenterAxAy. You can do it in o(1) checking if the are a of the triangle CenterAxAy is equal with area(CenterAxP) + area(CenterAyP) + area(AxAyP).
I hope you'll understand what i've written here.