Skip to content

Commit

Permalink
filled 3d curve
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarusA committed Aug 18, 2024
1 parent cb3839f commit adb568a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ const viteConfig = defineViteConfig({
items: [
{ text: 'archimedean_spiral',link: '/examples/3d/lines3d/archimedean_spiral' },
{ text: 'lines3d',link: '/examples/3d/lines3d/line3d' },
{ text: 'Filled 3d curve',link: '/examples/3d/lines3d/filled3d_curve'},
{ text: 'lines_wire_contour_3d',link: '/examples/3d/lines3d/lines_wire_contour_3d' },
{ text: 'wireframe_torus',link: '/examples/3d/lines3d/wireframe_torus' },
],
Expand Down
35 changes: 35 additions & 0 deletions examples/3d/lines3d/filled3d_curve.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ## Filled curve in 3d

# From: https://discourse.julialang.org/t/fill-a-curve-in-3d/37890/8

using GLMakie
GLMakie.activate!()

x = 0:0.05:3;
y = 0:0.05:3;
z = @. sin(x) * exp(-(x+y))

fig = Figure(; size=(600, 400))
ax = Axis3(fig[1,1]; limits=((0,3), (0,3), (0,0.2)),
perspectiveness = 0.5,
azimuth = -0.5,
elevation = 0.3,)
lines!(Point3f.(x, 0, z), transparency=true)
lines!(Point3f.(0, y, z), transparency=true)
band!(Point3f.(x, y, 0), Point3f.(x, y, z);
color=(:orangered, 0.25), transparency=true)
lines!(Point3f.(x, y, z); color=(:orangered, 0.9), transparency=true)
fig

# ## Filled gradient under 3D curve

fig = Figure(; size=(600, 400))
ax = Axis3(fig[1,1]; limits=((0,3), (0,3), (0,0.2)),
perspectiveness = 0.5,
azimuth = -0.5,
elevation = 0.3,)

band!(Point3f.(x, y, 0), Point3f.(x, y, z); color = z,
colormap = (:Spectral, 0.85), transparency=true)
lines!(Point3f.(x, y, z); color=(:black, 0.9), transparency=true)
fig

0 comments on commit adb568a

Please sign in to comment.