-
-
Notifications
You must be signed in to change notification settings - Fork 364
Closed
Labels
Description
- what version of Makie are you running? (
]st -m Makie) (v0.24.7) - can you reproduce the bug with a fresh environment ? (
]activate --temp; add Makie) (yes) - What platform + GPU are you on? (M3 MacBook Pro)
- Which backend are you using? (GLMakie, CairoMakie, WGLMakie, RPRMakie) (CairoMakie)
- Please provide a minimal example of the failing code. If the problem is with the visualization, please provide a picture or video of it. (see below)
When creating a grid on a triangle and calling the voronoiplot function there is an error while calculating the polygons. This error is inside DelaunayTriangulation.jl.
I have already implemented a fix locally and will create an Issue + PR at DelaunayTriangulation.jl (which I will link below). However, I still wanted you to be aware of the issue, such that you can proceed as you see fit (e.g. modify the compat once it is fixed in DelaunayTriangulation.jl, etc.)
Here's a minimal example:
using CairoMakie
using LinearAlgebra
function generatePoints(n)
points = Vector{NTuple{3,Float64}}(undef, n * (n + 1) ÷ 2)
m = 1
for (k, i) in enumerate(range(0, 1, n))
for j in range(i, 1, n - k + 1)
px = i
py = j - i
pz = 1 - j
points[m] = (px, py, pz)
m += 1
end
end
return points
end
function projection(point; origin=[1 / 3, 1 / 3, 1 / 3], e1=normalize(cross(normalize([0.0, 0.0, 1.0] .- [1 / 3, 1 / 3, 1 / 3]), normalize([1 / 3, 1 / 3, 1 / 3]))), e2=normalize([0.0, 0.0, 1.0] .- [1 / 3, 1 / 3, 1 / 3]))
return sum(e1 .* (point .- origin)), sum(e2 .* (point .- origin))
end
points = generatePoints(3)
points2d = [projection(p) for p in points]
voronoiplot([p[1] for p in points2d], [p[2] for p in points2d], randn(size(points2d)))