I'm using this package on Julia 0.5.2 and I sometimes get that the union of the triangles in the triangulation does not equal the convex hull of the points, which is a property of Delaunay triangulation. I include an easy example to show this:
using Plots, VoronoiDelaunay
min_coord=VoronoiDelaunay.min_coord
max_coord=VoronoiDelaunay.max_coord
function pointsRescaledCoords(x,y) #To be used for tessellation
Point2D[Point((max_coord-min_coord)/(maximum(x)-minimum(x))*(x[i]-maximum(x))+max_coord,
(max_coord-min_coord)/(maximum(y)-minimum(y))*(y[i]-maximum(y))+max_coord) for i in 1:length(x)]
end
#First shape
X = [0.0; 0.0; 1.0; 0.6; 1.0]
Y = [0.0; 1.0; 1.0; 0.8; 0.0]
display(plot(Shape(X,Y), opacity=.5,xlims = (-0.05,1.05),ylims=(-0.05,1.05)))
tess = DelaunayTessellation()
push!(tess,pointsRescaledCoords(X,Y))
#Display delaunayedges
x, y = getplotxy(delaunayedges(tess))
display(plot(x-min_coord,y-min_coord,xlims = (-0.05,1.05),ylims=(-0.05,1.05)))
#Second shape
X = [0.0; 0.0; 1.0; 0.6; 1.0]
Y = [0.0; 1.0; 1.0; 0.79; 0.0] #Fourth element changed from 0.8 to 0.79
display(plot(Shape(X,Y), opacity=.5,xlims = (-0.05,1.05),ylims=(-0.05,1.05)))
tess = DelaunayTessellation()
push!(tess,pointsRescaledCoords(X,Y))
x, y = getplotxy(delaunayedges(tess))
plot(x-min_coord,y-min_coord,xlims = (-0.05,1.05),ylims=(-0.05,1.05))
When using the first shape the union of the triangles in the triangulation does not equal the convex hull of the points but when using the second shape they do. The only difference between the shapes is that I have changed the fourth element in Y from 0.8 to 0.79 in the second shape.
Am I doing something wrong? It seems to me that somethings strange is happening when I do the triangulation on the first shape and I don't understand why.
I'm using this package on Julia 0.5.2 and I sometimes get that the union of the triangles in the triangulation does not equal the convex hull of the points, which is a property of Delaunay triangulation. I include an easy example to show this:
When using the first shape the union of the triangles in the triangulation does not equal the convex hull of the points but when using the second shape they do. The only difference between the shapes is that I have changed the fourth element in Y from 0.8 to 0.79 in the second shape.
Am I doing something wrong? It seems to me that somethings strange is happening when I do the triangulation on the first shape and I don't understand why.