Skip to content

Commit

Permalink
Merge pull request #54 from MakieOrg/la/continue
Browse files Browse the repository at this point in the history
La/continue
  • Loading branch information
lazarusA authored Aug 18, 2024
2 parents 627b2e4 + adb568a commit a07f572
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 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
9 changes: 4 additions & 5 deletions examples/3d/meshes/isosurfaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ function show_isosurface(f,h,ξ; color=(:dodgerblue,0.5), isoval=100)

## generate the mesh using marching cubes

vts, fcs = isosurface(s, algo)
vts, fcs = Meshing.isosurface(s, algo)
mc = GeometryBasics.Mesh(Point3f.(vts), GeometryBasics.TriangleFace.(fcs))

## mc = GeometryBasics.Mesh(s, algo)

return mesh(f, vts, map(v -> GeometryBasics.TriangleFace(v...), fcs);
return mesh(f, normal_mesh(mc);
color,
diffuse = Vec3f0(0.8),
specular = Vec3f0(1.1),
Expand All @@ -32,7 +31,7 @@ end

# ### Torus

# isosurfaces for h(x,y,z)=0
# Isosurfaces for ``h(x,y,z)=0``

torus(x,y,z; c=20, a=15) = ((hypot(x,y)-c)^2+z^2-a^2)

Expand Down

0 comments on commit a07f572

Please sign in to comment.