Skip to content
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

La/continue #54

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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