I am trying to convert the 3D viewer of my kitepower
system simulator (Bitbucket)
to Julia/ Makie.jl.
The old Python/C++ library is unsupported since 8 years and
the newest system where it works is Ubuntu 14.04, so I
need something that is easier to install and well maintained.
But the quality, performance and simplicity of
cgkit is still unmatched, so perhaps it can still serve
as inspiration for Julia developers.
see: https://web.archive.org/web/20180611223914/http://cgkit.sourceforge.net/doc2/
Here a screenshot to show what I want to achieve:
A 3D view of a scene, updated 20 times per second.
With Julia 1.6 the load times are becoming acceptable,
so I thought this is a nice project for the lockdown.
First try in Julia:
using Makie, GLMakie
function demo3(scene)
X = zeros(2)
Y = [-10.0, 10.0]
Z = zeros(2)
lines!(scene, X, Y, Z, color = :black, linewidth = 2)
X = [0.0, 10.0]
Y = zeros(2)
Z = zeros(2)
lines!(scene, X, Y, Z, color = :black, linewidth = 2)
X = zeros(2)
Y = zeros(2)
Z = [0.0, 10.0]
lines!(scene, X, Y, Z, color = :black, linewidth = 2)
a = 10
X = range(0, stop=10, length=5)
Y = zeros(length(X))
Z = a .* cosh.(X./a) .- 10.0
lines!(scene, X, Y, Z, color = :yellow, linewidth = 5)
cam = cameracontrols(scene)
cam.lookat[] = [5,0,5]
cam.eyeposition[] = [5,-15,5]
update_cam!(scene)
zoom!(scene, [0,0,5], 6, false)
end
function show()
scene=Scene(show_axis=false, limits = Rect(0,-10.0,0, 11,10,11), resolution = (660, 660), camera=cam3d_cad!)
demo3(scene)
return scene
end
Still a long way to go to reach the beauty of the Python based solution…
By the way, this is the link to the Python code of the viewer: Bitbucket
Next step: Add arrows, balls and cylinders…
I found the answer to my first question myself…