3D projection

Source code Author Update time

using Plots
gr()

3D plots projection: orthographic (isometric) and perspective (fps).

x = [[-1, 1], [-1, -1], [-1, 1], [1, 1], [1, 1], [-1, -1], [-1, -1], [1, 1], [-1, 1], [-1, -1], [-1, 1], [1, 1]]
y = [[1, 1], [-1, 1], [-1, -1], [-1, 1], [1, 1], [1, 1], [-1, -1], [-1, -1], [1, 1], [-1, 1], [-1, -1], [-1, 1]]
z = [[1, 1], [1, 1], [1, 1], [1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, -1], [-1, -1], [-1, -1], [-1, -1]]
kw = (aspect_ratio = :equal, label = :none, xlabel = "x", ylabel = "y", zlabel = "z", xlims = (-1.1, 1.1), ylims = (-1.1, 1.1), zlims = (-1.1, 1.1))
plot(plot(x, y, z; proj_type = :ortho, title = "orthographic (isometric)", camera = (45, round(atand(1 / √2); digits = 3)), kw...), plot(x, y, z; proj_type = :persp, title = "perspective (fps)", camera = (0, 0), kw...))

This page was generated using DemoCards.jl and Literate.jl.