-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Lines in WGLMakie are not inspectable #3503
Comments
A workaround might be to plot line segments as cylinders, but then I encounter other issues, cf. #3512 and #3513. If those two are fixed before this issue, then here is an alternative to using WGLMakie, LinearAlgebra
function linesegmenttubes!(ax, pts; tubewidth, quality=32, kwargs...)
marker = Makie._mantle(Makie.Point3f0(0, 0, -1/2), Makie.Point3f0(0, 0, 1/2), 1/2, 1/2, quality)
@assert iseven(length(pts))
x = pts[begin:2:end-1]
y = pts[begin+1:2:end]
pos = @. Makie.Point3f0((x + y) / 2)
dirs = @. Makie.Vec3f0(y - x)
markersize = [Makie.Vec3f0(tubewidth, tubewidth, norm(dir)) for dir in dirs]
rotation = normalize.(dirs)
Makie.meshscatter!(ax, pos; markersize, rotation, marker, kwargs...)
end
fig = Makie.Figure()
ax = Makie.LScene(fig[1, 1])
pts = [[0, 0, 0], [1, 0, 1], [2, 0, 1], [2, -1, 0]]
color = [:red, :blue]
linesegmenttubes!(ax, pts; tubewidth=0.1, quality=12, color)
Makie.DataInspector(ax; indicator_color=:gray) |
I think WGLMakie behaves correct now for this simpler example: begin
segments = Point2f[(0, 0), (0, 1), (1, 0), (1, 2)]
color = [:red, :black, :blue, :black]
inspector_label(_, i, _) = (@show Int(i); ["hello", "world", "nice", "day"][mod1(i, 4)])
fig, ax, pl = linesegments(segments; color, inspector_label, linewidth=10)
DataInspector(ax)
display(fig; backend=WGLMakie)
end It feels a bit buggy, that the index for the segment start only gets picked at the very beginning of the line, it should be more in the middle. Will need to look at the shader to see if we can fix that. The out of bounds error you're getting sounds like you checked out the branch too early, I pushed a fix for that just before merging. For GLMakie, it only gives indices for the ends of the line, not sure if we can change that right away. |
Thanks, I can confirm the bounds error is gone! To elaborate on the remaining bug, it seems to either "detect" the line itself, correctly (index 2) or some other object marking the beginning of the line, at the wrong position (index 1). Please see attached movie in the context of your 2D example. 2D_example.mov |
This might help with MakieOrg/Makie.jl#3503
In the GLMakie backend, the objects produced by
linesegments!
can beinspectable
. However, in WGLMakie, it seems they cannot.Minimum working example:
Tested on
WGLMakie v0.9.2
.The text was updated successfully, but these errors were encountered: