Skip to content

Instantly share code, notes, and snippets.

@jkrumbiegel
Created May 14, 2025 11:02
Show Gist options
  • Save jkrumbiegel/43b13df88023ff71c19849c52ba03308 to your computer and use it in GitHub Desktop.
Save jkrumbiegel/43b13df88023ff71c19849c52ba03308 to your computer and use it in GitHub Desktop.
inner poly rect box stroke Makie
r1 = Rect2f((10, 20), (5, 8))
r2 = Rect2f((20, 30), (5, 8))
f, ax, _ = poly(r1)
linewidth = Observable(20)
r2_pixel = lift(ax.scene.camera.projectionview, ax.scene.viewport, linewidth) do _, _, lw
mi, ma = extrema(r2)
_mi = Makie.project(ax.scene, mi) .+ 0.5lw
_ma = Makie.project(ax.scene, ma) .- 0.5lw
Rect2f(_mi, _ma - _mi)
end
lines!(ax, r2; linewidth)
lines!(ax, r2_pixel; linewidth, space = :pixel, alpha = 0.8)
f
@jkrumbiegel
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment