I need to code for Voronoi Diagrams. I am using Scilab for my application. MATLAB has functions for plotting Voronoi Diagrams whereas I find only part of it that is till Delaunay Triangle in Scilab. Please suggest how to proceed further from Delaunay Triangle to Voronoi Diagrams
After you get the Delaunay Triangles using the cglab toolbox in scilab, do the following.
- Find the perpendicular bisectors for each sides of the triangles and the circumcentre of the triangles.
- Join the perpendicular bisectors to the respective circumcentres
You might want to check for the following in the process
- If the circumcentre happens to lie outside the triangle, do not join the perpendicular bisector near to it. This can be done using a function which finds if a point lies inside a closed polygon. In our case the closed polygon will be a triangle formed by two perpendicular bisectors and one respective circumcentre. The third perpendicular bisector is the point we need to find if it lies inside the closed polygon. Although scilab does not have such function, octave has and the implementation can be easily adopted. See this link.
- If a neighbouring circumcentre lies on the line joining the perpendicular bisector and the respective circumcentre, join the two circumcentres instead of joining the perpendicular bisector and the respective circumcentre.
Hope this helps. Let us know if you could do it.