Skip to content

[BUG]: not clipped Voronoi tessellation, even if clip = true #223

@TongTongYee

Description

@TongTongYee

Describe the bug

When I did clipped Voronoi tessellation, one of voronoi cells was not clipped.

Reproducer

using DelaunayTriangulation
using CairoMakie

points = [ [-0.12046806941342439, 0.4173136338275707],
[-0.11544856652119836, 0.4086195997894963],
[-0.11042906362897237, 0.4173136338275707],
[-0.11042906362897235, 0.3999255657514219],
[-0.10540956073674634, 0.3912315317133475],
[-0.10540956073674634, 0.4086195997894963],
[-0.10039005784452033, 0.4173136338275707],
[-0.10039005784452032, 0.3825374976752731],
[-0.10039005784452032, 0.3999255657514219],
[-0.09537055495229432, 0.4086195997894963],
[-0.09537055495229431, 0.3912315317133475],
[-0.0903510520600683, 0.3999255657514219],
[-0.08533154916784229, 0.40861959978949625],
[-0.08031204627561628, 0.41731363382757064],
[-0.08031204627561626, 0.3825374976752731],
[-0.07529254338339025, 0.3912315317133475],
[-0.07027304049116424, 0.3999255657514219],
[-0.06023403470671221, 0.3825374976752731],
[-0.05019502892226017, 0.3999255657514219],
[-0.040156023137807764, 0.4173136338275707]
]

tri = triangulate(hcat([[coor[1],coor[2]] for coor in points]...))
vorn = voronoi(tri, clip = true)
ch = vorn.triangulation.convex_hull
ch_points = [get_point(tri, i) for i in DelaunayTriangulation.get_vertices(ch)]
fig, ax, sc = lines(ch_points, color = :red, linewidth = 4)
scatter!(ax,tri.points,color=:blue)
voronoiplot!(vorn)
ylims!(ax,0.36,0.43)
fig
println(sort([get_area(vorn,i) for i in eachindex(points)])[end])

output
Image
println(sort([get_area(vorn,i) for i in eachindex(points)])[end]) -> 1.093561292580011e11

the area 1.093561292580011e11 is a strange reulst.

Environment information

using InteractiveUtils
versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12a (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × AMD Ryzen 5 5600X 6-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 4 default, 0 interactive, 2 GC (on 12 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 4

and

using Pkg
Pkg.status()
  [ec485272] ArnoldiMethod v0.4.0
⌅ [7d9fca2a] Arpack v0.5.3
  [6e4b80f9] BenchmarkTools v1.6.0
⌃ [13f3f980] CairoMakie v0.13.2
  [d38c429a] Contour v0.6.3
  [927a84f5] DelaunayTriangulation v1.6.4
  [cc61a311] FLoops v0.2.2
  [92c85e6c] GSL v1.0.1
⌃ [5c1252a2] GeometryBasics v0.5.7
⌃ [56d4f2e9] Gridap v0.18.11
  [7073ff75] IJulia v1.27.0
⌃ [9136182c] ITensors v0.7.1
  [de52edbc] Integrals v4.5.0
  [c8e1da08] IterTools v1.10.0
⌃ [98e50ef6] JuliaFormatter v1.0.62
  [b964fa9f] LaTeXStrings v1.4.0
  [a90b1aa1] LibGEOS v0.9.4
  [da04e1cc] MPI v0.20.22
⌅ [ee78f7c6] Makie v0.22.2
  [299715c1] MarchingCubes v0.1.11
  [f16ad982] NaturalNeighbours v1.3.6
⌃ [1dea7af3] OrdinaryDiffEq v6.93.0
  [b0944070] OrdinaryDiffEqLowStorageRK v1.3.0
⌃ [91a5bcdd] Plots v1.40.8
⌃ [c3e4b0f8] Pluto v0.20.5
  [438e738f] PyCall v1.96.4
⌃ [1b9008d5] QuantumAlgebra v1.3.1
⌃ [6e0679c1] QuantumOptics v1.2.1
⌃ [860ef19b] StableRNGs v1.0.2
  [90137ffa] StaticArrays v1.9.13
  [24249f21] SymPy v2.3.3
⌃ [0c5d862f] Symbolics v6.18.2
  [d0cc0030] T8code v0.7.4
⌃ [6aa20fa7] TensorOperations v5.1.2
  [c5d3f3f7] TetGen v2.0.0
⌃ [a7f1ee26] Trixi v0.11.4
  [9f57e263] WignerSymbols v2.0.0

I also do this example code in the different server, and I get the same result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions