Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Union of triangles is not always equal to the convex hull when using VoronoiDelaunay? #34

Open
nako95 opened this issue Aug 10, 2017 · 1 comment · May be fixed by #50
Open

Union of triangles is not always equal to the convex hull when using VoronoiDelaunay? #34

nako95 opened this issue Aug 10, 2017 · 1 comment · May be fixed by #50

Comments

@nako95
Copy link

nako95 commented Aug 10, 2017

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.

@nako95 nako95 changed the title Union of triangels is not always equal to the convex hull? Union of triangels is not always equal to the convex hull when using VoronoiDelaunay? Aug 10, 2017
@nako95 nako95 changed the title Union of triangels is not always equal to the convex hull when using VoronoiDelaunay? Union of triangles is not always equal to the convex hull when using VoronoiDelaunay? Aug 10, 2017
@skariel
Copy link
Contributor

skariel commented Aug 11, 2017

see issue #16 , this is known behavior. The solution will be to use 3 points instead of 4 as the initial embedding.

MiriamHinzen pushed a commit to MiriamHinzen/VoronoiDelaunay.jl that referenced this issue Oct 29, 2019
…on and handling points outside [1,2]x[1,2]

Non-convexity of the tessellation means we are missing triangles.
A non-convex tessellation is obtained, if at least one of the corner points of the initial square lies inside the circumcircle of a missing triangle.
This problem is solved by scaling and shifting the points such that the union of the circumcircles of the triangles along the boundary of the tessellation lies inside (1,2)x(1,2).
With this modification it is now possible to start off with a point set outside [1,2]x[1,2].
Apply the function scaleShiftPoints to the point set before the tessellation and the function expand to the edge vertices after the tessellation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants