Skip to content

Commit

Permalink
Fix mesh raytracing example to work with new interesection types
Browse files Browse the repository at this point in the history
  • Loading branch information
dominic-chang committed Nov 27, 2024
1 parent 65cecf0 commit 8d26e58
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion examples/mino-time-example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ lines_to_plot = Krang.generate_ray.(camera.screen.pixels, 5_000)
sphere = GLMk.Sphere(GLMk.Point(0.0,0.0,0.0), horizon(metric))
GLMk.mesh!(ax, sphere, color=:black) # Sphere to represent black hole

for i in lines_to_plot; GLMk.lines!(ax, i) end
for i in lines_to_plot;
ray = map(x-> begin
(;rs, θs, ϕs) = x
[rs*sin(θs)*cos(ϕs), rs*sin(θs)*sin(ϕs), rs*cos(θs)]
end, i)
ray = hcat(ray...)
GLMk.lines!(ax, ray)
end
fig

GLMk.save("mino_time_rays.png", fig)
Expand Down
3 changes: 2 additions & 1 deletion examples/raytracing-mesh-example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ recording = GLMk.record(fig, "mesh.mp4", 1:sze*sze, framerate=120) do i
GLMk.mesh!(a, sphere, color=:black)
end

GLMk.lines!(ax3, line, color=:red)
cart_line = map(x->(x.rs*sin(x.θs)*cos(x.ϕs), x.rs*sin(x.θs)*sin(x.ϕs), x.rs*cos(x.θs)), line)
GLMk.lines!(ax3, cart_line, color=:red)
GLMk.heatmap!(ax, img, colormap=:afmhot, colorrange=(0, 8))
end
# ```@raw html
Expand Down
1 change: 1 addition & 0 deletions gpu_examples/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
Krang = "54806c32-d51a-438d-8447-e0041be2fbfb"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
2 changes: 1 addition & 1 deletion src/materials/ElectronSynchrotronPowerLawIntensity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ function (linpol::ElectronSynchrotronPowerLawIntensity{N,T})(pix::AbstractPixel,
return norm^(1 + spectral_index) * lp * prof
end
isFastLight(material::ElectronSynchrotronPowerLawIntensity) = true
isAxisymmetric(material::ElectronSynchrotronPowerLawIntensity) = false
isAxisymmetric(material::ElectronSynchrotronPowerLawIntensity) = true

0 comments on commit 8d26e58

Please sign in to comment.