JuliaGeometry / VoronoiDelaunay.jl

Fast and robust Voronoi & Delaunay tessellation creation with Julia
Other
123 stars 26 forks source link

Missing Voronoi edges #14

Closed robertdj closed 8 years ago

robertdj commented 8 years ago

When plotting edges as illustrated in the README, the Delaunay edges all show up as expected, but I often find Voronoi edges missing. (collecting the Voronoi edges also reveal that only a subset of the edges are available)

Consider e.g. the following code:

using VoronoiDelaunay

N = 8
pts = Point2D[]
for n = 1:N
    x = 1 + rand()
    y = 1 + rand()
    push!(pts, Point2D(x,y))
end

tess = DelaunayTessellation(N)
push!(tess, pts)

using Winston

Vx, Vy = getplotxy(voronoiedges(tess))
plot(Vx, Vy)

Dx, Dy = getplotxy(delaunayedges(tess))
oplot(Dx, Dy, "r--")

One realization looks as follows (black lines = Voronoi; red lines = Delaunay; stars = points from pts): voronoi

skariel commented 8 years ago

yes, its a bug which I fixed locally. Let me fix this here in a few minutes...

skariel commented 8 years ago

fixed now in master, please try and tell me if it works for you

skariel commented 8 years ago

well... not completely fixed. Fixing some more now...

skariel commented 8 years ago

ok, fixed now note it will iterate over the point at the corners of the allowed area too (1,1 1,2 2,1 22)

it looks just fine now:

index

robertdj commented 8 years ago

Great -- thanks!