提问人:theo-brown 提问时间:11/14/2023 更新时间:11/14/2023 访问量:33
GLMakie 中 3D 绘图的动画旋转
Animated rotation of 3D plot in GLMakie
问:
使用 GLMakie,我想增量旋转 3D 绘图,保存结果的动画。
每帧应将绘图旋转一个小角度(例如,1 度)。在动画过程中,绘图应旋转 360 度。
这是我的意思(ish)的视频示例: https://imgur.com/a/ggTCVVm
这是我目前拥有的:
using GLMakie
xs = -10:0.5:10
ys = -10:0.5:10
zs = [cos(x) * sin(y) for x in xs, y in ys]
# Explicitly create figure and axes - is this necessary?
fig = GLMakie.Figure()
ax = GLMakie.Axis3(fig[1, 1])
Makie.surface!(xs, ys, zs)
camera = Makie.cam3d!(fig.scene) # Ensure we have a 3D camera - is this necessary?
N_camera_steps = 100
GLMakie.record(
fig,
"test.mp4",
[2π/N_camera_steps for _ = 1:N_camera_steps];
framerate = 30,
) do angle
GLMakie.rotate_cam!(fig.scene, camera, (angle, 0, 0)) # Only rotate about one axis
end
但是,这会生成仅显示静态图的.mp4。
我可能误解了这有多复杂——我没有真正考虑过参考系,或者我是否应该尝试旋转相机或情节。
我怎样才能在GLMakie中达到我想要的结果?
答: 暂无答案
评论