something like this: (this code you can find it the gallery beautiful makie,
using AbstractPlotting: get_dim, surface_normals
using GLMakie, Rotations, GeometryBasics
function getMesh(x,y,z)
positions = vec(map(CartesianIndices(z)) do i
GeometryBasics.Point{3, Float32}(
get_dim(x, i, 1, size(z)),
get_dim(y, i, 2, size(z)),
z[i])
end)
faces = decompose(GLTriangleFace, Rect2D(0f0, 0f0, 1f0, 1f0), size(z))
normals = surface_normals(x, y, z)
vertices = GeometryBasics.meta(positions; normals=normals)
meshObj = GeometryBasics.Mesh(vertices, faces)
meshObj
end
Θ = LinRange(0, 2π, 100) # 50
Φ = LinRange(0, π, 100)
r = 0.5
x = [r * cos(θ) * sin(ϕ) for θ in Θ, ϕ in Φ]
y = [r * sin(θ) * sin(ϕ) for θ in Θ, ϕ in Φ]
z = [r * cos(ϕ) for θ in Θ, ϕ in Φ]
meshSphere = getMesh(x,y, z)
fig = Figure(resolution = (600,600))
r = [0.5, 0.6, 0.95]
ax = Axis3(fig, aspect = :data)
meshplot = mesh!(ax, meshSphere, color= [v[3] for v in coordinates(meshSphere)], # color = z, # v[3]
colormap = (:green,:red), shading = true)
scale!(meshplot, r[1], r[2], r[3])
fig[1,1] = ax
fig
I suppose the right way to do the transformations, rotations should be done as @mschauer just mentioned above.